获取现有PDF文件的XMP元数据 - facades
Contents
[
Hide
]
为了从PDF文件获取XMP元数据,您需要创建PdfXmpMetadata对象并使用bindPdf(..)方法绑定PDF文件。您可以传递特定的XMP元数据属性给PdfXmpMetadata对象以获取它们的值。
以下代码片段展示了如何从PDF文件获取XMP元数据。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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")); |