fix(pdf): apply the /ExtGState stroke parameters, not just the alphas - #810
Merged
Conversation
`gs` folded `ca`/`CA`, `/BM` and `/SMask` into the graphics state and dropped the rest of ISO 32000-1 Table 58. `/LW`, `/LC`, `/LJ`, `/ML` and `/D` are the `w`/`J`/`j`/`M`/`d` operands as state-dictionary entries, and a producer is free to set them only there — Canva does, so every stroke on a Canva-designed pdf drew at the initial width of 1 instead of the width the file asked for. Found on the three pdf files this also adds to the private corpus: a Canva one-pager whose image frames lost their 3pt border, a Stripe invoice and a recipe printed by Chrome on Android. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PcgGX9T64rQzbvuSRy36B2
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.
🤖 Generated with Claude Code
Three more pdf files for the private corpus, and the bug the first of them turned up.
The bug
gs(ISO 32000-1 8.4.5) foldedca/CA,/BMand/SMaskinto the graphicsstate and dropped the rest of Table 58.
/LW,/LC,/LJ,/MLand/Darejust the
w/J/j/M/doperands as state-dictionary entries, and aproducer is free to set them only there. Canva does: every stroke on a
Canva-designed pdf drew at the initial line width of 1 instead of the width the
file asked for.
On the new
MOSAIK_Kurzfassungone-pager that is a/LW 3.2641706on the framearound each image — a 3pt border that came out a barely visible hairline.
Verified against both ghostscript and CoreGraphics, which agree with each other
and now with us:
The files
pdf/Invoice-E5AEACA0-2816.pdf/URIlinkpdf/MOSAIK_Kurzfassung_1755173097.pdfpdf/Spanische Tortilla de Patatas - Gaumenfreundin Foodblog.pdfA second copy of the invoice was in the same download with identical page
content, so only one is added.
Each was checked page by page against a ghostscript raster (side by side, and
ranked by blurred pixel diff) and its text against
-sDEVICE=txtwrite; allthree extract their full text and render faithfully.
Reference output
Across the whole corpus the fix moves exactly one existing file:
order-EK52VKL0.pdf's page frame carries/ML 4, so itsstroke-miterlimitdrops from the initial 10 to 4. No pixel changes — a rectangle's 90° joins
never reach either limit.
odr-publicis untouched.opendocument-app/OpenDocument.test-private@d0bedc8
opendocument-app/OpenDocument.test-private.output@2f5964b