Read and edit metadata with GroupDocs.Metadata
Leave feedback
On this page
GroupDocs.Metadata reads and edits the metadata inside a document — authors, timestamps, EXIF and XMP tags, ID3 audio tags — without touching its visible content. Stripping metadata before a document leaves your organisation is the most common reason to reach for it.
Each example below is ready to copy into a project once you have installed the package.
Read document information
getDocumentInfo gives you the basics without loading the whole metadata tree.
Properties are searched with a specification rather than by name, because the same idea is spelled differently in every format. Tags describe what a property means, so Tags.getPerson().getCreator() finds the author whether the file calls it Author, Creator or dc:creator.
import{Metadata}from'@groupdocs/groupdocs.total';importjavafrom'java';constContainsTagSpecification=java.import('com.groupdocs.metadata.search.ContainsTagSpecification');constTags=java.import('com.groupdocs.metadata.tagging.Tags');constmetadata=newMetadata('contract.docx');// Every property tagged as identifying the person who created the document
constproperties=metadata.findProperties(newContainsTagSpecification(Tags.getPerson().getCreator()));for(leti=0;i<properties.getCount();i++){constproperty=properties.get_Item(i);console.log(property.getName()+' = '+property.getValue());}metadata.close();
contract.docx is the sample file used in this example. Click here to download it.
Author = Dana Whitfield
dc:creator = Dana Whitfield
GroupDocs.Metadata also adds and updates properties, removes only the properties matching a specification, and works with format-specific standards — EXIF, XMP and IPTC in images, ID3 and APE in audio, and the built-in and custom property sets of Office documents.