Repository navigation
Write a PDF/A-3 annotation's file as an associated file, so it passes veraPDF - #358
Merged
jakejackson1 merged 2 commits intoSep 23, 2026
Conversation
jakejackson1
force-pushed
the
feature/pdfa-2-conformance
branch
from
September 23, 2026 01:30
8e388e9 to
c93b66a
Compare
… veraPDF (#347) Under PDF/A-3 the file of an <annotation file="..."> now goes through the same writer as SetAssociatedFiles(): an indirect file specification with /AFRelationship /Unspecified, named by the annotation's own /AF, and an embedded file stream with a MIME /Subtype of application/octet-stream. numberAnnotations() gives the file specification its own object number, ahead of the stream's. PDF/A-1, PDF/A-2 and non-PDF/A output are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
jakejackson1
force-pushed
the
fix/347-pdfa-3-annotation-attachments
branch
from
September 23, 2026 01:34
0087334 to
f156ea9
Compare
Member
Author
|
Rebased onto the rebased #330, which now includes #360's explicit annotation IDs and
Gates:
|
…e whole path A file annotation's name kept everything after the last forward slash, so on Windows the drive and directories stayed in the name (D:\a\x.php became Dax.php). Strip up to the last slash or backslash. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Stacks on #330.
What changed
Under PDF/A-3, veraPDF failed an
<annotation file="…">attachment on rules 6.8-1, 6.8-3 and 6.8-4. The embedded file had no MIME type, the file spec had no/AFRelationship, and nothing associated the file spec with the document.MetadataWriternow writes these attachments through the same code asSetAssociatedFiles():writeAssociatedFiles()out into a privatewriteAssociatedFile(array $file), which returns the file spec's object number.writeAssociatedFiles()output is byte-identical./FS n 0 R /AF [n 0 R], then passes the file towriteAssociatedFile()withAFRelationshipUnspecifiedand MIMEapplication/octet-stream. The file spec is now its own object, so each file annotation writes one more object.annotationObjectCount()counts it, which keeps PageWriter's predicted numbers and the/APreferences right.The changes inside
writeAnnotations()are two small branches, so the renumbering in #352 should rebase over them without trouble.Tests
PdfaConformanceTest::testAttachmentsConformnow runs at 2-B, 2-U, 3-B and 3-U. It also attaches a PHP file. It checks how many files each version embeds (PDF/A-2: 1, PDF/A-3: 3) and runs veraPDF on the result.PDFA2Test::testPdfa3AssociatesAnnotationFilechecks that the annotation's/FSand/AFpoint to the same file spec, and that the file spec carries/AFRelationship. It also checks that the stream carries the MIME/Subtypeand that/APstill points to the appearance form.PDFA2Test::testAnnotsListOnlyAnnotationsgains a PDF/A-3 case, which covers the object count.Gates
composer test: OK (3226 tests). The 5 skips are the existing generator-table tests, which need unpacked Unicode/HarfBuzz data.vendor/bin/phpunit --group=conformance --fail-on-skipped: OK (12 tests)composer cs: cleanphp -lunder PHP 5.6: clean on every changed fileLeft out
application/octet-stream. It is not guessed from the file./EmbeddedFilesname tree, because PDF/A-3 does not require it.Fixes #347
🤖 Generated with Claude Code