Import Data into PDF Forms Using PSPDFKit Server

When you use the Server-backed deployment option, the up-to-date form field values of a document are automatically imported into PSPDFKit for Web when you open the document.

If you use Instant, whenever any of the connected clients fills in the form field, the change is automatically synchronized to all the other connected clients.

With PSPDFKit Server, you can also fill the form fields with values coming from any source — e.g. a database or your backend application — using Server’s forms API. For example, assuming there are form fields called firstNameField and lastNameField in the document, you can set their values using the following HTTP request:

curl -X POST http://localhost:5000/api/documents/your-document-id/form-field-values \
  -H "Content-Type: application/json" \
  -d '{
  "formFieldValues": [
    {
      "name": "firstNameField",
      "value": "John"
    },
    {
      "name": "lastNameField",
      "value": "Appleseed"
    }
  ]
}'
POST /api/documents/your-document-id/form-field-values HTTP/1.1
Content-Type: application/json

{
  "formFieldValues": [
    {
      "name": "firstNameField",
      "value": "John"
    },
    {
      "name": "lastNameField",
      "value": "Appleseed"
    }
  ]
}

After the request succeeds, any client opening that document from PSPDFKit Server will see that the form fields have these values. Moreover, any clients that are connected with Instant enabled will see the values update in real time.