docs(design): plan pdf markup annotations - #842
Merged
Conversation
Highlight and freehand ink written back as standard annotations through an incremental update, so every viewer sees them. The read side already paints `/AP /N` and already maps `/BM /Multiply`, so what we write we render. Records why no PDF library is worth taking, why the api hangs off `PdfFile` rather than the deferred element-id editing work, the JSON wire format, and the phase-by-phase cost. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018e3PEzyU2oAFSzsEoWsSmz
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
Records the architecture for adding markup annotations — text highlight and freehand ink — to an existing PDF. Scope is markup only; editing or removing a PDF's existing text stays out.
Nothing is implemented here.
docs/design/pdf-annotation.mdsits besideediting.mdand follows its shape: decisions with their rationale, a phased plan, open questions.The finding that makes this cheap
Annotations are additive — no content stream changes, no object is renumbered — and most of the machinery is already in the tree:
pdf_object.cpp'sto_streamalready emits real PDF syntax (a few escaping gaps aside).Annotation::appearancealready resolves and paints/AP /N, andblend_mode_to_cssalready maps/BM /Multiply. So what we write, we already render — the round trip is self-verifying and the feature needs no new rendering code.begin_page()'sto_boxgives an invertible user-space → page-box map with/CropBoxand/Rotatefolded in.Decisions recorded
PdfFile, addressed by page + geometry, notElementIdentifier— which sidesteps the id-stability linchpinediting.mdPhase 0 is blocked on. This feature does not depend on that work.editing.md.Plus the concrete JSON wire format, the object listing a highlight actually writes, an eight-phase plan (~15–20 days, with a 6–8 day MVP cut), what the writer unlocks next, and four open questions — the sharpest being that a selection-driven highlight tool turns the existing link-overlay-vs-selection conflict from theoretical into user-visible.
Docs only; no consumer-visible change, so no changelog entry.