Repository navigation
Validate more PDF/A features with veraPDF and fix what it found - #1814
Merged
Merged
Conversation
New veraPDF tests cover the accessible levels 1a, 2a and 3a, bookmarks, a text annotation, form fields, spot colours, shadings, GIF, PNG and TIFF images, fonts with several encodings, pages of different sizes with page labels, and an attached file. Fixes for what the tests found: - Annotations in PDF/A-2 and PDF/A-3 get the F key with the print flag. - A TrueType font with an encoding other than WinAnsi or MacRoman has the base encoding WinAnsiEncoding, as PDF/A-2 and PDF/A-3 require. - PDF/A-1 rejects such a font, as it does not allow Differences. - PDF/A rejects document-level JavaScript. - RadioCheckField keeps a font that is set after setCheckType, so a check box can use an embedded font instead of ZapfDingbats. - FontSubsetTest no longer sets an exhausted SecureRandom on the cached Liberation font that other tests use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # changelogs/4.0.0.md
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 29 |
| Duplication | 4 |
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.
|
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
Adds
VeraPdfFeatureConformanceTest, which validates with veraPDF PDF/A documents that use features the existing veraPDF tests did not cover:AFRelationshipThe tests found these problems in OpenPDF, which this PR fixes:
Fkey (veraPDF rule 6.3.2-1).PdfAnnotationset the print flag only for PDF/A-1. It now sets it for every PDF/A part.Encodingdictionary had aDifferencesarray but noBaseEncoding. It now has/BaseEncoding /WinAnsiEncoding. Every code the font uses is listed inDifferences, so the text renders the same.Differencesat all for such a font (rule 6.3.7-1). OpenPDF wrote a non-compliant file.PdfWriternow throws aPdfXConformanceExceptionthat says to useBaseFont.IDENTITY_H.PdfWriter.addJavaScriptnow throws aPdfXConformanceExceptionin a PDF/A document.RadioCheckField.getFieldcalledsetCheckTypeagain, which reset the font to ZapfDingbats (not embedded) even when the caller had set an embedded font. It now only sets the caption, so a font set aftersetCheckTypeis kept.FontSubsetTestset an exhaustedFixedSecureRandomon the cached Liberation Identity-H font, so later tests that took that font from the cache failed with anArrayIndexOutOfBoundsException. It now uses an uncached font.Not fixed here: OpenPDF does not draw an appearance for a text annotation, and PDF/A requires one. The test supplies the appearance, as a caller has to.
Related Issue: none
Unit-Tests for the new Feature/Bugfix
Compatibilities Issues
No method signatures change. Behaviour changes, listed under Upgrade Notes in
changelogs/4.0.0.md:PdfWriter.addJavaScriptthrows aPdfXConformanceExceptionin a PDF/A document.PdfXConformanceException.RadioCheckFieldkeeps a font set aftersetCheckType. Before, it always went back to ZapfDingbats.Differencesarray also get/BaseEncoding /WinAnsiEncoding, also outside PDF/A.Your real name
Andreas Røsdal
Testing details
./mvnw -pl openpdf-core test -Dtest=VeraPdfFeatureConformanceTest(35 tests). The full build./mvnw installand./mvnw checkstyle:checkpass locally on Java 25.🤖 Generated with Claude Code