Working with PDF File Metadata
Contents
[
Hide
]
Get PDF File Information
To get file-specific information about a PDF file, first get the ‘docInfo’ object using the Document class getInfo(). Once the ‘docInfo’ object is retrieved, you can get the values of the individual properties.
The following code snippet shows you how to set PDF file information.
// Open document
$document = new Document($inputFile);
// Get document information
$docInfo = $document->getInfo();
// Show document information
$responseData1 = "Author: " . $docInfo->getAuthor() . ", ";
$responseData2 = "Creation Date: " . $docInfo->getCreationDate() . ", ";
$responseData3 = "Keywords: " . $docInfo->getKeywords() . ", ";
$responseData4 = "Modify Date: " . $docInfo->getModDate() . ", ";
$responseData5 = "Subject: " . $docInfo->getSubject() . ", ";
$responseData6 = "Title: " . $docInfo->getTitle() . "";
$document->close();