Skip to Content
NexPDF

Forms

Fill in PDF forms and flatten them.

English

The fill_form action sets form fields by name: text fields take text, checkboxes take true or false, and choice fields take one of their options. flatten_forms then turns the fields into ordinary page content, so the answers can no longer be changed.

To find a form's field names, extract the form as JSON.

Cost: 1 unit per action.

Fill and flatten

curl https://api.nexpdf.dev/v1/build \
  -H "Authorization: Bearer $NEXPDF_API_KEY" \
  -F form=@application.pdf \
  -F 'instructions={
    "parts": [
      {
        "file": "form"
      }
    ],
    "actions": [
      {
        "type": "fill_form",
        "values": {
          "full_name": "Jane Doe",
          "email": "jane@example.com",
          "agree": true
        }
      },
      {
        "type": "flatten_forms"
      }
    ]
  }' \
  -o application-filled.pdf

flatten_annotations does the same for comments, highlights and stamps.

On this page