Example code is for an older version of Toolkit, newer code is available.
<!-- Copyright (c) 2021 ActivePDF, Inc. -->
<!-- ActivePDF Toolkit 2017 -->
<!-- Example generated 04/12/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");
// Set the PDF page Height and Width to Letter (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);
}
// Create a new blank page to place the scaled image
oTK.NewPage();
// Place the image in a box the size of the page
// Setting the persist ration parameter to true will
// make is so the image is not distorted and properly scaled
oTK.PrintImage(strPath & "Big.jpg", 0.0, 0.0, 612.0, 792.0, true, 0);
// 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>