Generate Documents (Multiple) in n8n
Generate Documents Multiple is a PDF4me node action in n8n, shown in the node as Generate Documents (Multiple), that renders many finished files in one run from a single template plus an array of records. Use it for a batch of invoices, customer letters, or per-region reports, with each document returned as its own n8n item.
What this node does
PDF4me: Generate Documents (Multiple) takes one template and a list of records and produces many finished documents in one n8n run. Provide a Word, HTML, or PDF template via Binary Data, Base64, HTML code, or URL plus bulk data as JSON or XML (array of records or repeating XML). Each generated file returns as a separate output item so you can loop, save, email, or upload them individually. Use this node instead of Generate Document (Single) whenever you have a list of customers, invoices, or records and want one finished document per row in a single execution.
Authenticating Your API Request
Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate batch document generation requests securely.
Important Facts You Should Not Miss
/generate-documents-multiple-full.png)
Full node panel. Word template + JSON Text data + PDF output is the typical mail-merge setup
Generate Documents (Multiple) vs Generate Document (Single)
Picking the wrong one of the two is the most common mistake on this task. The split is about how many files come back and which template and data formats are on offer.
| Aspect | Generate Documents (Multiple) | Generate Document (Single) |
|---|---|---|
| Files returned | Many, one n8n item per generated document | Exactly one |
| Template types | Word, HTML, PDF | Word, HTML, PDF, plus Mail Merge and Google Docs |
| Data formats | JSON or XML only | JSON, XML, and CSV |
| Output types | PDF, Word, or Excel (HTML templates output HTML) | PDF, Word (no Excel option) |
| Reach for it when | You have a list of records and want one document per row | You have a single record, CSV data, or a Mail Merge template |
What Parameters Does Generate Documents (Multiple) Need?
Required in the n8n UI: Credential to connect with, Template File Type, Template File Input Type, Document Data Type, Document Data Input Type, and Output Type (always shown. choices depend on Template File Type). Conditional required fields (Template Binary Property, Template Base64 Content, HTML Code, Template File URL, Document Data Text, Document Binary Property, etc.) appear only when their parent input type is chosen. Output File Name, Keep PDF Editable, and Binary Data Output Name are optional with sensible defaults.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| Template File Type | Required | Select the Template file type. Options: Word, HTML, PDF. Default is `Word`. | Word |
| Output Type | Conditional | Format of the generated documents. Shown when Template File Type is Word. Options: PDF, Word, Excel. Default is `PDF`. | PDF |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is PDF. | _1 |
| Keep PDF Editable | Conditional | Whether to keep the generated PDF form fields editable. Shown when Output Type is PDF. Default is `No`. | No |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is Word. | _1 |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is Excel. | _1 |
| Output Type | Conditional | Format of the generated documents. Shown when Template File Type is HTML. Options: HTML. Default is `HTML`. | HTML |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is HTML. | _1 |
| Output Type | Conditional | Format of the generated documents. Shown when Template File Type is PDF. Options: PDF, Word, Excel. Default is `PDF`. | PDF |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is PDF. | _1 |
| Keep PDF Editable | Conditional | Whether to keep the generated PDF form fields editable. Shown when Output Type is PDF. Default is `No`. | No |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is Word. | _1 |
| Output File Name | Conditional | Name for the generated files, without extension (the Output Type extension is added). When several documents are generated, `_1`, `_2` and so on is appended (for example `document_1.pdf`). If empty, the names returned by PDF4me are used, or `generated_document`. Shown when Output Type is Excel. | _1 |
| Template File Input Type | Required | How to provide the template file. Options: Binary Data, Base64 String, HTML Code, URL. Default is `Binary Data`. | Binary Data |
| Template Binary Property | Conditional | Name of the binary property containing the template file. Shown when Template File Input Type is Binary Data. Default is `data`. | data |
| Template File Name | Conditional | Name of the template file (including extension). If empty, the file name of the binary data is used. Shown when Template File Input Type is Binary Data. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). If empty, the file name of the binary data is used. Shown when Template File Input Type is Binary Data. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). If empty, the file name of the binary data is used. Shown when Template File Input Type is Binary Data. | template.docx |
| Template Base64 Content | Conditional | Base64 encoded template file content. Shown when Template File Input Type is Base64 String. | UEsDBBQAAAAI... |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is Base64 String. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is Base64 String. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is Base64 String. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is HTML Code. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is HTML Code. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is HTML Code. | template.docx |
| HTML Code | Conditional | Write your HTML template code here. It will be automatically converted to base64. Shown when Template File Input Type is HTML Code. | <h1>{{title}}</h1> |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is URL. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is URL. | template.docx |
| Template File Name | Conditional | Name of the template file (including extension). Shown when Template File Input Type is URL. | template.docx |
| Template File URL | Conditional | URL of the template file. Shown when Template File Input Type is URL. | https://example.com/template.docx |
| Template File URL | Conditional | URL of the template file. Shown when Template File Input Type is URL. | https://example.com/template.docx |
| Template File URL | Conditional | URL of the template file. Shown when Template File Input Type is URL. | https://example.com/template.docx |
| Document Data Type | Required | The data type for the template. Options: JSON, XML. Default is `JSON`. | JSON |
| Document Data Input Type | Required | How to provide the document data. Options: Text, Binary Data, Base64 String, URL. Default is `Text`. | Text |
| Document Data Text | Conditional | JSON or XML data to fill the template with, matching Document Data Type. Shown when Document Data Input Type is Text. | [{"name":"Alice"},{"name":"Bob"}] |
| Document Data Text | Conditional | JSON or XML data to fill the template with, matching Document Data Type. Shown when Document Data Input Type is Text. | [{"name":"Alice"},{"name":"Bob"}] |
| Document Binary Property | Conditional | Name of the binary property containing the data file. Shown when Document Data Input Type is Binary Data. Default is `data`. | data |
| Document Data File Name | Conditional | Name of the data file (including extension), used when the file is uploaded to PDF4me. If empty, the file name of the binary data is used. Shown when Document Data Input Type is Binary Data. | customers.json |
| Document Data File Name | Conditional | Name of the data file (including extension), used when the file is uploaded to PDF4me. If empty, the file name of the binary data is used. Shown when Document Data Input Type is Binary Data. | customers.json |
| Document Base64 Content | Conditional | Base64 encoded data file content. Shown when Document Data Input Type is Base64 String. | W3sibmFtZSI6... |
| Document Data File Name | Conditional | Name of the data file (including extension). Not used: the node does not send this value to PDF4me. Shown when Document Data Input Type is Base64 String. | customers.json |
| Document Data File Name | Conditional | Name of the data file (including extension). Not used: the node does not send this value to PDF4me. Shown when Document Data Input Type is Base64 String. | customers.json |
| Document Data File Name | Conditional | Name of the data file (including extension). Not used: the node does not send this value to PDF4me. Shown when Document Data Input Type is URL. | customers.json |
| Document Data File Name | Conditional | Name of the data file (including extension). Not used: the node does not send this value to PDF4me. Shown when Document Data Input Type is URL. | customers.json |
| Document Data File URL | Conditional | URL of the data file. Shown when Document Data Input Type is URL. | https://example.com/customers.json |
| Document Data File URL | Conditional | URL of the data file. Shown when Document Data Input Type is URL. | https://example.com/customers.json |
| Binary Data Output Name | Optional | Custom name for the binary data in n8n output. Default is `data`. | data |
Template File Type Options
Choose the template format. Output Type choices change with this selection.
/generate-documents-multiple-template-file-type.png)
Template File Type dropdown. Word, HTML, or PDF (no Mail Merge or Google Docs here)
WordDefault: .docx templatesHTMLHTML templates and pasted HTML codePDFPDF templatesTemplate File Input Type Options
Pick how the template enters the node. The follow-up fields change with this choice.
/generate-documents-multiple-template-file-input-type.png)
Template File Input Type. Binary Data, Base64 String, HTML Code, or URL
Binary DataDefault: file from previous nodeTemplate Binary Property to the binary field name (default data). Template File Name is optional and falls back to the uploaded filename.Base64 StringBase64-encoded templateTemplate Base64 Content. Template File Name is required so the extension matches the Template File Type (.docx, .html, .pdf).HTML CodePaste raw HTML inline (HTML only){{title}}, {{content}} into HTML Code. The node wraps it in a basic <html> shell if missing. Template File Name is required (e.g. template.html).URLDownload from a public linkTemplate File URL. PDF4me fetches the template directly. The URL must be open (no auth) and Template File Name is required so the extension matches the template type.Document Data Type Options
Pick the data format you are sending.
/generate-documents-multiple-document-data-type.png)
Document Data Type. JSON or XML (no CSV in this operation)
JSONDefault: array of records (most common)[{"name":"Alice"}, {"name":"Bob"}]. The node validates that the payload parses. A single object generates one document. pass an array if you want many.XMLRepeating-record XMLDocument Data Input Type Options
Pick how the bulk data enters the node.
/generate-documents-multiple-document-data-input-type.png)
Document Data Input Type. Text, Binary Data, Base64 String, or URL
TextDefault: paste bulk data inlineDocument Data Text. This field is strictly required on the Multiple operation when Text is chosen (stricter than Single).Binary DataUse a data file from a previous nodeDocument Binary Property to the binary field name (default data). Watch that the template and data binary property names do not collide when both come from the same item.Base64 StringBase64-encoded data file.json or .xml file as base64 in Document Base64 Content. Document Data File Name is required.URLDownload from a public linkDocument Data File URL to a public HTTPS URL of the JSON or XML data file. Document Data File Name is required so the extension matches the data type.Output Fields
A successful run returns one n8n item per generated document. Each item carries both JSON metadata and the binary file.
Output
Fields the node returns.
| Field | Type | What it contains |
|---|---|---|
fileName | String | File name of the resulting file. |
mimeType | String | MIME type of the resulting file, for example `application/pdf`. |
fileSize | Number | Size of the resulting file in bytes. |
success | Boolean | True when the operation succeeded. |
documentIndex | String | Position of this document among the generated documents, starting at 1. |
totalDocuments | Number | Number of documents in PDF4me's response. |
data | Binary | One generated document per output item, in the chosen Output Type. If PDF4me returns a single file instead of a list, it is stored in the property `data` whatever Binary Data Output Name says. |
How Do I Set Up Generate Documents (Multiple) in n8n?
- Add PDF4me to your n8n workflow. Set Resource to Generate and Generate Operations to Generate Documents (Multiple).
- In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
- Set Template File Type to Word (default), HTML, or PDF.
- Set Output Type. PDF, Word, or Excel for Word / PDF templates; HTML only for HTML templates.
- Set Template File Input Type to Binary Data (default), Base64 String, HTML Code (HTML only), or URL and fill the matching template field plus Template File Name if required.
- Set Document Data Type to JSON (default) or XML.
- Set Document Data Input Type to Text (default) and paste your JSON array into Document Data Text. or pick Binary Data, Base64 String, or URL and supply the data file.
- Set Output File Name to something readable like
invoiceso files come back asinvoice_1.pdf,invoice_2.pdf, ... - If outputting PDF and your template has form fields, enable Keep PDF Editable.
- Leave Binary Data Output Name as
dataunless a downstream node needs a different property name. Execute the node and route the multiple output items into Split In Batches, Write Binary File, Email, or cloud-storage upload.
Typical Setups
Workflow ExamplesCommon n8n workflow patterns using Generate Documents (Multiple).
- A Google Sheets node pulls a list of customers with name, address, and balance into the workflow.
- A Code or Set node packages the rows into a JSON array of objects (one object per customer).
- PDF4me Generate Documents (Multiple) runs with Template File Type Word, Output Type PDF, Template File Input Type Binary Data, and Document Data Input Type Text. Output File Name is
customer_letter. - The node returns one item per customer named
customer_letter_1.pdf,customer_letter_2.pdf, and so on. - A Loop Over Items node sends each PDF to the matching customer via Gmail or uploads to Google Drive.
- One node downloads the .docx template; another node downloads the .json customers file. A Merge node combines them so both binaries land on one item.
- PDF4me Generate Documents (Multiple) is configured with Template File Input Type Binary Data (
Template Binary Propertyset to the template field name) and Document Data Input Type Binary Data (Document Binary Propertyset to the data field name). - Set
Document Data File Nameif the data file is not nameddata.json. - The generated files come back as separate items and are written to a SharePoint document library named after the customer ID.
- A nightly Schedule Trigger fires the invoice batch run.
- PDF4me Generate Documents (Multiple) is set with Template File Input Type URL (
Template File URLpoints to the .docx invoice template on S3) and Document Data Input Type URL (Document Data File URLpoints to a generatedbilling-cycle.jsonfile). Template File Nameisinvoice.docxandDocument Data File Nameisbilling-cycle.json.- Output Type is PDF, Output File Name is
invoice, and Keep PDF Editable is off. - Each returned item is uploaded to the customer's folder in Dropbox and emailed via Outlook.
- A Webhook Trigger fires when a marketing campaign launches.
- PDF4me Generate Documents (Multiple) is set with Template File Type HTML and Template File Input Type HTML Code. the HTML is pasted directly into the node with mustache placeholders.
- Document Data Type is JSON, Document Data Input Type is Text, and an expression maps the campaign's lead list into a JSON array.
- Output Type is HTML. The node returns one HTML file per lead.
- A Write Binary File node saves each generated HTML to a public web folder; another node sends the personalised link to each lead.
- A daily Schedule Trigger pulls KPI numbers from PostgreSQL.
- A Set node groups the rows by region into a JSON array, one record per region.
- PDF4me Generate Documents (Multiple) runs with Template File Type Word, Output Type Excel, Document Data Type JSON, Document Data Input Type Text. Output File Name is
region_report. - The node returns one .xlsx per region named
region_report_1.xlsx,region_report_2.xlsx, and so on. - A Microsoft OneDrive node uploads each file to the matching region folder for the analytics team.
Practical Tips
Cheat Sheet
| Field | Value |
|---|---|
| Resource | Generate |
| Operation | Generate Documents (Multiple) |
| Template File Type | Word |
| Output Type | PDF |
| Template File Input Type | Binary Data |
| Template Binary Property | data |
| Document Data Type | JSON |
| Document Data Input Type | Text |
| Document Data Text | (bulk JSON array with multiple records) |
| Output File Name | my_document (optional, becomes prefix) |
| Binary Data Output Name | data |
| Credentials | PDF4me API credential |
Frequently Asked Questions
Related Actions
Same Task on Other Platforms
POST /api/v2/GenerateDocumentMultiple endpoint. for custom backend code or Postman testing.