What problem does it solve?
Working with PDF form fields in pdf-lib is error-prone: field name mismatches, wrong typed getters, missing font support for non-Latin text, XFA interference, and forgetting to flatten leave forms in an unintended state. This Skill provides clear, version-aware guidance to discover, read, create, update, and finalize AcroForm fields so PDFs behave as expected after programmatic edits.
Core Features & Use Cases
- Reliable Field Discovery — Always enumerate and inspect field names and types before accessing to avoid throws from incorrect getters.
- Full Field Lifecycle — Read existing fields, create and place new widgets on pages, set properties (read-only, required, maxLength), and remove or flatten fields as needed.
- Font & Encoding Guidance — Steps to register fontkit, embed Unicode fonts, and update field appearances so non-Latin text renders correctly.
- XFA & Flattening Safeguards — Detect and delete XFA when present and explain flattening semantics and selective-workarounds to prevent accidental data loss.
- Real World Use Case — Batch-fill a questionnaire PDF with localized names, embed images into button widgets, update appearances with a custom font, and flatten the document to distribute a read-only report.
Quick Start
Fill the form fields in the attached PDF by discovering exact field names, setting values, registering fontkit and updating field appearances if needed for non-Latin text, then call form.flatten() to lock the results.