<!-- Copyright (c) 2021 ActivePDF, Inc. --> <!-- ActivePDF WebGrabber 2016 --> <!-- Example generated 03/02/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"); // Setup the FTP request supplying credentials if needed oWG.AddFTPRequest("127.0.0.1", "/folder"); oWG.SetFTPCredentials("user", "pass"); // Set which files will upload with the FTP request // To attach a binary file use AddFTPBinaryAttachment oWG.Set_FTPAttachOutput(true); oWG.AddFTPAttachment(strPath & "file.txt"); // 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("ftp.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()); } // Options available to clear or remove FTP requests are only // needed if the object remains instantiated. oWG.RemoveFTP("127.0.0.1", "/folder"); oWG.ClearFTPAttachments(); oWG.ClearFTPs(); // 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>