<?php // Copyright (c) 2021 ActivePDF, Inc. // ActivePDF Toolkit 2018 // Example generated 03/02/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); } // Open the template PDF $intOpenInputFile = $oTK->OpenInputFile($strPath . "PDF.pdf"); if ($intOpenInputFile != 0) { Error("OpenInputFile", $intOpenInputFile); } // Get the reference to the InitialViewInfo object $oIVI = $oTK->GetInitialViewInfo(); // Options for viewer window $oIVI->CenterWindow = true; $oIVI->FullScreen = false; $oIVI->ResizeWindow = true; // 0 = Display the filename // 1 = Display the document title $oIVI->Show = 1; // Show or hide UI elements of the viewer $oIVI->HideMenuBar = true; $oIVI->HideToolBars = true; $oIVI->HideWindowControls = true; // 0 = Page only // 1 = Bookmarks Panel and Page // 2 = Pages Panel and Page // 3 = Attachments Panel and Page // 4 = Layers Panel and Page $oIVI->NavigationTab = 0; // Page settings // 0 = Default // 1 = Actual Size // 2 = Fit Page // 3 = Fit Width // 4 = Fit Height // 5 = Fit Visible // 6 = 25% // 7 = 50% // 8 = 75% // 9 = 100% // See the documentation for values 10-18. $oIVI->Magnification = 150; $oIVI->OpenToPage = 2; // 0 = Default Page Layout // 1 = Single Page Page Layout // 2 = Single Page Continoues Page Layout // 3 = Two-Up (Facing) Page Layout // 4 = Two-Up Continous (Facing) Page Layout // 5 = Two-Up (Cover Page) Page Layout // 6 = Two-Up Continous (Cover Page) Page Layout $oIVI->PageLayout = 1; // Release Object $oIVI = null; // Copy the template (with any changes) to the new file $intCopyForm = $oTK->CopyForm(0, 0); if ($intCopyForm != 1) { Error("CopyForm", $intCopyForm); } // 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; } ?>