<!-- Copyright (c) 2021 ActivePDF, Inc. --> <!-- ActivePDF WebGrabber 2016 --> <!-- Example generated 04/16/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"); // Stamp Images and Text onto the output PDF oWG.AddStampCollection("TXTinternal"); oWG.Set_StampFont("Helvetica"); oWG.Set_StampFontSize(108); oWG.Set_StampFontTransparency(0.1); oWG.Set_StampRotation(45.0); wgFillMode = CreateObject(".NET", "ADK.PDF.FontFillMode", "C:\Program Files\activePDF\WebGrabber\bin\APWebGrabberProxy.dll,C:\Program Files\activePDF\WebGrabber\bin\APWebGrabber.Net35.dll"); oWG.Set_StampFillMode(wgFillMode.FillThenStroke); oWG.SetStampColor(255, 0, 0, 0); oWG.SetStampStrokeColor(100, 0, 0, 0); oWG.AddStampText(116.0, 156.0, "Internal Only"); oWG.AddStampCollection("IMGimage"); oWG.AddStampImage(strPath & "logo.png", 508.0, 16.0, 32.0, 32.0, true); // Set whether the stamp collection(s) appears in the background or foreground oWG.Set_StampBackground(0); // 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("stamped.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()); } // If there will be multiple conversions in the same instance // you can clear the stamp collections or remove one individually // in order to change what is stamped on the next conversion oWG.RemoveStampCollection("TXTinternal"); oWG.ClearStampCollections(); // 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>