Get XMP Metadata of PDF File

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-.NET
// 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());

Console.ReadLine();