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");
// Get the page count of the PDF
intNumPages = oTK.NumPages(strPath & "PDF.pdf");
if(intNumPages < 1) {
Error("NumPages", intNumPages);
}
// Get the rotation of the page
// Note: there is no need to open an input file as NumPages opened the PDF
pageRotation = oTK.GetInputPageRotation(1);
// Close the input file
oTK.CloseInputFile();
// Load the page 1 details of the PDF
oTK.GetBoundingBox(strPath & "PDF.pdf", 1);
// Get the Page Width and Height
pageWidth = oTK.Get_BoundingBoxWidth();
pageHeight = oTK.Get_BoundingBoxHeight();
// Get the left and top coordinates of the bounding box
pageLeft = oTK.Get_BoundingBoxLeft();
pageTop = oTK.Get_BoundingBoxTop();
// With the data set to variables they can be used where needed
// Close the input file as it's no longer needed
oTK.CloseInputFile();
// Release Object
oTK = 0;
// Process Complete
WriteOutput("Done!");
// Error Handling
Function Error(method, outputCode) {
WriteOutput("Error in " & method & ": " & outputCode);
}
</CFSCRIPT>