Skip to main content

How to Automate PDF Generation in n8n: Complete Guide

· 7 min read
Michał Szymanowski
Michał Szymanowski
PDFBolt Co-Founder

n8n PDF automation workflow for automated PDF generation of invoices, reports, and certificates using PDFBolt API

Working with n8n workflows typically involves handling document generation at some point. Whether it's creating invoices after purchases, generating reports on schedule, or producing certificates for course completions, PDF generation is a common requirement that can be surprisingly complex to implement well. Many existing solutions require complex setups or have limited customization options. PDFBolt changes this by offering a reliable, powerful API that integrates seamlessly with automation platforms like n8n.

Why Automate PDF Generation in the First Place?

Before diving into the technical details, let's talk about why this matters. Businesses often struggle with inconsistent document formatting, time-consuming manual processes, and the need to generate hundreds of similar documents with different data.

Teams often spend hours weekly manually creating invoices, reports, or certificates. Beyond wasted time, manual processes introduce formatting errors and inconsistencies that can look unprofessional.

Automation solves these problems by:

  • Ensuring every document follows the same template and branding.
  • Processing hundreds or thousands of documents without manual effort.
  • Eliminating errors in data entry and formatting.
  • Allowing teams to focus on more valuable work.
  • Seamlessly connecting with CRM systems, databases, and other business tools.
  • Triggering based on specific events (new orders, completed forms, scheduled reports).

PDFBolt API Endpoints: Choosing the Right Mode

Choose from three PDFBolt API endpoints depending on how you need to handle PDF generation:

Direct Mode

Endpoint: /v1/direct

Best for: Immediate PDF delivery in workflow responses.

  • Returns raw PDF data directly in the HTTP response.
  • Perfect for real-time document generation.
  • Ideal when the PDF needs to be immediately processed or sent.

Use cases: Instant invoice generation after a purchase, generating tickets that need to be sent immediately.

Sync Mode

Endpoint: /v1/sync

Best for: URL-based PDF delivery and storage.

  • Returns a JSON response with downloadable PDF URL.
  • Allows storage in your own S3 bucket for complete control.
  • Useful when PDFs will be accessed multiple times.

Use cases: Monthly reports that need to be stored and sent to multiple stakeholders.

Async Mode

Endpoint: /v1/async

Best for: High-volume processing and webhook-based workflows.

  • Processes PDFs in the background and sends results via webhook → see async workflow details.
  • Perfect for bulk operations or very complex documents that might take longer to generate.

Use cases: End-of-month batch processing, generating hundreds of certificates at once.

API Documentation

For complete endpoint specifications and parameters, refer to the PDFBolt API Documentation.

Setting Up PDFBolt Integration in n8n

Prerequisites

1. PDFBolt API Key: Sign up at PDFBolt and obtain your API key. You'll use this key to authenticate your n8n HTTP requests to PDFBolt.

2. Template Setup: Create or customize a template in the app:

  • Choose to customize a template from the gallery or create one from scratch.
Template Resources

Check out our Template Gallery for ready-to-use examples and Templates Documentation for creation guides.

  • Publish the template to make it available for API use.
  • When making API calls to PDFBolt, you'll send: the templateId (to specify which template to use) and templateData (containing the actual values to populate your template).
Template Data Mapping Details
  • When sending API requests later, the keys in your templateData object must exactly match the variable names you define in your PDFBolt template.
  • For example, if your template uses {{invoice_number}} and {{client_name}}, your API data must include invoice_number and client_name fields.
  • Mismatched field names will result in empty values in the generated PDF.

3. n8n Access: Either n8n Cloud account or self-hosted n8n instance.

Basic HTTP Request Configuration

In this guide, we'll use the versatile HTTP Request node to integrate with PDFBolt.

Here's the foundation setup:

  1. Create a new workflow in your n8n interface.

  2. Add an HTTP Request node by clicking the ➕ button and searching for HTTP Request.

  3. Configure the basic setup:

    • Method: POST
    • URL: https://api.pdfbolt.com/v1/direct
    • Authentication: Generic Credential Type
    • Generic Auth Type: Header Auth
    • Create New Credential:
      • Name: API-KEY
      • Value: YOUR-API-KEY
n8n HTTP Request node authentication setup for PDFBolt API integration
  1. Save your configuration and you're ready to start building your PDF generation workflow.
n8n HTTP Request node example configuration for PDFBolt API integration

Practical Implementation Example

Direct Invoice PDF Generation

This example shows how to build a complete invoice generation workflow using PDFBolt with n8n. The workflow receives structured invoice data via webhook and generates a PDF using a template.

Workflow Overview

n8n HTTP Request node example configuration for PDFBolt API integration

Components:

1️⃣ Webhook Trigger - Receives invoice data.

2️⃣ HTTP Request - Calls PDFBolt API.

3️⃣ Send Message - Delivers PDF via email.

Node 1: Webhook Trigger

Purpose: Receives invoice data from your application or external system.

Configuration:

  • HTTP Method: POST
  • Path: generate-invoice (or your preferred path)
  • Respond: Immediately
n8n webhook node configuration for PDFBolt invoice generation
Example Payload
{
"templateId": "c5fbe4b2-1e49-484f-ae4d-842ccc984c66",
"templateData": {
"invoice_number": "INV-2025-0404",
"issue_date": "June 15, 2025",
"due_date": "July 15, 2025",
"company_name": "TechOrange Solutions",
"company_email": "hello@techorange.dev",
"company_phone": "+1 (555) 123-4567",
"client_name": "John Doe",
"client_email": "john.doe@example.com",
"line_items": [
{
"quantity": "5",
"tax_rate": "9",
"unit_price": "89.00",
"description": "Code Review by AI Intern",
"total_amount": "445.00"
},
{
"quantity": "1",
"tax_rate": "9",
"unit_price": "1199.00",
"description": "Legacy Code Translator",
"total_amount": "1199.00"
}
],
"subtotal_amount": "3690.00",
"tax_amount": "315.50",
"total_amount": "3821.00",
"currency_symbol": "$",
"payment_info": {
"bank_name": "Binary National Bank",
"payment_terms": "Net 30 days",
"account_number": "404 404 404 404",
"routing_number": "001100110"
}
}
}

Data Structure Assumption

This example assumes your webhook receives data already formatted for PDFBolt templates with templateId and templateData structure. If your incoming data structure differs, add a Code Node or Edit Fields Node between the webhook and HTTP Request to transform the data into the required PDFBolt and your template format.

Node 2: HTTP Request (PDFBolt API)

Purpose: Converts the invoice data into a PDF using PDFBolt's template.

Configuration: Use the same HTTP Request configuration we set up earlier in the Basic HTTP Request Configuration section.

Body Configuration:

  • Send Body: Enabled
  • Body Content Type: JSON
  • Specify Body: Using JSON
  • Switch to Expression mode (click the Expression toggle)
  • JSON Body:
{{ $json.body.toJsonString() }}
n8n HTTP Request body configuration for PDFBolt API
Why This Works
  • $json.body contains the webhook payload.
  • toJsonString() converts the JavaScript object to JSON string format.
  • PDFBolt receives properly formatted template data.

Node 3: Send a Message

Purpose: Delivers the generated PDF to the client via email with the invoice attached.

Email Configuration Example:

  • To: {{ $json.body.templateData.client_email }}
  • Subject: Invoice {{ $json.body.templateData.invoice_number }}
  • Email Type: Text (or HTML for better formatting)
  • Message: Hi {{ $json.body.templateData.client_name }}. Your invoice is ready.
  • Attachments Configuration:
    • Add OptionAttachmentsAdd Attachment
n8n Gmail Send Message node configuration with PDF attachment

Testing Your Workflow

Test your workflow before production:

  1. Execute the workflow using n8n's test button.
  2. Send sample data to your webhook URL.
  3. Verify the PDF generation and email delivery.
  4. Check the generated PDF for correct formatting and data.

If everything works correctly, you should receive an email with the generated invoice as an attachment:

Example email with PDFBolt generated invoice PDF attachment

PDF Automation Use Cases with n8n and PDFBolt

Transform your business processes with automated PDF generation. These real-world examples show how different n8n triggers can seamlessly create professional documents and distribute them across your workflow.

Use CaseTriggerGenerated PDFNext Action
E-commerce InvoicesShopify Trigger
New order created
PDFBolt HTTP Request
Professional invoice
Gmail + Google Drive
Email customer and archive
Course CertificatesTypeform Trigger
Course completion quiz submitted
PDFBolt HTTP Request
Branded certificate
Gmail + Airtable
Email student and update records
Sales ReportsSchedule Trigger
Daily/weekly
PDFBolt HTTP Request
Performance dashboard
Slack + Dropbox
Share with team and archive
Employee WelcomeGoogle Sheets Trigger
New employee added to HR sheet
PDFBolt HTTP Request
Welcome packet and handbook
Gmail + Google Drive
Email employee and archive
Event TicketsWebhook
Event registration completed
PDFBolt HTTP Request
Digital ticket
Gmail + Google Sheets
Email attendee and track registrations
Purchase OrdersGoogle Sheets Trigger
Inventory level updated
PDFBolt HTTP Request
Purchase order document
Gmail + Google Drive
Email supplier and archive

Conclusion

Integrating PDFBolt with n8n provides a straightforward solution for automated document generation. The combination handles common business workflows effectively, from processing invoices and generating reports to creating certificates and shipping labels.

The key consideration is choosing the right endpoint based on your workflow needs. Direct mode works well for immediate PDF delivery, while Sync mode better suits workflows that need to store or reference PDF URLs. Async mode is ideal for high-volume batch processing and complex documents that require background processing. Ensure your data matches your PDFBolt template, and test your workflow with sample data.

The examples in this guide demonstrate practical patterns you can adapt for your specific use cases. Whether you're automating a few documents per day or processing hundreds in batch operations, these solutions work regardless of volume.

Start by creating a template in PDFBolt, then build a simple workflow in n8n. Once you have the basic integration working, you can expand it with additional nodes for storage, notifications, and business logic.