create_fillable_forms
Add fillable form fields like text boxes and checkboxes to a PDF document by specifying annotation properties including position, size, and type.
Instructions
Create new fillable form elements in a PDF document.
Example annotations format:
[
{
"text": "prefilled text",
"x": 10,
"y": 30,
"size": 12,
"pages": "0-",
"type": "TextField",
"id": "textfield1"
},
{
"x": 100,
"y": 150,
"size": 12,
"pages": "0-",
"type": "Checkbox",
"id": "checkbox1"
}
]
Ref: https://developer.pdf.co/api-reference/pdf-add#create-fillable-pdf-forms.md
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to the source PDF file. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files. | |
| annotations | Yes | List of form annotations to create. Each annotation can be a textfield or checkbox with properties like 'x', 'y', 'size', 'pages', 'type', and 'id'. | |
| name | No | File name for the generated output. (Optional) | |
| httpusername | No | HTTP auth user name if required to access source url. (Optional) | |
| httppassword | No | HTTP auth password if required to access source url. (Optional) | |
| api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) |
Implementation Reference
- pdfco/mcp/services/pdf.py:32-45 (helper)The fill_pdf_form_fields helper function that create_fillable_forms delegates to. It accepts optional fields and annotations, builds a custom_payload, and posts to the 'pdf/edit/add' endpoint.
async def fill_pdf_form_fields( params: ConversionParams, fields: list | None = None, annotations: list | None = None, api_key: str | None = None, ) -> BaseResponse: custom_payload = {} if fields: custom_payload["fields"] = fields if annotations: custom_payload["annotations"] = annotations return await request( "pdf/edit/add", params, custom_payload=custom_payload, api_key=api_key )