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.
importcom.groupdocs.metadata.Metadata;importcom.groupdocs.metadata.core.MetadataProperty;importcom.groupdocs.metadata.search.ContainsTagSpecification;importcom.groupdocs.metadata.tagging.Tags;try(Metadatametadata=newMetadata("contract.docx")){// Every property tagged as identifying the person who created the document
Iterable<MetadataProperty>properties=metadata.findProperties(newContainsTagSpecification(Tags.getPerson().getCreator()));for(MetadataPropertyproperty:properties){System.out.println(property.getName()+" = "+property.getValue());}}
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.