Skip to content

Add basic support for PDF/A-2 and PDF/A-3 conformance levels#1480

Merged
andreasrosdal merged 3 commits intomasterfrom
copilot/fix-issue-1250
Feb 16, 2026
Merged

Add basic support for PDF/A-2 and PDF/A-3 conformance levels#1480
andreasrosdal merged 3 commits intomasterfrom
copilot/fix-issue-1250

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Description of the new Feature/Bugfix

Adds constants and supporting infrastructure for PDF/A-2 (2a, 2b, 2u) and PDF/A-3 (3a, 3b, 3u) conformance levels, needed for ZUGFeRD/Factur-X electronic invoices.

PdfWriter.java:

  • New constants: PDFA2A, PDFA2B, PDFA2U, PDFA3A, PDFA3B, PDFA3U
  • New methods: isPdfA2(), isPdfA3(), isPdfA()
  • setPDFXConformance() sets PDF version 1.7 for PDF/A-2/3

PdfXConformanceImp.java:

  • Added isPdfA2(), isPdfA3(), isPdfA() helper methods
  • Updated completeInfoDictionary() and completeExtraCatalog() to exclude PDF/A-2/3 from PDF/X-specific processing

XmpWriter.java:

  • Writes correct XMP metadata (pdfaid:part=2|3, pdfaid:conformance=A|B|U) for PDF/A-2/3

Usage:

PdfWriter writer = PdfWriter.getInstance(document, outputStream);
writer.setPDFXConformance(PdfWriter.PDFA3B);  // For ZUGFeRD

Note: CIDSet is intentionally NOT included for PDF/A-2+ (deprecated per spec).

Unit-Tests for the new Feature/Bugfix

  • Unit-Tests added to reproduce the bug
  • Unit-Tests added to the added feature

PdfAConformanceTest.java covers conformance flags, XMP metadata generation, and constant values for all new PDF/A levels.

Compatibilities Issues

None. All changes are additive. Existing PDF/A-1 and PDF/X behavior unchanged.

Your real name

GitHub Copilot

Testing details

Run mvn test -pl openpdf-core -Dtest=PdfAConformanceTest to verify the new functionality.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@andreasrosdal andreasrosdal changed the title [WIP] Fix issue with document merging in OpenPDF PDF/A improved support Feb 16, 2026
Copilot AI and others added 2 commits February 16, 2026 11:32
Co-authored-by: andreasrosdal <259156774+andreasrosdal@users.noreply.github.com>
Co-authored-by: andreasrosdal <259156774+andreasrosdal@users.noreply.github.com>
@sonarqubecloud
Copy link

Copilot AI changed the title PDF/A improved support Add basic support for PDF/A-2 and PDF/A-3 conformance levels Feb 16, 2026
Copilot AI requested a review from andreasrosdal February 16, 2026 11:36
@andreasrosdal andreasrosdal marked this pull request as ready for review February 16, 2026 11:36
@andreasrosdal andreasrosdal merged commit 00c32e7 into master Feb 16, 2026
12 of 13 checks passed
@andreasrosdal andreasrosdal deleted the copilot/fix-issue-1250 branch February 16, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants