Skip to content

feat(edit): add comments, highlights and drawing annotations (#8) - #63

Merged
McanKul merged 3 commits into
McanKul:developmentfrom
nonamexishere:feat/8-comments-highlights
Aug 29, 2026
Merged

feat(edit): add comments, highlights and drawing annotations (#8)#63
McanKul merged 3 commits into
McanKul:developmentfrom
nonamexishere:feat/8-comments-highlights

Conversation

@nonamexishere

Copy link
Copy Markdown
Contributor

Summary

  • Create session note / highlight / underline / strikeout / ink annotations on Edit PDF (/Type /Annot + subtype, /C, /T, optional /Contents, /AP).
  • Highlights/underline/strikeout write /QuadPoints (not only /Rect). Markup ink writes /InkList. Draw (kind: "ink") stays a content stamp.
  • Existing annots are listed read-only. Delete only session-created objects. Leftovers (including /Link and markup that already has /NM) copy through.
  • Opt-in Flatten annotations (qpdf --flatten-annotations=all). Default off. Save still goes through the test(editor): validate and round-trip edited PDF outputs before publish #34 gate. Original file is never overwritten.

Fixes #8.

Test plan

  • cargo test --lib edit_annots (C1–C9)
  • npm test (includes markupObject.test.ts)
  • npm run typecheck
  • cargo test --lib
  • Manual: clean-markup.pdf dest has five /Annots with /T Ada, highlight /QuadPoints, /AP
  • Manual: leftover mixed highlight survives; session delete requires another session object to Save

@McanKul McanKul left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. One production blocker before merge: if qpdf --flatten-annotations=all fails, apply_markup_annots still strips the markup annotations and returns success. That can publish a PDF with the annotations removed but not flattened. Please propagate the flatten error instead and add a regression test for the qpdf failure path. Please also rebase onto current development after #55.

…e, strikeout, ink)

Write real /Annots dictionaries after overlay: QuadPoints, appearance
streams, session-only delete, leftover copy-through including /Link.
Opt-in flatten uses qpdf --flatten-annotations=all. Draw ink stays a
stamp. Fixes McanKul#8.
Propagate qpdf --flatten-annotations=all errors instead of stripping
markup and returning success. Dest keeps annotations when flatten fails.
Complete-empty L7 rewrite must not run on stamp-only or markup-only
export, or leftover /Link is deleted. Only wipe dest supported links
when the document is empty and flatten is off.
@nonamexishere
nonamexishere force-pushed the feat/8-comments-highlights branch from e32eafc to 7b551b5 Compare August 28, 2026 20:09

@McanKul McanKul left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the review feedback and adding the regressions. The updated annotation workflow looks good.

@McanKul
McanKul merged commit a6b48e3 into McanKul:development Aug 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants