pdflib-syntax-forms

Automate AcroForm field discovery, creation, updating, and flattening in pdf-lib workflows for JavaScript and TypeScript projects.

1|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/OpenAEC-Foundation/pdf-lib-Claude-Skill-Package --skill pdflib-syntax-forms
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdflib-syntax-forms
Source: https://github.com/OpenAEC-Foundation/pdf-lib-Claude-Skill-Package/tree/main/skills/source/pdflib-syntax/pdflib-syntax-forms
Command: npx skills add https://github.com/OpenAEC-Foundation/pdf-lib-Claude-Skill-Package --skill pdflib-syntax-forms

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about pdflib-syntax-forms

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fill PDF form fields using pdf-lib without encountering field name errors?

To fill PDF form fields using pdf-lib, first enumerate and inspect exact case-sensitive field names and types to avoid throws from incorrect getters, then set values and call updateFieldAppearances for non-Latin text. This ensures forms behave as expected after programmatic edits.

Why does non-Latin text not render correctly in pdf-lib AcroForm fields?

Non-Latin text fails to render in AcroForm fields when fontkit is not registered. You must register fontkit, embed Unicode fonts, and explicitly call updateFieldAppearances so the pdf-lib form fields display localized text correctly.

What is the safest way to flatten pdf-lib form fields and prevent accidental data loss?

Flattening pdf-lib form fields locks results into a read-only state. To prevent accidental data loss, apply explicit flattening semantics and selective-workarounds, and ensure safe XFA deletion is performed before calling form.flatten().

Does pdf-lib support XFA deletion when manipulating AcroForm fields?

Yes, pdf-lib workflows support detecting and safely deleting XFA when present. Removing XFA interference is a required step before updating AcroForm fields and flattening to ensure the PDF behaves as expected.

How do I create and place new PDF form widgets on pages with pdf-lib?

You can create and place new widgets on pages by accessing the AcroForm, setting properties like read-only, required, or maxLength, and then registering fontkit to update field appearances for localized text rendering.

Can I batch-fill a questionnaire PDF and embed images into button widgets with pdf-lib?

Yes, you can 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 finalized read-only report.