GroupDocsGists
10/24/2017 - 5:03 PM

Examples-GroupDocs.Metadata-for-Java

Examples-GroupDocs.Metadata-for-Java

// initialize PdfFormat
DocFormat docFormat = new DocFormat(Common.mapSourceFilePath(path));
// get DocMetadata
DocMetadata metadata = docFormat.getDocumentProperties();
// get metadata all metadata keys
String[] metadataKeys = metadata.getKeys();
for(String key: metadataKeys)
{
    // check if metadata value is custom
    if (!metadata.isBuiltIn(key))
    {
        // get metadata value by key
        PropertyValue propertyValue = metadata.readPropertyValue(key);

        // write value to output
        System.out.printf("key: %s, type: %s, value: %s", key, propertyValue.getType(), propertyValue);
    }
}