Repository navigation
The colour of the text, and the limit it reports rather than hides - #109
Merged
Merged
Conversation
text-color is claimed, through `pdfops textcolour` in go-pdfkit/ops v0.16.0
over go-pdfkit/reader v0.8.0.
It needed a new fact in reader first: an Operation now says WHICH BYTES of the
stream it is, so a content stream can be edited in place. The alternative was
re-serialising every operand, including an inline image's still-encoded bytes,
where a formatter that is merely lossless-for-objects can change what the image
means. A byte search cannot stand in for it: "BT" appears inside strings and
inside an inline image's data, and in the test's fixture a search finds index 1
— in the middle of somebody's text — where the scan reports 20.
⛔ The claim is honest because the tool reports its own limit. Text drawn
through a Form XObject is not recoloured, since an XObject is SHARED and
recolouring one would change pages the caller did not name — so the verb COUNTS
what it could not reach and says so. The failure that would have made this
dishonest is a document coming back unchanged while looking converted, and that
is precisely the one it refuses to be silent about.
Two defects were found building it, neither by a report:
- setting a colour before each text object is not enough, because a text
object that sets its OWN colour overrides it. A page whose paragraphs said
"1 0 0 rg" came out unchanged while the tool reported success.
- a page both recoloured and watermarked came back in its original colours:
`decorate` rebuilt Contents from the source's parts and threw the
rewritten stream away, with nothing failing.
Pasted from the tool's own output:
covered 82
not covered 32
parity 71.9% (82/114), every claim verified
Measured 2026-10-11 against BentoPDF 3a5f146 (v2.8.8, 114 tools), pdfops and
ops at v0.16.0, reader v0.8.0, ooxml v0.2.0, opc v0.1.0, odf 3d1deee
(= v0.7.0), convert 45fbb5d, render 3bb5dcf, app 1feda5d, rtf 6bc4897,
markdown eafebfd, data 128b6c7.
Co-Authored-By: Claude Opus 5 <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.
text-coloris claimed, throughpdfops textcolouringo-pdfkit/opsv0.16.0over
go-pdfkit/readerv0.8.0.It needed a new fact in
readerfirstAn
Operationnow says which bytes of the stream it is, so a contentstream can be edited in place. The alternative was re-serialising every
operand, including an inline image's still-encoded bytes, where a formatter
that is merely lossless-for-objects can change what the image means.
A byte search cannot stand in for it. In the test's fixture:
⛔ The claim is honest because the tool reports its own limit
Text drawn through a Form XObject is not recoloured: an XObject is
shared, so recolouring one would change pages the caller did not name. So
the verb counts what it could not reach and says so:
The failure that would have made this claim dishonest is a document coming
back unchanged while looking converted — and that is precisely the one it
refuses to be silent about.
Two defects found building it, neither by a report
that sets its own colour overrides it, so a page whose paragraphs said
1 0 0 rgcame out unchanged while the tool reported success. Every colouroperator inside a text object is blanked now;
colours.
decoraterebuiltContentsfrom the source's parts and threwthe rewritten stream away, with nothing failing. The mutation restoring that
behaviour is caught.
Measured 2026-10-11 against BentoPDF
3a5f146(v2.8.8, 114 tools),pdfopsand
opsat v0.16.0,readerv0.8.0,ooxmlv0.2.0,opcv0.1.0,odf3d1deee(= v0.7.0),convert45fbb5d,render3bb5dcf,app1feda5d,rtf6bc4897,markdowneafebfd,data128b6c7.🤖 Generated with Claude Code