<?php // Copyright (c) 2021 ActivePDF, Inc. // ActivePDF Toolkit 2018 // Example generated 03/01/21 ?> <?php // Get current path $strPath = dirname(__FILE__) . "\\"; // Instantiate Object $oTK = new COM("APToolkit.Object"); // Create the new PDF file $intOpenOutputFile = $oTK->OpenOutputFile($strPath . "new.pdf"); if ($intOpenOutputFile != 0) { Error("OpenOutputFile", $intOpenOutputFile); } // MergeFile is the equivalent of OpenInputFile and CopyForm // Extract pages 3-4 from the PDF $intMergeFile = $oTK->MergeFile($strPath . "10pages.pdf", 3, 4); if ($intMergeFile != 1) { Error("MergeFile", $intMergeFile); } // Close the new file to complete PDF creation $oTK->CloseOutputFile(); // Release Object $oTK = null; // Process Complete echo "Done!"; // Error Handling function Error($method, $outputCode) { echo "Error in " . $method . ": " . $outputCode; } ?>