<?php // Copyright (c) 2021 ActivePDF, Inc. // ActivePDF WebGrabber 2016 // Example generated 04/10/21 ?> <?php // Get current path $strPath = dirname(__FILE__) . "\\"; // Instantiate Object $oWG = new COM("APWebGrabber.Object"); // The below font options only work with conversions that // go through the printer or postscript file conversions // NOTE: Below font properties are IE engine only with the // exception of EmbedAllFonts which is supported in both engines // Whether to embed all fonts other than base14 fonts $oWG->EmbedAllFonts = true; // Whether to embed Base14 fonts $oWG->EmbedBase14Fonts = false; // Whether embedded fonts should be a subset $oWG->SubsetFonts = true; // If TrueType fonts should be substituting for the version in the // x:\windows\fonts folder $oWG->SubstituteTTFonts = false; // Enable extra logging (logging should only be used while troubleshooting) // C:\ProgramData\activePDF\Logs\ $oWG->Debug = true; // Fast web view $oWG->LinearizePDF = true; // Time to wait for conversion to complete (in seconds) // Set the amount of seconds before a request will time out $oWG->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->Orientation = 0; // Rendering engine used for the HTML // 0 = Native, 1 = IE $oWG->EngineToUse = 1; // Convert the HTML background (IE engine only) $oWG->PrintBackground = true; // PDF output location and filename $oWG->OutputDirectory = $strPath; $oWG->NewDocumentName = "metadata.pdf"; // HTML to convert // Examples: // http://domain.com/path/file.aspx // c:\folder\file.html $oWG->URL = "http://examples.activepdf.com/samples/doc"; // Perform the HTML to PDF conversion $results = $oWG->ConvertToPDF("127.0.0.1", 52525); if ($results->WebGrabberStatus != 0) { Error("ConvertToPDF", $results, $results->WebGrabberStatus); } // Release Object $oWG = null; // Process Complete echo "Done!"; // Error Handling function Error($method, $oResults, $errorStatus) { echo "Error with " . $method . ": <br/>" . $errorStatus . "<br/>" . $oResults->details; exit(1); } ?>