Automate Invoice PDF Creation with n8n PDF Toolkit

Save hours on invoicing by automating invoice PDF generation from structured data using n8n’s HTML to PDF node. This workflow handles data preprocessing and delivers ready-to-send invoices instantly.
webhook
set
code
+2
Workflow Identifier: 1862
NODES in Use: Webhook, Set, Code, HTML to PDF, Respond to Webhook

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow takes invoice details as input and creates a PDF invoice file automatically.
It solves the problem of spending too much time making invoices and avoiding errors in invoices.
The output is a ready-to-send invoice PDF you can give to clients quickly.

The workflow listens to data sent to a webhook,
formats invoice fields into HTML,
generates a PDF with styled design,
and sends the PDF back as the webhook response.


Inputs, Process, and Outputs

Inputs

  • Invoice number, sender info, and client info.
  • A list of line items including description, price, and quantity.
  • Client contact email for the footer.

Processing Steps

  • Webhook receives raw invoice JSON data.
  • Set data stores incoming invoice fields.
  • Code node formats multiline texts into HTML paragraphs and creates table rows from items.
  • The total cost is computed by summing item prices times quantities.
  • HTML to PDF node uses a styled HTML template to make the invoice PDF.
  • Respond to Webhook sends the PDF file back to the caller.

Outputs

  • A binary PDF file of the invoice formatted with client and company details.
  • The PDF is ready to send or save.

Who Should Use This Workflow

This is for anyone who needs to make professional invoices often.
It helps people who want to stop copying and pasting invoice data.

You should use this if you want to speed up invoice generation
and avoid mistakes.


Tools and Services Used

  • n8n workflow automation: Runs the workflow steps.
  • PDF Toolkit node (HTML to PDF): Creates PDFs from HTML with CSS styling using CustomJS API.
  • Webhook node: Receives invoice data externally.
  • Code node: Formats invoice data into HTML and calculates totals.

Beginner step-by-step: How to Use This Workflow in n8n

Importing the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Inside the n8n editor, select “Import from File”.
  3. Choose the downloaded workflow file and import it.

Configure API Keys and Credentials

  1. Open the workflow and locate the HTML to PDF node.
  2. Add your CustomJS API credentials under Credentials settings.

Update IDs and Contact Details

  1. Check the Webhook node path; change the ID if needed.
  2. Update client email and company details inside the Set data node.

Test and Activate

  1. Trigger the webhook by sending a test JSON payload matching the Set data structure.
  2. Check the workflow runs without errors and returns a PDF.
  3. If successful, activate the workflow in n8n by clicking the activate button.

The workflow is now ready to generate invoice PDFs automatically.
If self hosting n8n on a server or VPS, see self-host n8n for setup.


Customization Ideas

  • Change invoice colors and fonts by editing CSS inside the HTML to PDF node’s HTML template.
  • Add a QR code or barcode by generating an image in a new Code node before PDF creation.
  • Add payment terms or invoice dates by expanding the Set data node and adjusting Code preprocessing.
  • Send invoices via email by adding an Email Send node after PDF generation.

Troubleshooting

  • Issue: PDF generation fails with authentication error.
    Fix: Verify CustomJS API credentials in n8n under Credentials.
  • Issue: PDF shows wrong or no invoice details.
    Fix: Check field names and code syntax in the Code (Preprocess) node.
  • Issue: Webhook returns no data or errors.
    Fix: Confirm webhook URL is correct and workflow is active.

Pre-Production Checklist

  • Send sample JSON data to the webhook to test input.
  • Ensure API credentials are set and valid.
  • Preview PDF output from the HTML to PDF node.
  • Backup the workflow JSON before deploying.

Deployment

Activate the workflow in n8n for production use.
Use the webhook URL with other apps or services to create invoices automatically.

Monitor workflow executions in the n8n executions tab.
Fix any errors as needed.


Summary

✓ Saves time by automating invoice PDF creation.
✓ Reduces errors from manual invoice formatting.
✓ Creates professional, brand-styled invoices.
✓ Sends PDF files back immediately via webhook.
✓ Easy to extend with email or payment integrations.
→ Provides a simple automatic way to handle invoicing inside n8n.


Frequently Asked Questions

The HTML to PDF node requires valid CustomJS API credentials for PDF generation.
Modify the CSS inside the HTML input field of the HTML to PDF node to update invoice colors and fonts.
This happens if the webhook URL is incorrect or the workflow is not activated in n8n.
The Code node converts multiline strings into HTML paragraphs, creates HTML table rows for line items, and sums the total amount.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free