<!-- Copyright (c) 2021 ActivePDF, Inc. --> <!-- ActivePDF WebGrabber 2016 --> <!-- Example generated 03/07/21 --> <!-- Example uses the .NET DLL which requires --> <!-- Coldfusion 8 or above --> <CFSCRIPT> // Get current path strPath = ExpandPath(".") & "\"; // Instantiate Object oWG = CreateObject(".NET", "APWebGrabber.WebGrabber", "C:\Program Files\activePDF\WebGrabber\bin\APWebGrabber.Net35.dll"); // Adding page numbers simply requires using %cp% in the footer // or header HTML. %tp% will translate to the total pages // Start page and total page numbers can be set with SetPageNbrParams oWG.SetPageNbrParams(1, 4); oWG.Set_FooterHeight(0.5); oWG.Set_FooterHTML("Page %cp% of %tp%"); // Enable extra logging (logging should only be used while troubleshooting) // C:\ProgramData\activePDF\Logs\ oWG.Set_Debug(true); // Fast web view oWG.Set_LinearizePDF(true); // Time to wait for conversion to complete (in seconds) // Set the amount of time before a request will time out oWG.Set_Timeout(40); // Margins (Top, Bottom, Left, Right) 1.0 = 1" oWG.SetMargins(0.75, 0.75, 0.75, 0.75); // 0 = Portrait, 1 = Landscape oWG.Set_Orientation(0); // Rendering engine used for the HTML // 0 = Native, 1 = IE wgEngine = CreateObject(".NET", "APWebGrabberInterface.ConversionEngine", "C:\Program Files\activePDF\WebGrabber\bin\APWebGrabber.Net35.dll"); oWG.Set_EngineToUse(wgEngine.Native); // Convert HTML fields to PDF fields oWG.Set_PreserveButtons(false); oWG.Set_PreserveCheckBoxes(false); oWG.Set_PreserveDropDowns(false); oWG.Set_PreserveRadioButtons(false); oWG.Set_PreserveTextBoxes(false); // Convert links wgLinkStyle = CreateObject(".NET", "APWebGrabberInterface.LinkStyle", "C:\Program Files\ActivePDF\WebGrabber\bin\APWebGrabber.Net35.dll"); oWG.Set_GenerateLinks(wgLinkStyle.Both); // Convert h tags into bookmarks oWG.Set_GenerateBookmarks(true); // Enable flash conversion oWG.Set_EmbedFlash(1); // PDF output location and filename oWG.Set_OutputDirectory(strPath); oWG.Set_NewDocumentName("pagenumbers.pdf"); // HTML to convert // Examples: // http://domain.com/path/file.aspx // c:\folder\file.html oWG.Set_URL("http://examples.activepdf.com/samples/doc"); // Perform the HTML to PDF conversion results = oWG.ConvertToPDF(); if(results.Get_WebGrabberStatus() != "Success") { Error("ConvertToPDF", results, results.Get_WebGrabberStatus()); } // Release Object oWG = 0; // Process Complete WriteOutput("Done!"); // Error Handling Function Error(method, oResults, errorStatus) { WriteOutput("Error with " & method & ": <br/>" & errorStatus & "<br/>" & oResults.Get_details()); } </CFSCRIPT>