Submit and Save PDF Forms Using Web Server-Backed

When you use the PSPDFKit for Web Server-Backed operational mode, whenever a form field is filled in, the new value is automatically sent and stored by Document Engine. The exact moment of when the changes are sent to Document Engine can be controlled by changing the auto-save mode.

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 Web Server-Backed, you can also fill the form fields with values coming from any source — e.g. a database or your backend application — using Document Engine’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 Document Engine 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.