Repository navigation
Replacement text: BeginActualText / EndMarkedContent - #51
Merged
Merged
Conversation
A /Span marked-content sequence with /ActualText gives the text that extraction, copying and search use instead of the glyphs drawn inside it. An empty one hides decorations from the text: go-slides draws code callout discs and line numbers that pdftotext would otherwise interleave into the code lines. Checked with Poppler's pdftotext 26.10 (a test runs it when installed): the glyphs inside an empty ActualText are drawn and not extracted. Spans nest; a stray End writes nothing; spans left open are closed when the page is written, so a stream is never unbalanced. Co-Authored-By: Claude Opus 5.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.
Page.BeginActualText(s)…Page.EndMarkedContent()write a/Span <</ActualText …>> BDC … EMCaround what is drawn. Text extraction, copying and search then use the replacement text instead of the glyphs.The use case is go-slides' code callouts and line numbers in its vector PDF. A disc's digit and the gutter's numbers are drawn as text, and
pdftotextinterleaves them into the code lines (func main() { 1). With an empty ActualText they are drawn and not extracted.pdftotext26.10.TestActualTextHiddenFromExtractionruns it when it is installed and skips otherwise; locally, only the text outside the span is extracted.EndMarkedContentwrites nothing, and spans left open are closed when the page is written, so the stream stays balanced.pdfTextStringencoding: ASCII literal, or<FEFF…>UTF-16BE.🤖 Generated with Claude Code