Fill PDF

Read the real field names out of a PDF form, then complete the form from a JSON object of values.

Runs on your devicePDFWorkingNo account needed

What this tool does

Fill PDF has two modes, and the first one matters more than its name suggests. List the fields in this form opens the document with pdf-lib, walks the AcroForm and returns a table of every field it holds: the name the document uses internally, the type (text, checkbox, radio, dropdown, list, button or signature), whatever value is stored in it now, and for anything with a fixed set of choices, the exact option strings. Those internal names are what the other mode keys on, and they are frequently nothing like the labels printed beside the boxes.

Fill the fields from JSON takes a JSON object whose keys are those names. A string is written into a text field, or picks an entry in a dropdown, radio group or list box, and anything that is not already text is converted before it is written, so 42 arrives as its digits. A checkbox is ticked by true, by the string "true", by the number 1 or by "on", and cleared by everything else — the string "1" included, which is the one that catches people out. A key that matches no field is skipped and counted in the summary as a name not found; switch on Fail if a field name is not in the form and the run stops instead, quoting the names it could not match. Push buttons and signature fields accept no value, so a key pointed at one is reported the same way as a typo.

Flatten the form after filling is enabled by default, and it is blunter than the wording suggests: the values are stamped into the page and every interactive field in the document goes, the ones you never named as well as the ones you filled. The file comes back under its own name with -filled added, so tax-return.pdf becomes tax-return-filled.pdf. Clear the checkbox when the next person still has to type into it, or when you want to open the result and check it before committing. Several PDFs can be queued in one run and the same object is applied to each, with one output file per document; unless the strict setting is on an unmatched name never stops the run, and the summary counts each such name once however many of the documents were missing it.

The work is done in this browser tab and no copy of the document goes anywhere, which is the point when the form you are completing carries a passport number or a salary. The limits are worth reading before you rely on it. Radio groups and list boxes refuse an option the document does not define, but a dropdown does not: pdf-lib stores whatever string it is handed and leaves the option list untouched, so a misspelt choice is written in as a value the form never offered rather than reported back to you. Values are redrawn with pdf-lib's built-in Helvetica when the file is saved, so a field styled in another typeface changes appearance, and a character outside the WinAnsi set — most non-Latin scripts — ends the run with an encoding error rather than filling quietly. Nothing here executes the document's own form JavaScript, so calculated totals and validation rules never fire and what you supply is written verbatim. A scanned form is a picture of a form with no fields in it and is refused; a password-protected file cannot be read until Unlock PDF has removed the password; and a dynamic XFA form keeps its answers in an XML packet that pdf-lib does not write, so what Acrobat shows may not match what you set here.

How to use it

  1. Start in list mode. Choose the PDF with Mode left on List the fields in this form. The table gives you each field's real name, its type, the value it already carries and the exact options a dropdown or radio group is willing to accept. No file is produced by this mode.
  2. Write the values as a JSON object. Switch to Fill the fields from JSON and replace the sample with your own keys — field name on the left, value on the right. Input that is not valid JSON, or that is an array rather than an object, is rejected before any document is touched.
  3. Decide about flattening and strictness. Leave Flatten the form after filling on to fix the answers into the page, or clear it to hand on a form that still opens for editing. Fail if a field name is not in the form turns a mistyped key into a stopped run rather than a silent gap.
  4. Check what it reports, then open the file. The summary counts the fields filled and says whether the file was flattened, and a notFound badge names the keys that matched nothing. A radio group, a list box or a text field with a maximum length stops the run outright when the value will not go in, quoting the field and the value it refused.

Processing & privacy

Runs on your device. Your file is processed directly in this browser.

Common use cases

Finding out what a form really calls its fields

A box labelled Surname can be named topmostSubform[0].Page1[0].f1_02[0]. List mode prints the names as the document stores them, which is what a script filling the same form has to use.

Producing the same form for several people

Export each record as a JSON object of field names and run one after another. Nothing is retyped, and a change to the underlying data means refilling rather than re-reading the whole page.

Returning a completed application

Fill it in, leave flattening on, and the recipient opens fixed page content instead of live boxes that their reader might offer to re-edit or clear.

Inspecting a form somebody sent you

Values are read from the field dictionaries, so list mode shows what a field actually holds even when the viewer draws it blank because the field carries no appearance stream.

Questions

Does the document leave my machine?
No. pdf-lib runs in this tab and the file is read, filled and handed back on your own computer. The library itself is fetched from this site the first time you press Run, and from then on a form fills with the network disconnected.
Why is my field name reported as not found?
Either the key does not match — the names are case-sensitive and often carry a long hierarchy prefix — or the field is a push button or a signature field, neither of which can be given a value. Run list mode and copy the name from the table.
What happens to a value the field does not offer?
A radio group and a list box match their option strings exactly and stop the run when yours is not among them, naming the field and the value. A dropdown is the exception: pdf-lib takes any string and stores it as given, so read the Options column in list mode rather than trusting the tool to catch a misspelt choice.
Can I fill a scanned form?
No. A scan is an image and holds no AcroForm fields, so fill mode refuses it and says the document has none. Annotate PDF places text on the page instead, which is the right tool for a form that was never interactive.
Should I leave flattening switched on?
Leave it on when the document is finished, because a flattened file has no fields left to alter — including for this tool, which will then find nothing to fill. Clear it while the form is still being passed around. Flatten PDF does the same stamping on a form somebody else has already completed.
Can it apply a digital signature?
No. Signature fields are listed and their type reported, but nothing here writes a cryptographic signature into one. Sign PDF places a visible drawn, typed or uploaded signature on the page, which is a mark rather than a certificate.
Does it touch anything besides the fields I named?
Page content and the document's metadata are left as they were, though the file is re-serialised so its byte count will shift, and pdf-lib regenerates the appearance of the fields that changed. Flattening is the exception and it is on by default: that stamps and strips every field in the form, not only the ones your object mentioned.

Related tools

  • Merge PDF — Combine several PDFs into one document in the order you choose.
  • Split PDF — Split one PDF into separate documents by page range.
  • Compress PDF — Reduce PDF file size while preserving the quality that matters.
  • PDF to JPG — Export every page of a PDF as a JPG image.
  • JPG to PDF — Turn one or many JPG photos into a single PDF.
  • Protect PDF — Add a password and set permissions on a PDF.