<?php // Copyright (c) 2021 ActivePDF, Inc. // ActivePDF WebGrabber 2016 // Example generated 01/18/21 ?> <?php // Instantiate Object $oWG = new COM("APWebGrabber.Object"); // 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; // Save the HTML text into a file before conversion $oWG->HTMLTextToFile = true; // HTML to convert $oWG->CreateFromHTMLText = "<html><body>"; $oWG->CreateFromHTMLText = "Hello World!"; $oWG->CreateFromHTMLText = "</body></html>"; // 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); } ?>