WebGrabber WBE 2010

HeaderHeight

Example code is for an older version of WebGrabber, newer code is available.
<?php
// Copyright (c) 2019 ActivePDF, Inc.
// ActivePDF WebGrabber WBE 2010
// Example generated 09/22/19 
?>

<?php
// Get current path
$strPath = dirname(__FILE__) . "\\";

// Instantiate Object
$oWG = new COM("APWebGrabber.Object");

// Enable extra logging - c:\windows\activepdf\logs
// Logging should be disabled during production
$oWG->Debug = true;

// Fast web view
$oWG->LinearizeDocument = true;

// Time to wait for conversion to complete (in seconds)
$oWG->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->Orientation = 0;

// Convert HTML fields to PDF fields
$oWG->PreserveButtons = false;
$oWG->PreserveCheckBoxes = false;
$oWG->PreserveDropDowns = false;
$oWG->PreserveRadioButtons = false;
$oWG->PreserveTextBoxes = false;

// Convert links
$oWG->PreserveLinks = true;


// Enable flash conversion
$oWG->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->HeaderHTML = "<html><body>";
$oWG->HeaderHTML = "<div style='float: left;'>activePDF.com</div>";
$oWG->HeaderHTML = "<div style='float: right;'>09/22/2019 12:06AM</div>";
$oWG->HeaderHTML = "</body></html>";
$oWG->HeaderHeight = 0.5;
$oWG->HeaderFirstPageOnly = false;

$oWG->FooterHTML = "<html><body>";
$oWG->FooterHTML = "<div style='text-align: center;'>%cp% of %tp%</div>";
$oWG->FooterHTML = "</body></html>";
$oWG->FooterHeight = 0.5;
$oWG->FooterFirstPageOnly = false;

// PDF output location and filename
$oWG->OutputDirectory = $strPath;
$oWG->NewDocumentName = "headfoot.pdf";

// HTML to convert
// Examples:
// http://domain.com/path/file.aspx
// c:\folder\file.html
$oWG->URL = "http://examples.activepdf.com/system/files/49/original/wg.html";

// Perform the HTML to PDF conversion
$intDoPrint = $oWG->DoPrint("127.0.0.1", 58585);
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", 58585);

// Clear variables from HeaderHTML and HeaderURL properties
$oWG->ClearHeaderHTML();

// Clear variables from FooterHTML and FooterURL properties
$oWG->ClearFooterHTML();

// Release Object
$oWG = null;

// Process Complete
echo "Done!";

// Error Handling
function Error($method, $outputCode) {
  echo "Error in " . $method . ": " . $outputCode;
}
?>

Copyright © 2019 ActivePDF, Inc