Skip to main content

Module metadata

Module metadata 

Source
Expand description

Document metadata (#679): what a file says about itself — an EPUB’s Dublin Core, an Office package’s core and application properties, an ODF meta.xml, a photo’s EXIF, an audio file’s tags, a PDF’s Info dictionary — read into DocumentMetadata on the document, and written out on request as a metadata object in the JSON or as YAML front matter at the top of the Markdown (MetadataOutput). Nothing is written by default, so every export stays byte for byte what it was.

The common fields are the ones every source has a name for (a title, authors, a subject, keywords, dates, the tool that wrote the file); what only one kind of file carries keeps its own names in a section of its own: exif (the tag names as exiftool prints them: DateTimeOriginal, Make, Model, …), audio (album, artist, genre, duration, …), properties (the rest of an Office package’s properties: revision, category, pages, …) and a decoded gps position.

Under the PII pass (redact_pii) the author fields are masked as persons and the position is dropped; see crate::redact.

Structs§

DocumentMetadata
The metadata of a document. Every field is optional; a document whose file carries nothing has the default, is_empty. Dates are kept as the file wrote them, normalized to ISO 8601 where the format defines one (Office and ODF dcterms dates, a PDF’s D: dates); EXIF’s own YYYY:MM:DD HH:MM:SS stays as it is in exif and is turned into ISO 8601 for date.
GpsPosition
A decoded GPS position (EXIF GPSLatitude / GPSLongitude / GPSAltitude with their reference hemispheres applied): signed decimal degrees, metres above sea level.

Enums§

MetadataOutput
Where the metadata goes in the exports. None (the default) keeps it to the in-memory document; Json adds a metadata object to the docling JSON (after origin); Frontmatter opens the Markdown with a YAML front matter block as well.