Skip to content

feat: add embeds metadata#1521

Merged
gulien merged 1 commit intogotenberg:mainfrom
Jean-Beru:feat/embeds-metadata
Apr 16, 2026
Merged

feat: add embeds metadata#1521
gulien merged 1 commit intogotenberg:mainfrom
Jean-Beru:feat/embeds-metadata

Conversation

@Jean-Beru
Copy link
Copy Markdown
Contributor

@Jean-Beru Jean-Beru commented Apr 14, 2026

Summary

Adds a new embedsMetadata form field across Chromium, LibreOffice, and PDF Engines routes that writes PDF/A embedded-file metadata (Subtype, AFRelationship, and the document-level /AF array) on attached files. A new EmbedFilesMetadata method is added to the PdfEngine interface and fully implemented in the QPDF engine via JSON manipulation.

Why

This is required for Factur-X / ZUGFeRD compliance. The Factur-X specification mandates that the XML invoice embedded in the PDF carries a Subtype, an AFRelationship (e.g. Alternative, Source), and that every associated file is referenced from the /AF array in the Document Catalog. Without these, PDFs produced by Gotenberg fail validation at https://services.fnfe-mpe.org/ and cannot be used as legal electronic invoices in jurisdictions that require Factur-X (France, Germany, and the broader EU e-invoicing rollout).

Factur-X validation

image

Likely fixes #1485.

@gulien gulien added enhancement New feature or request pdf-engines labels Apr 14, 2026
@Jean-Beru
Copy link
Copy Markdown
Contributor Author

FYI, this PR focuses on Factur-X compliance. Other metadata could be added later. Ex:

  • RF (Related Files): A dictionary (PDF 1.3+) that links to related files arrays, allowing a PDF to reference multiple files associated with a primary embedded file.
  • V (Volatile): A boolean flag (PDF 1.2) indicating if the file changes frequently; if true, applications should not cache a copy of the file.

@gulien gulien merged commit 3187980 into gotenberg:main Apr 16, 2026
16 checks passed
@gulien
Copy link
Copy Markdown
Collaborator

gulien commented Apr 16, 2026

Thanks!

@gulien
Copy link
Copy Markdown
Collaborator

gulien commented Apr 16, 2026

@Jean-Beru could you update the documentation from gotenberg.dev too? 😄

Jean-Beru added a commit to Jean-Beru/gotenberg.dev that referenced this pull request Apr 17, 2026
Covers the changes from gotenberg/gotenberg#1521:
- new embedsMetadata form field on Chromium, LibreOffice and PDF Engines routes
- new /forms/pdfengines/embed route
- new --pdfengines-embed-metadata-engines flag (default qpdf)
Jean-Beru added a commit to Jean-Beru/gotenberg.dev that referenced this pull request Apr 17, 2026
Covers the changes from gotenberg/gotenberg#1521:
- new embedsMetadata form field on the shared attachments PDF engines partial and on the attachments route
- updated --pdfengines-embed-engines default to qpdf,pdfcpu
- new --pdfengines-embed-metadata-engines flag (default qpdf)
Jean-Beru added a commit to Jean-Beru/gotenberg.dev that referenced this pull request Apr 17, 2026
Covers the changes from gotenberg/gotenberg#1521:
- new embedsMetadata form field on the shared attachments PDF engines partial and on the attachments route
- updated --pdfengines-embed-engines default to qpdf,pdfcpu
- new --pdfengines-embed-metadata-engines flag (default qpdf)
Jean-Beru added a commit to Jean-Beru/gotenberg.dev that referenced this pull request Apr 17, 2026
Covers the changes from gotenberg/gotenberg#1521:
- new embedsMetadata form field on the shared attachments PDF engines partial and on the attachments route
- updated --pdfengines-embed-engines default to qpdf,pdfcpu
- new --pdfengines-embed-metadata-engines flag (default qpdf)
Jean-Beru added a commit to Jean-Beru/gotenberg.dev that referenced this pull request Apr 17, 2026
Covers the changes from gotenberg/gotenberg#1521:
- new embedsMetadata form field on the shared attachments PDF engines partial and on the attachments route
- updated --pdfengines-embed-engines default to qpdf,pdfcpu
- new --pdfengines-embed-metadata-engines flag (default qpdf)
@Jean-Beru
Copy link
Copy Markdown
Contributor Author

@Jean-Beru could you update the documentation from gotenberg.dev too? 😄

For sure 😎
=> gotenberg/gotenberg.dev#43

Jean-Beru added a commit to Jean-Beru/gotenberg.dev that referenced this pull request Apr 17, 2026
Covers the changes from gotenberg/gotenberg#1521:
- new embedsMetadata form field on the shared attachments PDF engines partial and on the attachments route
- updated --pdfengines-embed-engines default to qpdf,pdfcpu
- new --pdfengines-embed-metadata-engines flag (default qpdf)

Assisted-by: Claude:claude-opus-4-7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pdf-engines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed files (pdfcpu) after PDF/A conversion breaks PDF/A-3 compliance

2 participants