Skip to content

Keep an annotation's subject under PDF/A-2 and PDF/A-3 (#350) - #357

Merged
jakejackson1 merged 1 commit into
feature/pdfa-2-conformancefrom
fix/350-annotation-subject-pdfa-2
Sep 22, 2026
Merged

jakejackson1 merged 1 commit into
feature/pdfa-2-conformancefrom
fix/350-annotation-subject-pdfa-2

Conversation

@jakejackson1

Copy link
Copy Markdown
Member

Stacks on #330.

Change

Writer\MetadataWriter::writeAnnotations() left out /Subj whenever PDFA or PDFX was set, because /Subj arrived in PDF 1.5. That is right for PDF/X-1a (PDF 1.3) and PDF/A-1 (PDF 1.4), but PDF/A-2 and PDF/A-3 are based on PDF 1.7. The condition now omits /Subj only under PDF/X or when Mpdf::pdfaConformance() names part 1. Only the /Subj condition and its comment change.

Tests

  • PDFA2Test::testAnnotationSubject: an annotation with a subject keeps /Subj in a plain document and under 2-B and 3-B, and loses it under 1-B and PDF/X-1a. Without the fix, the 2-B and 3-B cases fail.
  • The document in PdfaConformanceTest::testDocumentConforms now gives a subject to one of its annotations, so veraPDF checks that 2-B/2-U/3-B/3-U with RGB and CMYK output intents still conform.

Gates

  • composer test: OK (3227 tests, 5 skipped, the same as the base)
  • vendor/bin/phpunit --group=conformance --fail-on-skipped: OK (10 tests)
  • composer cs: clean
  • phpstan --no-progress --memory-limit=2G: no errors
  • php5.6 -l on the changed files: no syntax errors

Fixes #350

🤖 Generated with Claude Code

/Subj was left out under any PDF/A or PDF/X setting because it is a PDF 1.5
key. PDF/A-2 and PDF/A-3 are based on PDF 1.7, so it is now left out only
under PDF/X-1a and PDF/A-1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jakejackson1 jakejackson1 added the bug Something isn't working label Sep 22, 2026
@jakejackson1
jakejackson1 merged commit 2c3e82f into feature/pdfa-2-conformance Sep 22, 2026
29 checks passed
@jakejackson1
jakejackson1 deleted the fix/350-annotation-subject-pdfa-2 branch September 30, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant