Repository navigation
Paint SVG gradient stops opaque under PDF/A-1b, and write only the visibility groups the catalog lists (#346, #351) - #386
Merged
jakejackson1 merged 3 commits intoSep 23, 2026
Conversation
…346) An SVG linear or radial gradient with a stop-opacity below 1 faded through a soft mask under PDF/A-1b and PDF/X-1a, which veraPDF rejects under 6.4-1, and without PDFAauto no warning was recorded. The stop opacity now goes through Mpdf::allowedAlpha(), as the other SVG opacities do. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s every group written (#351) The print-only, screen-only and hidden optional content groups were all written, and named in the page resources, as soon as any one was used, while /OCProperties /OCGs listed only the ones used. /OCGs should list every group in the document. Now the groups not used are neither written nor named. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…er PDF/A-1 Without PDFAauto, rgba(255, 0, 0, 1) was reported as an RGB colour with transparency converted without it, though dropping an alpha of 1 changes nothing. Only a colour whose alpha is below 1 is reported now. 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.
Follow-ups to #346 and #351 found by a verification pass over #330.
Changes
SVG gradient stop-opacity under PDF/A-1b and PDF/X-1a (#346). A
<stop>withstop-opacitybelow 1 made a linear or radial gradient fade through a soft mask. veraPDF rejects that under PDF/A-1b (6.4-1). WithoutPDFAautono warning was recorded, so the invalid file was written without complaint. The stop opacity now goes throughMpdf::allowedAlpha()where stops are parsed, as the other SVG opacities do: withPDFAautothe stop is painted opaque, and without it the warning is recorded. PDF/X-1a had the same problem and gets the same fix.Optional content groups the catalog does not list (#351). Using any one of print-only, screen-only or hidden content wrote all three OCG objects and named all three in the page
/Properties./OCProperties /OCGslisted only the ones in use, but it should list every OCG in the document.OptionalContentWriternow writes only the groups in use. The page resources and the catalog both read the object numbers it records, so the bit-to-group mapping lives in one place (OptionalContentWriter::VISIBILITY_GROUPS). This applies to documents that are not PDF/A as well. veraPDF accepted the files both before and after this change, so the test checks the written objects directly.Opaque
rgba()/cmyka()under PDF/A-1. WithoutPDFAauto,rgba(255, 0, 0, 1)was reported as transparency dropped, though dropping an alpha of 1 changes nothing. Only an alpha below 1 is reported now. The PDF/X and CMYK-intent warning for anrgba()converted to CMYK stays, because the colour space does change.The #351 policy of refusing
printonly/screenonlyunder PDF/A-2/3 is unchanged.Not changed here: in the stop parser, an
rgba()/cmyka()stop colour's alpha is read withord($col[4] / 100)(src/Image/Svg.php). That looks wrong but predates this branch.Tests
PDFA1Test: linear and radial gradient stops under PDF/A-1b, PDF/A-2b and PDF/X-1a write a soft mask only under PDF/A-2b. WithoutPDFAauto, PDF/A-1b reports the stop opacity.PdfaConformanceTest: the shared document now includes a linear and a radial gradient with a translucent stop, so veraPDF checks them at 1-B, 2-B/U and 3-B/U.PdfaOptionalContentTest::testEveryGroupWrittenIsListed: every/Type /OCGobject written appears in/OCGsand in the page/Properties, and nothing else does (PDF/A-2b with layers and hidden content, plain print-only, plain print-only plus hidden).ColorSpaceRestrictorTest::testOpaqueAlphaIsNotReported.Each new test failed before its fix.
Verification
PDFAauto. After: both compliant. WithPDFAautooff, the warning is recorded.composer test: 3375 tests, OK (5 skipped, as before).composer test -- --group=snapshot: 85 OK, no fixture changes.composer test -- --group=conformance: 16 OK.composer cs: clean.🤖 Generated with Claude Code