PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

The node operation Generate Documents Multiple allows users to generate multiple documents based on a template and corresponding data inputs. It supports various ways to provide the template file (binary, base64 string, raw HTML code, or URL) and document data (text input, binary data, base64 string, or URL). This flexibility enables batch generation of documents such as reports, invoices, contracts, or letters by merging structured data with predefined templates.

Typical use cases include:

  • Generating personalized documents for multiple recipients using JSON or XML data.
  • Automating report creation from dynamic data sources.
  • Creating multiple contract documents from a single template and different datasets.
  • Producing bulk PDF or Word documents in workflows that require templated output.

Properties

Name Meaning
Template File Input Type How to provide the template file. Options: Binary Data (from previous node), Base64 String, HTML Code (manual raw HTML, only for HTML template type), URL (link to template file).
Template Binary Property Name of the binary property containing the template file (used if Template File Input Type is Binary Data).
Template File Name Name of the template file including extension (used if Template File Input Type is Binary Data).
Template Base64 Content Base64 encoded content of the template file (used if Template File Input Type is Base64).
Template File Name (required) Name of the template file including extension (required if Template File Input Type is Base64, URL, or HTML Code).
Template File URL URL of the template file (used if Template File Input Type is URL).
HTML Code Raw HTML template code entered manually (used if Template File Input Type is HTML Code and Template File Type is HTML).
Template File Type The type of the template file. Options: Word (Docx), HTML, PDF.
Document Data Input Type How to provide the document data. Options: Text (manual JSON or XML), Binary Data (from previous node), Base64 String, URL.
Document Data Type The format of the document data. Options: JSON, XML.
Document Data Text Manual entry of document data in JSON or XML format (required if Document Data Input Type is Text).
Document Binary Property Name of the binary property containing the data file (used if Document Data Input Type is Binary Data).
Document Data File Name Name of the data file including extension (used if Document Data Input Type is Binary Data).
Document Base64 Content Base64 encoded content of the data file (used if Document Data Input Type is Base64).
Document Data File Name (required) Name of the data file including extension (required if Document Data Input Type is Base64 or URL).
Document Data File URL URL of the data file (used if Document Data Input Type is URL).
Output File Name Base name for the generated output files. If multiple documents are created, numbers will be appended (e.g., "document1.pdf", "document2.pdf").
Binary Data Output Name Custom name for the binary data field in the node's output.

Output

The node outputs an array of items where each item contains a json object and a binary data field (with customizable name). The binary data represents the generated document(s) based on the provided template and data.

  • The json part typically includes metadata or status information about the generated documents.
  • The binary data contains the actual generated document files (e.g., PDF, DOCX) ready for further processing or saving.

If multiple documents are generated, they are output as separate items with incremented filenames based on the provided output file name prefix.

Dependencies

  • Requires access to the template file and document data either via binary input, base64 strings, URLs, or manual text input.
  • Depends on an external document generation service or library capable of merging templates with data to produce documents (implied by the imported actions but not explicitly shown).
  • May require API keys or authentication tokens configured in n8n credentials to access URLs or external services if used.

Troubleshooting

  • Common issues:
    • Incorrect or missing template file input leading to failure in document generation.
    • Malformed JSON or XML data causing parsing errors.
    • Unsupported template file types or mismatched template and data formats.
    • Network issues when providing template or data files via URLs.
  • Error messages:
    • Errors related to invalid base64 content or missing binary properties indicate incorrect input configuration.
    • Parsing errors for JSON/XML data suggest syntax problems in manual data entry.
    • File not found or access denied errors when using URLs point to permission or availability issues.
  • Resolutions:
    • Verify the correctness and presence of all required input fields.
    • Validate JSON/XML data before input.
    • Ensure URLs are accessible and correct.
    • Use proper file extensions matching the template and data types.

Links and References

  • n8n Documentation
  • General resources on document templating and generation (e.g., Docx templating libraries, PDF generation tools)
  • JSON and XML formatting guides for preparing input data

Discussion