<?php // Copyright (c) 2021 ActivePDF, Inc. // ActivePDF Server 2013 // Example generated 01/28/21 ?> <?php // Get current path $strPath = dirname(__FILE__) . "\\"; // Instantiate Object $oSVR = new COM("APServer.Object"); // Path and filename of output $oSVR->OutputDirectory = $strPath; $oSVR->NewDocumentName = "Test.pdf"; // Start the print job $results = $oSVR->BeginPrintToPDF(); if ($results->ServerStatus != 0) { Error("BeginPrintToPDF", $results, $results->ServerStatus); } // Here is where you can print to activePDF Server to create // a PDF from any print job, set your application to print to // a static activePDF Server printer or call oSVR.NewPrinterName // to dynamically create a new printer on the fly // This example simply calls oSVR.TestPrintToPDF for testing purposes $results = $oSVR->TestPrintToPDF("Hello World!"); if ($results->ServerStatus != 0) { Error("TestPrintToPDF", $results, $results->ServerStatus); } // Wait(seconds) for job to complete $results = $oSVR->EndPrintToPDF(30); if ($results->ServerStatus != 0) { Error("EndPrintToPDF", $results, $results->ServerStatus); } // Release Object $oSVR = null; // Process Complete echo "Done!"; // Error Handling function Error($method, $oResults, $errorStatus) { echo "Error with " . $method . ": <br/>" . $errorStatus . "<br/>" . $oResults->details; exit(1); } ?>