Example code is for an older version of Toolkit, newer code is available.
<!-- Copyright (c) 2021 ActivePDF, Inc. -->
<!-- ActivePDF Toolkit 2017 -->
<!-- Example generated 01/25/21 -->
<!-- Example uses the .NET DLL which requires -->
<!-- Coldfusion 8 or above -->
<CFSCRIPT>
// Get current path
strPath = ExpandPath(".") & "\";
// Instantiate Object
oTK = CreateObject(".NET", "APToolkitNET.Toolkit", "C:\Program Files\activePDF\Toolkit\DotNetComponent\2.0\APToolkitNET.dll");
// Here you can place any code that will alter the output file
// Such as adding security, setting page dimensions, etc.
// Set the PDF page Height and Width (72 = 1")
oTK.Set_OutputPageHeight(792.0);
oTK.Set_OutputPageWidth(612.0);
// Create the new PDF file
intOpenOutputFile = oTK.OpenOutputFile(strPath & "new.pdf");
if(intOpenOutputFile != 0) {
Error("OpenOutputFile", intOpenOutputFile);
}
// After OpenOutputFile and before CloseOutputFile various
// functions can be called to create the PDF as desired
// A few examples are shown below
// Each time a new page is required call NewPage
oTK.NewPage();
// Get the current version of Toolkit and save it to print on the PDF
tkVer = oTK.Get_ToolkitVersion();
// Text can be added onto the new page with
// SetFont, PrintText and PrintMultilineText functions
oTK.SetFont("Helvetica", 24);
oTK.PrintText(72.0, 720.0, tkVer);
// Images can be added onto the new page with
// PrintImage, PrintJPEG and PrintTIFF
oTK.PrintJPEG(strPath & "IMG.jpg", 72.0, 300.0, 468.0, 400.0, true);
// Close the new file to complete PDF creation
oTK.CloseOutputFile();
// Release Object
oTK = 0;
// Process Complete
WriteOutput("Done!");
// Error Handling
Function Error(method, outputCode) {
WriteOutput("Error in " & method & ": " & outputCode);
}
</CFSCRIPT>