Programmatic Form Filling

PSPDFKit for Web supports the AcroForm standard and can view and fill forms inside the Instance.

Forms are an optional component that can be licensed. If not licensed, forms will simply be invisible. Forms can be manually disabled by setting Configuration#disableForms to true as part of the load() call.

You can also modify and query forms in code — for example, filling out forms programmatically:

const formFields = await instance.getFormFields();

// Update the value of all text form fields.
const updatedFormFieldValues = formFields
  .filter(formField => formField instanceof PSPDFKit.FormFields.TextFormField)
  .reduce((o, formField) => (o[] = "New Value"), {});

instance.getFormFields().then(function(formFields) {
  // Update the value of all text form fields.
  var updatedFormFieldValues = {};
  formFields.forEach(function(formField) {
    if (formField instanceof PSPDFKit.FormFields.TextFormField) {
      updatedFormFieldValues[] = "New Value";

The argument for Instance#setFormFieldValues must be a simple JavaScript object, where the keys refer to the FormField#name of the form field that you want to update, and the value is either null, string, or Array<string>, depending upon the type of the FormField.