Skip to content

feat(edit-pdf): detect and fill existing AcroForm fields (#9) - #64

Merged
McanKul merged 3 commits into
McanKul:developmentfrom
nonamexishere:feat/9-acroform-fill
Aug 29, 2026
Merged

feat(edit-pdf): detect and fill existing AcroForm fields (#9)#64
McanKul merged 3 commits into
McanKul:developmentfrom
nonamexishere:feat/9-acroform-fill

Conversation

@nonamexishere

Copy link
Copy Markdown
Contributor

Summary

  • Detect and list existing AcroForm text, checkbox, radio, combo, and list fields from the source path (not the one-page preview extract).
  • Overlay HTML controls on Edit PDF at unrotated widget rects.
  • Write /V and regenerate /AP (bundled Noto for text; drawn Form XObject streams for checkbox/radio so Preview/Chrome show the on-state).
  • Interactive Save is the default. Flatten form fields is opt-in and widgets-only (leftover highlights/notes stay annots).
  • XFA → actionable error. Extra files with forms → error. /Sig skipped. Hidden/read-only not changed.

Fixes #9.

Test plan

  • cargo test --lib edit_forms (F1–F17)
  • npm test / npm run typecheck / cargo test --lib
  • Manual: fill qa-form-fill.pdf, Agree + Size M visible after 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 substantial form work. The flatten path needs to be fail-closed before merge: attach_xobjects_and_content replaces the page’s existing /Resources /XObject entry, which can break existing images/forms, and widgets without a usable /Rect + /AP are removed without being painted. Please preserve/merge existing resources, keep any widget that cannot be safely flattened, and add regression coverage. Please rebase onto current development after #55.

List catalog fields from the source path, overlay HTML controls at
unrotated widget rects, and write /V plus hand-rolled /AP (Noto for
text; drawn streams for checkbox/radio so viewers show the state).
Flatten is opt-in and widgets-only. XFA and extra-file forms error.
Fixes McanKul#9.
…dgets

Merge flatten paints into the page's existing /Resources /XObject
instead of replacing it. Widgets without a usable /Rect or /AP stay
on dest /Annots instead of being dropped unpainted.

@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 again for the AcroForm work. I integrated it with the annotation editor, preserved inherited page resources during flattening, and added regression coverage. All local and CI checks pass.

@McanKul
McanKul merged commit b827047 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