Extract Data from PDF Form Fields in Flutter

PSPDFKit for Flutter allows you to extract data from form fields programmatically. Each form field has a fully qualified name, which is used to identify and retrieve a specific form field object before extracting its data.

Obtaining the Fully Qualified Name of a Form Field

The example below shows how to obtain the fully qualified name of the first form field on the first page of a document:

dynamic allAnnotations = await pspdfkitWidgetController.getAnnotations(0, 'all');
// Get the fully qualified name for the first form field.
String? formFieldName = (allAnnotations[0]['formFieldName']);

Getting the Data from a Form Field

The example below shows how to get the data from a form field with the fully qualified name, formFieldName:

// Get the data from a form field with the fully qualified name, `formFieldName`.
String? lastName = await pspdfkitWidgetController.getFormFieldValue('formFieldName');