Remove Metadata from PDF in PHP
Contents
[
Hide
]
Aspose.PDF - Remove Metadata
To remove Metadata from Pdf document using Aspose.PDF Java for PHP, simply invoke RemoveMetadata class.
PHP Code
# Open a pdf document.
$doc = new Document($dataDir . "input1.pdf");
if (preg_match('/pdfaid:part/',$doc->getMetadata())) {
$doc->getMetadata()->removeItem("pdfaid:part");
}
if (preg_match('/dc:format/',$doc->getMetadata())) {
$doc->getMetadata()->removeItem("dc:format");
}
# save update document with new information
$doc->save($dataDir . "Remove_Metadata.pdf");
print "Removed metadata successfully, please check output file." . PHP_EOL;
Download Running Code
Download Remove Metadata (Aspose.PDF) from any of the below mentioned social coding sites: