Overview
This node extracts form field information from a PDF file provided as binary data. It is useful when you need to analyze or process interactive PDF forms by retrieving the names and optionally metadata of the fields embedded in the PDF. For example, it can be used to dynamically generate user interfaces based on PDF form fields or validate that required fields exist before further processing.
Properties
| Name | Meaning |
|---|---|
| Input Binary Field | The name of the input binary property containing the PDF file. If left blank, the node will use the first available binary property. Example values: data, pdf, document. |
| Options | A collection of additional options: - Include Field Metadata: Boolean flag to include extra metadata about each form field such as read-only status, field type, and appearance presence. |
Output
The node outputs an array of items where each item contains:
json.pdfFields: An array of objects representing the form fields extracted from the PDF. Each object includes at least the field's name. If "Include Field Metadata" is enabled, each field object also contains ametadataobject with:isReadOnly: Whether the field is read-only.fieldType: The type/class name of the field.hasAppearance: Whether the field has an appearance stream.
json.source.binaryProperty: The name of the binary property from which the PDF was read.All original JSON and binary data from the input item are preserved in the output.
If no input binary field is specified, the node outputs a message listing available binary properties and indicates which one it used.
Dependencies
- Requires the external library
pdf-libto parse and extract form fields from PDFs. This must be installed in the environment (npm install pdf-lib). - The node expects input items to contain binary data representing PDF files.
- No special API keys or external services are needed.
Troubleshooting
Error: "Failed to load pdf-lib library"
Ensure that thepdf-libpackage is installed in your n8n environment.Error: "No binary data found on input item"
The node did not receive any binary data. Connect a node that outputs PDF binary data or specify the correct binary property name.Error: "No binary data property 'X' exists on item!"
The specified binary property does not exist on the input item. Check the property name or leave it blank to auto-select.Error: "Binary data in property 'X' is empty"
The binary data is empty or corrupted. Verify the source node outputs valid PDF binary data.If metadata extraction fails, the node logs an error but still returns the basic field names.
Links and References
- pdf-lib GitHub Repository – The underlying library used for PDF parsing and form field extraction.
- n8n Documentation – For general guidance on working with binary data and custom nodes.