Actions2
Overview
This node allows users to work with PDF forms by either extracting the form fields or mapping (filling) values into those fields. It is useful in scenarios where automated processing of PDF forms is needed, such as:
- Extracting all field names and current values from a PDF form for inspection or further processing.
- Automatically filling out PDF forms with data from other sources, like databases or user inputs, and generating a new filled PDF.
For example, you might use the "Extract Fields" operation to get all form fields from a PDF uploaded by a user, then use the "Map Fields" operation to fill those fields with specific values before sending the completed form back to the user.
Properties
Name | Meaning |
---|---|
Binary Property | Name of the binary property containing the PDF file to process. |
Extract Fields First | Notice prompting to use the "Extract Fields" operation first to obtain field names for mapping. (Informational only) |
Output Filename | Name of the output PDF file after mapping fields. Leave empty to keep the original filename. |
Fields | Collection of fields to map: each entry requires specifying the PDF form field name and the value to set for that field. |
The "Fields" property supports multiple entries, allowing mapping of several form fields at once.
Output
For Extract Fields operation:
json
contains:totalFields
: Number of form fields found in the PDF.fields
: Array of objects describing each field with:index
: Position number of the field.name
: Field name.type
: Type of the PDF form field (e.g., text field, checkbox).value
: Current value of the field if retrievable; otherwisenull
.
fieldNames
: Array of all field names extracted.
- The original binary PDF data is passed through unchanged.
For Map Fields operation:
json
contains:success
: Boolean indicating if mapping was successful.totalFields
: Number of fields mapped.mappedFields
: Array of objects with each mapped field'sname
andvalue
.
binary
contains the updated PDF file with mapped fields under the specified binary property name, including metadata such as MIME type (application/pdf
), filename, extension, and file size.
Dependencies
- Uses the
pdf-lib
library to load, read, manipulate, and save PDF documents. - Requires input items to contain binary data representing the PDF file.
- No external API or service dependencies are required.
- The node expects the binary data to be base64 encoded.
Troubleshooting
No binary data exists on item!
This error occurs if the input item does not contain any binary data. Ensure the previous node outputs the PDF file as binary data.No binary data property "[propertyName]" exists on item!
The specified binary property name does not exist in the input item. Verify the correct binary property name is provided.Error setting field [fieldName]:
If an error occurs while setting a field value during mapping, it is logged but does not stop execution. Check that the field name matches exactly one in the PDF form and that the value is valid for the field type.If the node fails unexpectedly, enabling "Continue On Fail" can allow processing of subsequent items.
Links and References
- pdf-lib GitHub repository – The library used internally for PDF manipulation.
- PDF Forms Overview – General information about PDF forms and fields.