Fill PDF Form Fields Programmatically in Flutter
PSPDFKit for Flutter allows you to fill form fields programmatically. Each form field has a fully qualified name used to identify and retrieve a specific form field object before filling it.
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 Pspdfkit.getAnnotations(0, 'all'); // Get the fully qualified name for the first form field. String? formFieldName = (allAnnotations['formFieldName']);
The example below shows how to fill the value of a form field with a fully qualified name (
formFieldName) and two radio buttons with fully qualified names (
await Pspdfkit.setFormFieldValue('Dummy Form Field Value', 'formFieldName'); // For radio buttons and checkboxes, use `selected` and `deselected`. await Pspdfkit.setFormFieldValue('selected', 'radioFieldName_0'); await Pspdfkit.setFormFieldValue('deselected', 'radioFieldName_1');