Get XMP Metadata of PDF File

[ ]

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
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfFacades_WorkingDocuments();

// Create PdfXmpMetadata object
PdfXmpMetadata xmpMetaData = new PdfXmpMetadata();

// Bind pdf file to the object
xmpMetaData.BindPdf( dataDir + "input.pdf");

// Get XMP Meta Data properties
Console.WriteLine(": {0}", xmpMetaData[DefaultMetadataProperties.CreateDate].ToString());
Console.WriteLine(": {0}", xmpMetaData[DefaultMetadataProperties.MetadataDate].ToString());
Console.WriteLine(": {0}", xmpMetaData[DefaultMetadataProperties.CreatorTool].ToString());
Console.WriteLine(": {0}", xmpMetaData["customNamespace:UserPropertyName"].ToString());