XMP Metadata
XMP Metadata
XMP (Extensible Metadata Platform) is an XML-based metadata format embedded in PDF documents to describe title, author, creation date, modification date, and custom properties (ISO 32000-1:2008, §14.3).
XmpMetadata
XmpMetadata provides access to the XMP metadata stream embedded in a PDF document.
It is accessible via the document’s metadata dictionary:
try (Document doc = new Document("input.pdf")) {
XmpMetadata xmp = doc.getMetadata();
// Access standard XMP properties
}Reading Metadata
Standard XMP properties such as creator, creation date, and modification date are
accessible through the XmpMetadata API as typed property values.
DocumentInfo
The DocumentInfo class provides access to the classic PDF document information
dictionary (Title, Author, Subject, Keywords, Creator, Producer, CreationDate,
ModDate). Both DocumentInfo and XmpMetadata exist independently and may contain
different values.
Use Document.getInfo() to obtain the DocumentInfo instance:
try (Document doc = new Document("input.pdf")) {
DocumentInfo info = doc.getInfo();
String title = info.getTitle();
String author = info.getAuthor();
}