Fill Form (AcroForm)
fill_formFill interactive form fields in an existing PDF with matching values, including text, checkboxes, dropdowns, and radio buttons. Unknown field names are listed in the error to help identify them.
Instructions
Fill field values into an existing PDF's interactive form (AcroForm). If you do not know the field names, pass a nonexistent one — the error lists every field name and type. CJK values need fontPath or the PDF_WRITER_FONT environment variable. flatten: true makes the form non-interactive after filling, but on a tagged PDF that breaks PDF/UA conformance and additionally requires allowBreakingTags: true. XFA forms are not supported.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | Object of field name → value. Value type matches the field kind: text = string or number / checkbox = boolean / dropdown, optionlist = string or string array / radio = string. Example: {"user.name": "山田 太郎", "agree": true, "plan": "A"} | |
| flatten | No | Flatten to non-interactive after filling. Default false. When true, values can no longer be edited. | |
| fontPath | No | Font used to render values (.ttf/.otf). Falls back to the PDF_WRITER_FONT environment variable, then the standard font. Required for CJK values. | |
| inputPath | Yes | Absolute path of the target PDF. | |
| outputPath | No | Destination file path (absolute). When omitted, a base64 string is returned instead. | |
| returnBase64 | No | When true, include a base64 string in the result in addition to saving. | |
| allowBreakingTags | No | Allow flattening even on a tagged PDF. Default false. When true, PDF/UA-1 conformance breaks. | |
| allowBreakingSignatures | No | When the target is digitally signed (detected via /ByteRange), the default is an error. Set true to proceed, accepting that the signatures become invalid. |