Overview
This node, named "Doc Fill," is designed to fill PDF forms by mapping specified form fields to given values. It processes incoming binary PDF documents, applies the user-defined field mappings, and outputs the filled PDF as a new binary file. This is particularly useful in automating workflows that require populating standardized PDF forms such as applications, contracts, or surveys without manual intervention.
Practical examples include:
- Automatically filling out employment application PDFs with candidate data.
- Populating tax forms with financial information extracted from other systems.
- Generating customized contracts by filling client details into a template PDF form.
Properties
| Name | Meaning |
|---|---|
| Property Name | The name of the binary property in the input item that contains the original PDF document to be filled. |
| Property Name Out | The name of the binary property where the output (filled) PDF document will be stored. |
| Configuration JSON | A JSON array defining how to map PDF form fields to values. Each object must specify: - key: the form field name in the PDF - value: the value to set - type: one of "textfield", "checkbox", "dropdown", or "radiogroup" For checkboxes, the value "true" means checked; any other string means unchecked. |
| Max PDF Size | Maximum allowed size of the input PDF file in megabytes. If the input PDF exceeds this size, the node will throw an error. Default is 10 MB. |
Output
The node outputs items containing the original JSON data plus a binary property holding the filled PDF document. The output binary property name is configurable.
json: Contains the original input JSON data unchanged.binary: Contains the filled PDF document under the configured output binary property name. The PDF is saved in standard PDF format (application/pdf).
No additional binary data types are produced beyond the filled PDF.
Dependencies
- Requires the
pdf-liblibrary for reading and modifying PDF forms. - Uses n8n's helper methods to handle binary data buffers and prepare binary outputs.
- No external API keys or services are required.
- The node expects valid PDF files as input in the specified binary property.
Troubleshooting
- Input is not a PDF: If the binary data in the specified input property is not a PDF, the node throws an error indicating the wrong MIME type. Ensure the input binary property contains a valid PDF file.
- PDF size too large: If the input PDF exceeds the configured maximum size, the node will error out. Increase the "Max PDF Size" property if needed.
- Invalid Configuration JSON: The configuration JSON must be a valid JSON array with correct keys and types. Malformed JSON or incorrect field definitions will cause errors.
- Field mapping errors: If a specified form field key does not exist or cannot be filled, the node throws an error specifying the problematic field.
- Continue on Fail: If enabled, the node will continue processing subsequent items even if some fail, returning error messages in the JSON output.
Links and References
- pdf-lib GitHub Repository – Library used for PDF manipulation.
- n8n Documentation on Binary Data – Handling binary data in n8n nodes.
- JSON Syntax Guide – For formatting the Configuration JSON property correctly.