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");
// Toolkit can directly encrypt an existing PDF file
// !NOTE: Evaluation keys will append 'DEMO' to the start of the password
// Remove the encryption from the specified PDF
$intDecryptPDF = $oTK->DecryptPDF($strPath . "Encrypted.pdf", $strPath . "Decrypted.pdf", "UserPassword", "OwnerPassword");
if ($intDecryptPDF != 0) {
Error("DecryptPDF", $intDecryptPDF);
}
// Release Object
$oTK = null;
// Process Complete
echo "Done!";
// Error Handling
function Error($method, $outputCode) {
echo "Error in " . $method . ": " . $outputCode;
}
?>