Get XMP Metadata of an existing PDF File - facades

Contents
[ ]

In order to get XMP metadata from a PDF file, you need to create PdfXmpMetadata object and bind the PDF file using bindPdf(..) method. You can pass specific XMP metadata properties to the PdfXmpMetadata object to get their values.

The following code snippet shows you how to get XMP metadata from a PDF file.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
// create PdfXmpMetadata object
PdfXmpMetadata xmpMetaData = new PdfXmpMetadata();
// bind PDF file to the object
xmpMetaData.bindPdf("TextAnnotation_output.pdf");
// get XMP Meta Data properties
System.out.println("Creation Date : " + xmpMetaData.getByDefaultMetadataProperties(DefaultMetadataProperties.CreateDate));
System.out.println("MetaData Date : " + xmpMetaData.getByDefaultMetadataProperties(DefaultMetadataProperties.MetadataDate));
System.out.println("Creator Tool : " + xmpMetaData.getByDefaultMetadataProperties(DefaultMetadataProperties.CreatorTool));
System.out.println("User Property Name : " + xmpMetaData.getXmpMetadata("customNamespace:UserPropertyName"));