Add fillable form fields to a PDF
pdf_add_fieldsCreate standard fillable AcroForm fields at exact positions in an existing PDF: text, checkbox, radio, dropdown, and signature. Fill them later with pdf_fill.
Instructions
Create standard fillable AcroForm fields in an existing PDF at exact positions: text, multiline text, checkbox, radio group, dropdown and signature box. Coordinates are PDF points measured from the bottom-left corner of the page as the viewer sees it (1 inch = 72 pt; US Letter is 612 x 792), the same frame and 1-based page numbers as pdf_edit; x and y are the field's bottom-left corner and the whole rectangle must lie inside the page (each side at least 4 pt). Every entry needs type, name and page; every type except radio also needs x, y, width and height; radio and dropdown need options. Unknown keys are rejected. A radio entry is one group whose options each carry their own value, x, y, width and height. name is 1-200 characters with no dot, unique in the request and not already a field name in the PDF (a name that equals the first part of an existing dotted name is also taken). Text takes multiline, max_length, default and font_size; checkbox takes checked; dropdown takes options (strings), default and font_size. All entries also take required, read_only, border (default true) and background (default false). font_size is a number from 1 to 200 or "auto". If omitted, text, multiline text and dropdown fields get a fixed size of min(12 pt, the largest size at which one line fits the field height), at least 4 pt, so they draw predictably when filled; a value longer than the box is then clipped, not shrunk. "auto" stores size 0, and pdf_fill then sizes the text to the box when the blank field is first filled (a short value is enlarged, a long one shrunk) and keeps that size, so a later, longer value is clipped: for predictable text omit font_size or set a number. Defaults and dropdown options use standard fonts (WinAnsi characters only: euro sign and curly quotes work, Polish L-stroke and CJK fail). The signature type creates an EMPTY signature field for a signing tool to use: nothing is signed, it is not an e-signature. At most 200 entries and 200 widgets per call, and 2,000 fields in the finished form. Fields are plain AcroForm with no JavaScript. Fill the result with pdf_fill (pdf_inspect lists the new fields). Returns the result written to output_path, or inline as an application/pdf resource when output_path is omitted (results over 7 MB are never returned inline: pass output_path); an existing file at output_path is overwritten. The source is never modified.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pdf_path": "<pdf_path>",
"fields": "<fields>"
},
"name": "pdf_add_fields"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fields | Yes | Fields to create. Nothing is added unless every entry is valid. Required keys: every entry type, name, page; text, checkbox, dropdown and signature also x, y, width, height; radio and dropdown also options (radio options carry their own rectangles). | |
| password | No | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). | |
| pdf_path | Yes | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. Use a URL or data URI when this server runs remotely (Smithery, hosted gateways) where local paths do not exist. | |
| output_path | No | Path of a .pdf file to write the result to, inside the allowed directories (PDFOPS_ROOT, default the working directory); an existing file there is overwritten. Omit when running remotely: the PDF is then returned inline as an application/pdf resource for the client to save. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bytes | Yes | Size of the produced PDF in bytes | |
| warning | No | Present as xfa-layer-dropped when a hybrid AcroForm/XFA input lost its XFA layer | |
| output_path | No | Absolute path written, when output_path was supplied | |
| resource_uri | No | pdfops:// uri of the inline application/pdf resource, when output_path was omitted |