WebGrabber WBE 2010

ClearHeaderHTML

Example code is for an older version of WebGrabber, newer code is available.
<!-- Copyright (c) 2019 ActivePDF, Inc. -->
<!-- ActivePDF WebGrabber WBE 2010 -->
<!-- Example generated 12/07/19  -->

<!-- Example uses the .NET DLL which requires -->
<!-- Coldfusion 8 or above -->

<CFSCRIPT>
// Get current path
strPath = ExpandPath(".") & "\";

// Instantiate Object
// For WebGrabber in ColdFusion you must use a proxy DLL
oWG = CreateObject(".NET", "APWebGrabberProxy.APWebGrabber", "C:\Program Files\activePDF\WebGrabber WBE\bin\APWebGrabberProxy.dll");

// Enable extra logging - c:\windows\activepdf\logs
// Logging should be disabled during production
oWG.Set_Debug(true);

// Fast web view
oWG.Set_LinearizeDocument(true);

// Time to wait for conversion to complete (in seconds)
oWG.Set_Timeout(30);

// 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);

// 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
oWG.Set_PreserveLinks(true);


// Enable flash conversion
oWG.Set_EmbedFlash(true);

// Add a header and footer to the PDF output
// Must use full paths to additional files
// Using %cp% of %tp% in the HTML equals current and total page numbers
oWG.Set_HeaderHTML("<html><body>");
oWG.Set_HeaderHTML("<div style='float: left;'>activePDF.com</div>");
oWG.Set_HeaderHTML("<div style='float: right;'>12/07/2019 01:29AM</div>");
oWG.Set_HeaderHTML("</body></html>");
oWG.Set_HeaderHeight(0.5);
oWG.Set_HeaderFirstPageOnly(false);

oWG.Set_FooterHTML("<html><body>");
oWG.Set_FooterHTML("<div style='text-align: center;'>%cp% of %tp%</div>");
oWG.Set_FooterHTML("</body></html>");
oWG.Set_FooterHeight(0.5);
oWG.Set_FooterFirstPageOnly(false);

// PDF output location and filename
oWG.Set_OutputDirectory(strPath);
oWG.Set_NewDocumentName("headfoot.pdf");

// HTML to convert
// Examples:
// http://domain.com/path/file.aspx
// c:\folder\file.html
oWG.Set_URL("http://examples.activepdf.com/system/files/49/original/wg.html");

// Perform the HTML to PDF conversion
intDoPrint = oWG.DoPrint("127.0.0.1", 54545);
if(intDoPrint != 0) {
  Error("DoPrint", intDoPrint);
}

// Cleans up all internal string variables used during conversion
// By default variables are deleted 3 minutes after the conversion
oWG.CleanUp("127.0.0.1", 54545);

// Clear variables from HeaderHTML and HeaderURL properties
oWG.ClearHeaderHTML();

// Clear variables from FooterHTML and FooterURL properties
oWG.ClearFooterHTML();

// Release Object
oWG = 0;

// Process Complete
WriteOutput("Done!");

// Error Handling
Function Error(method, outputCode) {
  WriteOutput("Error in " & method & ": " & outputCode);
}
</CFSCRIPT>

Copyright © 2019 ActivePDF, Inc