Extract Data from PDF Form Fields Using JavaScript

You can extract the values of all the form fields present in a PDF using Instance#getFormFieldValues. It returns a simple JavaScript object, where the keys refer to the FormField#name of the form field and the value is either null, string, or Array<string>, depending upon the type of the FormField:

const formFieldValues = instance.getFormFieldValues();
console.log(formFieldValues); // { textField: 'Text Value', checkBoxField: ['A', 'B'], buttonField: null }

We use cookies to improve your experience and for marketing. Learn more in our privacy policy.