PDF Autofiller

Fill PDF forms from JSON, as a Python library or a self-hosted API. Your keys don't have to match the form's field names, and every fill reports what was written and what was left blank. No AI and no network calls by default. MIT licensed.

For anyone who fills the same PDF forms again and again (a W-9 for every contractor, an intake form for every client) with data that already lives in a spreadsheet, CRM or web form. Set it up from code, the command line, or tools like n8n and Zapier. It does not handle scanned PDFs, XFA forms or signatures.

View on GitHub Try it in Codespaces
The sample form after filling first name, last name and date of birth

Python

pip install git+https://github.com/lindseystead/ai-pdf-autofiller.git
curl -LO https://raw.githubusercontent.com/lindseystead/ai-pdf-autofiller/main/samples/sample_form.pdf

from pdf_autofiller import fill
fill("sample_form.pdf",
     {"firstname": "Jane", "lastname": "Doe", "dob": "1990-01-01"},
     "filled.pdf")

Self-hosted API

docker run --rm -p 127.0.0.1:8000:8000 \
  -e API_AUTH_ENABLED=false \
  ghcr.io/lindseystead/ai-pdf-autofiller:latest

curl -F pdf_file=@sample_form.pdf \
  -F 'user_data={"firstname":"Jane","lastname":"Doe","dob":"1990-01-01"}' \
  http://localhost:8000/fill -o filled.pdf

Auth is off in that command for local use only; in production keep it on and set API_AUTH_TOKEN. The server also has a test page at /playground:

Playground: upload a PDF, paste JSON, download the filled PDF and read the fill report