<!-- Copyright (c) 2021 ActivePDF, Inc. --> <!-- ActivePDF WebGrabber 2016 --> <!-- Example generated 01/27/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"); // Set the quality options for the created PDF (IE engine only) // For custom settings to take effect set the configuration to custom oWG.Set_PredefinedSetting(ADK.PostScript.PredefinedConfiguration.Custom); // Specifies if ASCII85 encoding should be applied to binary streams oWG.Set_ASCIIEncode(true); // Automatically control the page orientation based on text flow oWG.Set_AutoRotate(true); // Specifies if CMYK colors should be converted to RGB oWG.Set_ConvertCMYKToRGB(true); // Set the DPI for the created PDF oWG.Set_Resolution(300.0); // Color Image Quality Settings oWG.Set_ColorImageDownsampleThreshold(1); oWG.Set_ColorImageDownsampleType(ADK.PostScript.Images.DownsampleOption.None); oWG.Set_ColorImageFilter(ADK.PostScript.Images.CompressionOption.FlateEncode); oWG.Set_ColorImageResolution(72); // Gray Image Quality Settings oWG.Set_GrayImageDownsampleThreshold(1); oWG.Set_GrayImageDownsampleType(ADK.PostScript.Images.DownsampleOption.None); oWG.Set_GrayImageFilter(ADK.PostScript.Images.CompressionOption.FlateEncode); oWG.Set_GrayImageResolution(72); // Monochrome Image Quality Settings oWG.Set_MonoImageDownsampleThreshold(1); oWG.Set_MonoImageDownsampleType(ADK.PostScript.Images.DownsampleOption.None); oWG.Set_MonoImageFilter(ADK.PostScript.Images.MonochromeCompression.FlateEncode); oWG.Set_MonoImageResolution(72); // 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.IE); // Convert the HTML background (IE engine only) oWG.Set_PrintBackground(true); // PDF output location and filename oWG.Set_OutputDirectory(strPath); oWG.Set_NewDocumentName("quality.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>