<!-- Copyright (c) 2021 ActivePDF, Inc. --> <!-- ActivePDF WebGrabber 2016 --> <!-- Example generated 01/20/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"); // Add an email oWG.AddEMail(); // Set server information oWG.SetSMTPInfo("0.0.0.0", 25); oWG.SetSMTPCredentials("john.doe", "activePDF", "asdfasdf"); // Set email addresses oWG.SetSenderInfo("John Doe", "john.doe@asdidlwenra.com"); oWG.SetReplyToInfo("John Doe", "john.doe@asdidlwenra.com"); oWG.SetRecipientInfo("Jane Doe", "jane.doe@asdidlwenra.com"); oWG.AddToCC("Jim Doe", "jim.doe@asdidlwenra.com"); oWG.AddToBcc("Janice Doe", "janice.doe@asdidlwenra.com"); // Subject and Body oWG.Set_EMailSubject("PDF Delivery from activePDF"); oWG.SetEMailBody("Here is your PDF!", false); // Attachments - Binary attachments can be added with AddEMailBinaryAttachment oWG.AddEMailAttachment(strPath & "x.pdf"); // Other email options oWG.Set_EMailReadReceipt(false); oWG.Set_EMailAttachOutput(true); // 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("email.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 running multiple conversions in one instance: // One email can be removed before the next conversion oWG.RemoveEMail("john.doe@activepdf.com"); // An attachment can be removed oWG.ClearEMailAttachments(); // or all emails can be removed oWG.ClearEMails(); // 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>