Doc Fill

Node made for filling a pdf form.

Overview

This node, named "Doc Fill," is designed to fill PDF forms by populating form fields with specified values. It takes a PDF document as input (in binary form), applies the provided configuration JSON that maps PDF form field names to their desired values, and outputs a new PDF document with those fields filled.

Common scenarios where this node is useful include:

  • Automating the filling of standardized PDF forms such as applications, contracts, or surveys.
  • Generating personalized documents by merging data into PDF templates.
  • Streamlining workflows that require dynamic PDF generation without manual editing.

For example, you might use this node to automatically fill out a tax form PDF with user data collected from a web form, then send the completed PDF via email.

Properties

Name Meaning
Property Name Name of the binary property holding the input PDF document to be used for form filling.
Property Name Out Name of the binary property where the output PDF document (with filled form) will be stored.
Configuration JSON JSON string mapping PDF form field keys to the values to fill in those fields.

The Configuration JSON should be an array of objects, each describing a form field and the value to set, e.g.:

[
  { "fieldName": "firstName", "value": "John" },
  { "fieldName": "lastName", "value": "Doe" }
]

Output

The node outputs items containing:

  • A json property that preserves the original input JSON data.
  • A binary property containing the filled PDF document under the key specified by Property Name Out. This binary data is a PDF file with the form fields populated according to the configuration.
  • The output PDF is always of MIME type application/pdf.

Dependencies

  • Uses the pdf-lib library to load, manipulate, and save PDF documents.
  • Relies on helper functions (isPDFDocument and fillForm) from an internal utility module to validate the input and apply form field values.
  • Requires the input PDF to be provided as binary data within the workflow.
  • No external API or service dependencies are needed; all processing is done locally within the node.

Troubleshooting

  • Input is not a PDF: If the binary input is not a valid PDF file, the node throws an error indicating the expected PDF MIME type and the actual type received. Ensure the input binary property contains a proper PDF document.
  • Invalid Configuration JSON: If the JSON mapping is malformed or cannot be parsed, the node will throw a parsing error. Verify that the JSON is correctly formatted.
  • Missing Form Fields: If the configuration references form fields not present in the PDF, those fields will simply not be filled. Double-check the field names against the PDF form.
  • Continue On Fail: If enabled, the node will continue processing subsequent items even if one fails, appending error details to the output item.

Links and References

Discussion