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 provided template and corresponding data sets. It supports various input methods for both the template file and the document data, including binary data from previous nodes, base64 encoded strings, or URLs. The node can handle different template file types such as Word, HTML, and PDF, and output the generated documents in formats like PDF, Word, Excel, or HTML.

This operation is beneficial in scenarios where batch document generation is required, such as creating personalized reports, invoices, contracts, or certificates for multiple recipients using a single template and varying data inputs.

Practical Examples:

  • Generating customized invoices for multiple customers by providing a Word template and JSON data for each invoice.
  • Creating certificates for event participants by supplying an HTML template and XML data files.
  • Producing multiple PDF reports from a single PDF template and data files fetched via URLs.

Properties

Name Meaning
Template File Input Type How to provide the template file. Options: Binary Data (from previous node), Base64 String (encoded content), 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 (required when input type is Base64 or URL; optional for Binary Data).
Template Base64 Content Base64 encoded content of the template file (required if Template File Input Type is Base64).
Template File URL URL of the template file (required if Template File Input Type is URL).
Template File Type Select the template file type. Options: Word (Docx), HTML, PDF.
Document Data Input Type How to provide the document data. Options: Text (manual JSON or XML entry), Binary Data (from previous node), Base64 String (encoded content), URL (link to data file).
Document Data Type The data format for the template data. Options: JSON, XML.
Document Data Text Manual data entry for the template 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 (optional for Binary Data; required for Base64 or URL).
Document Base64 Content Base64 encoded content of the data file (required if Document Data Input Type is Base64).
Document Data File URL URL of the data file (required if Document Data Input Type is URL).
File Meta Data Additional metadata for fields in JSON format (optional).
Output Type The file format of the generated document(s). Options: PDF, Word (Docx), Excel, HTML.
Meta Data Json Metadata in JSON format (required).
Output File Name Name for the output file(s). If multiple documents are generated, this will be used as a prefix with numbers appended (e.g., "document" becomes "document1.pdf", "document2.pdf", etc.).

Output

The node outputs an array of generated documents, each represented as an item with a json field containing metadata and information about the generated document. The actual document content is typically included as binary data attached to the output item, representing the generated file in the selected output format (PDF, Word, Excel, or HTML).

If multiple documents are generated, the output includes multiple items, each corresponding to one generated document file. The output file names follow the specified prefix with numeric suffixes if applicable.

Dependencies

  • Requires access to the template file and document data either through previous nodes (binary data), base64 encoded strings, or accessible URLs.
  • The node depends on an external document generation service or library capable of processing templates and data to produce the output documents.
  • Proper API authentication credentials or tokens must be configured in n8n to enable communication with the external document generation service.
  • Network access is necessary if URLs are used to fetch template or data files.

Troubleshooting

  • Common Issues:

    • Incorrect or missing template or data file inputs leading to errors in document generation.
    • Malformed JSON or XML data causing parsing failures.
    • Unsupported template or output file types.
    • Network issues when fetching files from URLs.
    • Missing or invalid metadata JSON.
  • Error Messages and Resolutions:

    • "Template file not found or inaccessible": Verify the binary property name, base64 content, or URL correctness and accessibility.
    • "Invalid JSON/XML data": Check the syntax and structure of the manual data entry or data files.
    • "Unsupported file type": Ensure the selected template and output file types are supported.
    • "Authentication failed": Confirm that the API key or authentication token is correctly set up in n8n credentials.
    • "Network error while fetching file": Check network connectivity and URL validity.

Links and References

Discussion