Repository navigation
Support PDF/A extension schemas and Factur-X / ZUGFeRD XMP metadata - #1808
Merged
andreasrosdalw merged 1 commit intoDec 2, 2026
Merged
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 35 |
| Duplication | 1 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
PDF/A allows XMP properties of a namespace that is not predefined only if the metadata describes the namespace in an extension schema (pdfaExtension:schemas). ZUGFeRD and Factur-X invoices are PDF/A-3 documents with such properties (fx:DocumentFileName, DocumentType, Version and ConformanceLevel). - PdfAExtensionSchema writes the extension schema container, with records for the schema and property descriptions. - FacturXSchema has the fx properties and their extension schema, for Factur-X and ZUGFeRD 2.1 and later, and for ZUGFeRD 2.0. - PdfWriter.addXmpSchema(XmpSchema) and addXmpSchema(XmpSchema, PdfAExtensionSchema.Schema) add schemas to the metadata that createXmpMetadata() creates. A Factur-X style PDF/A-3b invoice, with the invoice XML as an associated file, passes veraPDF. Co-Authored-By: Claude Opus 5.5 <[email protected]>
andreasrosdal
force-pushed
the
pdfa3-xmp-extension-schemas
branch
from
December 2, 2026 21:39
fc46476 to
f7f411a
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description of the new Feature/Bugfix
OpenPDF already writes
pdfaid:part=3forPDFA3A/B/U. What was missing for real PDF/A-3 documents is custom XMP metadata with a PDF/A extension schema. PDF/A (ISO 19005-2/-3 §6.6.2.3) allows XMP properties of a namespace that is not predefined only if the metadata also describes that namespace inpdfaExtension:schemas. Otherwise veraPDF rejects the file.The main use case is ZUGFeRD / Factur-X electronic invoices. They are PDF/A-3 documents with the invoice XML as an associated file (#1806) and with the
fx:propertiesDocumentFileName,DocumentType,VersionandConformanceLevelin the XMP metadata.API
PdfAExtensionSchema(anXmpSchema) writes the extension schema container. TheSchemaandPropertyrecords describe a namespace and its properties, and a namespace is described only once.FacturXSchemahas thefx:properties (INVOICEand version1.0by default), constants for the profiles (MINIMUM…XRECHNUNG) and file names, andgetPdfAExtensionSchema(). It supports the Factur-X / ZUGFeRD 2.1+ namespace and, with a constructor argument, the ZUGFeRD 2.0 namespace.PdfWriter.addXmpSchema(XmpSchema)andaddXmpSchema(XmpSchema, PdfAExtensionSchema.Schema)add schemas to the metadata thatcreateXmpMetadata()generates. Before, custom properties meant writing the whole XMP packet by hand withsetXmpMetadata(byte[]).All of this is new API. Documents that do not call
addXmpSchemado not change.Unit-Tests for the new Feature/Bugfix
New
PdfAExtensionSchemaTest:FacturXSchemadefaults, setters and the ZUGFeRD 2.0 namespace.factur-x.xmlas an associated file with/AFRelationship /Alternative, the MIME type and/ModDate, and thefx:properties with their extension schema. veraPDF reports no violations../mvnw -B installpasses locally on Java 25 for all modules, andcheckstyle:checkreports nothing on the new files. The changelog for 4.0.1 is updated.Not in this PR: generating or checking the invoice XML itself (CII/UBL), which is outside the scope of a PDF library.