<?php // Copyright (c) 2021 ActivePDF, Inc. // ActivePDF Toolkit 2018 // Example generated 03/06/21 ?> <?php // Get current path $strPath = dirname(__FILE__) . "\\"; // Instantiate Object $oTK = new COM("APToolkit.Object"); // Open the PDF to read from $intOpenInputFile = $oTK->OpenInputFile($strPath . "XMPproperties.pdf"); if ($intOpenInputFile != 0) { Error("OpenInputFile", $intOpenInputFile); } // Get the reference to the XMP object $oXMP = $oTK->GetXMPManager(); // Get a document property $strPropertyValue = $oXMP->GetDocumentProperty(2); echo $strPropertyValue; // Get a custom property $strPropertyValue = $oXMP->GetCustomProperty("example"); echo $strPropertyValue; // Set the namespace for the user property $oXMP->SetNamespace("dc", "http://purl.org/dc/elements/1.1/"); // Get a user property $strPropertyValue = $oXMP->GetUserProperty("contributor"); echo $strPropertyValue; // Release Object $oXMP = null; // Close the input file $oTK->CloseInputFile(); // Release Object $oTK = null; // Process Complete echo "Done!"; // Error Handling function Error($method, $outputCode) { echo "Error in " . $method . ": " . $outputCode; } ?>