Skip to content

readMetadata returns empty metadata when the trailer has no /Info, ignoring XMP and /Lang #1694

Open

Description

@Mearman

readMetadata in packages/pdf-codec/src/read.ts returns {} as soon as the trailer has no /Info dictionary, before it looks at the catalog's /Lang or the XMP packet. A PDF with no /Info but with an XMP packet (the usual PDF/A shape) therefore reports empty metadata, even though the comment a few lines further down says the fields "live only in XMP" in such files, and the surfaces docs and README say metadata "still reads the XMP packet".

Repro: write a PDF whose trailer has no /Info, whose catalog has /Metadata pointing at an XMP stream carrying dc:title and dc:creator, and a /Lang entry. readPdf returns metadata: {} where the title, author and language are all present in the file.

Found while reviewing #1693; not caused by it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions