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
Automate invoice PDFs with n8n and PDF Toolkit

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

Learn how to Build this Workflow with AI:

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.


Automate invoice PDFs with n8n and PDF Toolkit

Visit through Desktop to Interact with the Workflow.

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 Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.