Release
Flat PDFs: field detection
A flat PDF is a form with no form fields: the blanks are just lines
and boxes drawn on the page, so there is nothing to fill. PDFops now
finds those blanks. Send a flat PDF to
POST /api/detect-fields
and get a fillable PDF back in one request, or a list of suggested
fields to review first. The same detection is a tool in the hosted
MCP server and a button in the browser.
What it finds
It reads the page's drawing and text layer and works out where a person would write: a horizontal rule, an empty box, a run of underscores, a small square for a checkbox. Each field gets a name from the nearest printed label (for a text field: inside the box, to its left, above it or below it; for a checkbox: to its left or right), a position and a confidence between 0 and 1. The rules are fixed geometry, so the same file always gives the same answer, and no model reads the page.
One request, a fillable PDF
Add format=pdf and the endpoint detects the fields,
adds them to the PDF and returns the result. It counts as one
request. The sample below is a one-page membership form with
blanks drawn on it. Download it, then run the call with your own key
(or use your own flat PDF).
curl -sO https://pdfops.dev/sample-flat-form.pdf
curl -s -D headers.txt -X POST https://pdfops.dev/api/detect-fields \
-H "X-API-Key: $PDFOPS_API_KEY" \
-F "pdf=@sample-flat-form.pdf" -F format=pdf -o fillable.pdf
grep -i '^x-pdfops-field' headers.txt
x-pdfops-field-names: ["Full name","Date of birth","Address","Phone","Individual","Family","Signature","Date"]
x-pdfops-fields: 8
The names in that header are the keys to fill by. Here a text field
and a checkbox are filled with
/api/fill-form, and the
call returned a filled PDF:
curl -s -X POST https://pdfops.dev/api/fill-form \
-H "X-API-Key: $PDFOPS_API_KEY" \
-F "pdf=@fillable.pdf" \
-F 'fields={"Full name":"Ada Lovelace","Individual":"true"}' \
-o filled.pdf
Leave out format to get JSON instead: every suggested
field with its label, confidence and rectangle, in the frame
/api/add-fields reads, so
the entries you keep can be sent there as they are. If nothing is
found, the JSON mode answers 200 with a count of 0 and a note, and
format=pdf answers 400 no_fields, so you
never get back an unchanged file that looks like a result.
In an agent
The hosted MCP server has a read-only
pdf_detect_fields tool, which brings it to 24 tools.
pdf_add_fields also takes detect: true, to
detect and add in one tool call. That one makes one request and counts
once. See /mcp.
In the browser
The free make-fillable tool has a Detect fields button. It proposes fields on the pages you loaded; you rename or remove them, draw any it missed, and export the fillable PDF. It runs in your browser, so nothing is uploaded.
Long documents
One call looks at up to 40 pages by default (max_pages
goes to 100) and returns at most 200 fields, in whole pages (a page that alone has more
than 200 returns its 200 most confident and stays in the list of pages
left). When it stops early, the answer says truncated and names the
pages not done: nextPages in JSON, or the
X-PDFops-Next-Pages header with format=pdf.
Add the returned fields to the PDF, send that PDF again with
pages set to the named pages, and repeat until the
answer is no longer truncated. Sending the original file again
repeats the same names and is not supported. The file you send back
must still fit the 4 MB upload limit.
What it does not do
- It does not find a blank that has nothing drawn. Empty space, or a shaded area with no outline, has no line or box to detect. Draw those in the browser tool, or place them by coordinates with
/api/add-fields. - It does not read scanned pages. A scan is a picture, with no drawing or text to read. There is no vision model and no OCR.
- Results should be reviewed. Some suggestions are not blanks, such as an empty cell in a table, and some blanks are missed.
format=pdfadds whatever it finds without a review step, so use it when you will check the result, or when any suggested field is better than none.
Try it
Send a flat PDF with the call above and open the result in any viewer. A form it gets wrong, or a kind of blank it should find, is the most useful thing you can tell us.
← All posts · Docs · Pricing