Example code is for an older version of Toolkit, newer code is available.
<?php
// Copyright (c) 2021 ActivePDF, Inc.
// ActivePDF Toolkit 2016
// Example generated 03/03/21
?>
<?php
// Get current path
$strPath = dirname(__FILE__) . "\\";
// Instantiate Object
$oTK = new COM("APToolkit.Object");
// Check to see if the PDF is already linearized
$lngLinearized = $oTK->IsFileLinearized($strPath . "PDF.pdf");
// If not, then linearize the file
if ($lngLinearized == false) {
$intLinearizeFile = $oTK->LinearizeFile($strPath . "PDF.pdf", $strPath . "new.pdf", "");
if ($intLinearizeFile < 0) {
Error("LinearizeFile", $intLinearizeFile);
}
}
// Release Object
$oTK = null;
// Process Complete
echo "Done!";
// Error Handling
function Error($method, $outputCode) {
echo "Error in " . $method . ": " . $outputCode;
}
?>