Write PDF Form data

Writes data into a PDF Form.

Overview

The "Write PDF Form data" node writes structured JSON data into a PDF form template and outputs the filled PDF as a binary file. This is useful for automating document generation workflows, such as creating filled contracts, invoices, or application forms based on dynamic input data.

Practical examples:

  • Automatically generating filled-out tax forms from CRM data.
  • Creating personalized certificates by merging user data into a PDF template.
  • Populating government or HR forms with employee information.

Properties

Name Type Meaning
PDF Filename String Name of the source PDF form template to write the data to (e.g., form.pdf).
Output File String Name of the output PDF file that will contain the filled-in data (e.g., report.pdf).
JSON Property Name String Name of the property in the input JSON where the data to fill into the PDF is located.

Output

  • json: The original input JSON data is preserved in the output.
  • binary: Contains the generated PDF file under the key specified by the "Output File" property. This is the filled PDF form as binary data, ready for download or further processing.

Dependencies

  • Requires access to the specified PDF template file (PDF Filename) on the server where n8n is running.
  • Relies on the fs/promises module for file operations.
  • Uses a helper function (fillForm) from a local dependency to perform the actual PDF filling.

Troubleshooting

Common issues:

  • File not found:

    • Error: The file "<PDF Filename>" could not be found.
      • Cause: The specified PDF template does not exist at the given path.
      • Solution: Ensure the file exists and the path is correct relative to the n8n process.
  • Incorrect JSON structure:

    • Error: The json data has the wrong structure (name/type/value).
      • Cause: The data provided in the JSON property does not have the expected fields (type, name, value).
      • Solution: Make sure your data array contains objects with these keys.
  • PDF generation failure:

    • Error: The report pdf could not be generated.
      • Cause: An error occurred during the PDF filling process.
      • Solution: Check the validity of the PDF template and the input data.

Links and References

Discussion