Skip to main content

Generate Document (Single) using n8n action

PDF4me Generate Document (Single) creates personalized documents from templates using dynamic data through n8n automation workflows. Process templates (Word, HTML, PDF) via n8n triggers, binary data, base64 strings, or public URLs with JSON/XML data to generate customized documents with intelligent data merging, variable replacement, conditional content, formatting preservation, and multiple output formats (PDF, Word, Excel, HTML). This solution is ideal for personalized letters, invoices, contracts, reports, certificates, and automated document generation workflows that require template-based creation with accurate data integration and seamless integration.

Setup

Add the PDF4me "Generate Document (Single)" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.

Prerequisites:

  • PDF4me API credentials
  • n8n workflow access

Configuration:

  1. Add PDF4me node to workflow
  2. Select "Generate Document (Single)" action
  3. Configure input parameters (see below)
Generate Document (Single)

Parameters

Complete list of parameters for the Generate Document (Single) action. Configure these parameters to control single document generation from templates.

Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.

ParameterTypeDescriptionExample
Template File Input Type***StringTemplate Input Format Selection
• Choose the format of your template file data input
• PDF4me supports multiple input types
• Options: Binary Data, Base64 String, or URL
Binary Data
Template Binary PropertyStringTemplate Binary Data Reference (Required if Binary Data)
• Specify the property name for accessing binary template data
• Should match the binary data property name in your workflow
• Required when Template File Input Type is "Binary Data"
data
Base64 Template ContentStringBase64 Encoded Template Input (Required if Base64 String)
• Provide template file data as base64 encoded string
• PDF4me automatically decodes and processes the template content
• Required when Template File Input Type is "Base64 String"
UEsDBBQABgAI...
Template File URLStringPublic Template URL Input (Required if URL)
• Provide a public/open permission URL to the template file
• PDF4me downloads and processes the template from the provided URL
• Required when Template File Input Type is "URL"
https://abc.com/temp.docx
Template File Name***StringTemplate Filename Specification
• Specify the name of the template file with proper extension
• Supports .docx, .html, .pdf file types
• Helps with file identification and processing order
template.docx
Template File Type***StringTemplate File Type Selection
• Choose the type of template file being processed
• PDF4me supports different template types with specific requirements
• Options: Word (.docx), HTML (.html), PDF (.pdf)
Word
Document Data Input Type***StringData Input Format Selection
• Choose the format of your document data input
• PDF4me supports multiple input types
• Options: Text, Binary Data, or URL
Text
Document Data Type***StringData Format Selection
• Choose the format of your document data
• PDF4me supports JSON and XML data formats
• Used for template processing and field population
JSON
Document Data TextStringManual Data Input
• Manually enter the data for the template in JSON or XML format
• Required only if data file is not mapped through other methods
• Used for direct data entry
{"name": "John Doe", "email": "[email protected]", "amount": 1500.00}
Document Data FileStringData File Binary Reference (Required if Binary Data)
• Specify the property name for accessing binary data file
• Should match the binary data property name in your workflow
• Required when Document Data Input Type is "Binary Data"
data
Document Data URLStringPublic Data URL Input (Required if URL)
• Provide a public/open permission URL to the data file
• PDF4me downloads and processes the data from the provided URL
• Required when Document Data Input Type is "URL"
https://exam.com/abc.json
Output Type***StringOutput Format Selection
• Choose the file format of the generated document
• PDF4me supports multiple output formats
• Options: PDF, Word (.docx), Excel (.xlsx), HTML
PDF
Meta Data Json***StringMetadata JSON Specification
• JSON metadata for the generated document
• Can include document properties, processing information, custom attributes
• Essential for document metadata management
{"title": "Generated Document", "author": "PDF4me", "subject": "Template Processing"}
Binary Data Output Name***StringBinary Data Mapping
• Define the variable name for accessing generated document binary data
• Used in subsequent workflow actions
• Essential for workflow data flow
data
File Meta DataStringAdditional Metadata
• Additional metadata for fields in JSON format
• Can include custom properties, formatting instructions, processing hints
• Optional for advanced template processing
{"department": "Sales", "priority": "High", "version": "1.0"}

Advanced Options

The following parameters are available in the Advanced Options section and are optional:

ParameterTypeDescriptionExample
Custom ProfilesStringCustom Configuration Profiles
• Set additional options using custom profiles
• JSON-like format containing predefined parameters
• Supports outputDataFormat, preserveMetadata, etc.
• Optional for specialized requirements
{ "outputDataFormat": "base64", "preserveMetadata": true, "optimizeForPrinting": false, "compressionLevel": "medium" }

Output

Output Parameters

ParameterTypeDescriptionExample
successBooleanPDF4me document generation operation status indicator - Boolean flag indicating the success or failure of the document generation process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflowstrue
messageStringPDF4me document generation operation status message - Human-readable status message providing details about the document generation process result. Includes success confirmation or error details for troubleshootingDocument generated successfully
fileNameStringPDF4me generated document filename - The complete filename of the successfully generated document with proper file extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processesgenerated_document.pdf
mimeTypeStringPDF4me output MIME type - MIME type of the generated document based on the selected output format. Useful for content type validation and proper file handling in web applicationsapplication/pdf
fileSizeNumberPDF4me generated document file size in bytes - The exact size of the generated document in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise document management and workflow automation125430
docNameStringPDF4me document name reference - The name of the generated document for reference and tracking purposes. This matches the fileName for consistency in document management workflowsgenerated_document.pdf
documentGeneratedBooleanPDF4me document generation completion confirmation - Boolean flag confirming that the document generation operation has been successfully completed. Useful for verifying that the document was generated correctlytrue
templateProcessedBooleanPDF4me template processing confirmation - Boolean flag confirming that the template was successfully processed and data was merged correctly. Useful for verifying template processing effectivenesstrue

N8N Action Response

The PDF4me Generate Document (Single) API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:

JSON Response Format

The raw JSON response from the API:

[
{
"success": true,
"message": "Document generated successfully",
"fileName": "generated_document.pdf",
"mimeType": "application/pdf",
"fileSize": 125430,
"docName": "generated_document.pdf",
"documentGenerated": true,
"templateProcessed": true
}
]

Use Cases

Personalized Document Generation and Automation

  • Automatically generate personalized invoices, contracts, and business documents from templates using customer data from CRM systems or databases
  • Process employee onboarding documents by generating personalized offer letters, contracts, and welcome packages using employee information from HR systems
  • Create customized reports and presentations by merging data from various sources into professional document templates for different stakeholders

Template-Based Content Management

  • Generate marketing materials and promotional documents from templates using dynamic product information, pricing data, and customer-specific content
  • Process legal documents and compliance materials by generating personalized contracts, agreements, and legal forms using client data and case information
  • Create educational materials and training documents by generating personalized certificates, course materials, and learning resources using student and course data

Business Process Automation and Workflow Integration

  • Integrate document generation into business workflows by automatically creating documents based on workflow triggers, form submissions, or data updates
  • Process batch document generation for large-scale operations like mass mailings, report generation, or document distribution using bulk data sources
  • Automate the creation of standardized documents across different departments and teams while maintaining consistency and reducing manual effort

Get Help