Generating PDF Quotes and Invoices Automatically with n8n
Published 26 July 2026 · 5 min read
A quote dashed off in a word processor, an invoice rebuilt every month by copying the old one and changing the amounts by hand: that's minutes lost on every single document, and a source of numbering or calculation errors that eventually costs real money at year-end. n8n has no magic "generate a PDF" button, but it has everything needed to build this pipeline properly: a trigger, dynamic data, an HTML-to-PDF rendering engine, and automatic delivery. This guide walks through the full architecture, from template to the final file sent to the client.
Why n8n has no "HTML to PDF" node
This is the first thing that trips people up: looking for a native "PDF" node that accepts HTML as input. n8n does offer Extract from File to read an existing PDF (useful for extracting data from incoming invoices), but nothing on the generation side. The reason is pragmatic: rendering HTML/CSS into a faithful PDF requires a rendering engine (typically headless Chromium), far too heavy to bundle into n8n's default Node.js runtime.
Three options are available, and none is universally best:
| Option | How it works | Advantage | Limit |
|---|---|---|---|
| Self-hosted Gotenberg | Open-source Docker container, HTTP API, converts HTML → PDF via Chromium | Free, unlimited, data never leaves your infrastructure | One more container to maintain |
| SaaS API (APITemplate.io, PDFShift, DocRaptor) | HTTP Request call to a third-party service | Zero infrastructure, up and running in 10 minutes | Monthly quota, your data passes through a third party |
| Community node (e.g. @custom-js/n8n-nodes-pdf-toolkit) | npm package installable on a self-hosted instance | UI configuration, no HTTP call to wire up | Self-hosted only, dependent on a third-party maintainer |
For anyone already self-hosting (the case for most workflows in our FlowKit packs), Gotenberg fits naturally: it's a simple addition to your docker-compose.yml, following the same logic as the Postgres + n8n stack described in our self-hosted backup guide.
The workflow architecture
The pipeline boils down to five steps, whichever rendering engine you pick:
- Trigger — a Form Trigger for manually entering a quote, a webhook from your CRM, or a new row in an n8n Data Table listing the month's services.
- Document number — reading then incrementing a counter stored in a Data Table (
invoice_counter), with the workflow set to concurrency 1 so two simultaneous generations never grab the same number. - Injecting data into the template — an Edit Fields (Set) node or a Code node replaces placeholders (
{{client_name}},{{number}}, the loop over line items) in an HTML string stored in an environment variable or read from a static file in the repo. - Converting to PDF — an HTTP Request node in
multipart/form-datato the Gotenberg/forms/chromium/convert/htmlendpoint (or the equivalent endpoint of the chosen SaaS API), with the response configured to retrieve a binary file. - Storage and delivery — the binary PDF is dropped into Google Drive or Supabase Storage for archiving, then attached to an email sent to the client via Gmail or SMTP.
The HTML template: the part that actually takes time
The template itself is a plain HTML file with inline CSS (PDF rendering engines handle external CSS or non-embedded remote fonts poorly): a header with logo and company details, a table of line items generated by a Handlebars-like loop or by string concatenation in the Code node, a footer with mandatory legal notices (company registration number, late-payment penalty notice, VAT where applicable). It's a one-time effort — once the template is locked down for an invoice, the same base serves the quote with two or three fewer blocks (no payment due date, a "quote valid for 30 days" note instead).
Sequential numbering: the legal trap to avoid
In France, invoice numbers must be continuous and chronological, with no gaps and no duplicates. This is exactly where a poorly designed workflow gets caught out: two near-simultaneous triggers (a client submitting two quotes back to back, a webhook firing twice) can read the same counter value before either one increments it, producing two documents with the same number. The fix, already documented in our guide on webhook idempotency, is to force the workflow to run sequentially (concurrency setting set to 1 in the workflow settings) rather than trusting the relative speed of two parallel executions.
Use case: invoice generated from an e-commerce order
A concrete scenario, following on from our article on automating e-commerce orders: the moment an order status flips to "paid" (a Shopify, WooCommerce, or Stripe webhook, as detailed in our Stripe webhook guide), the workflow pulls the order lines, generates the matching PDF invoice with the next number from the counter, archives it in Google Drive, and sends it to the client — with no manual step between payment and invoice delivery.
One limit worth knowing before you generalize this
This pipeline produces a visual document: a PDF a human can read, but not a structured electronic invoice in the strict sense. The French e-invoicing reform requires, for B2B exchanges, structured formats (Factur-X, UBL, CII) sent through a partner dematerialization platform — a separate building block to add downstream if your business is affected, not a simple PDF export. A study by Tiwari, Marak, Paul, and Deshpande (Determinants of electronic invoicing technology adoption, Journal of Innovation & Knowledge, 2023 — see on Google Scholar) found that perceived complexity and perceived relative advantage are the two most significant determinants of e-invoicing adoption among small organizations: the more visible the time savings and the simpler the setup, the more durably the tool sticks in day-to-day invoicing habits. An n8n pipeline that starts from a ready-made template reduces exactly that perceived friction, even though it only covers the "document generation" part, not full regulatory compliance.
Going further
Generating PDF quotes and invoices from n8n eliminates manual re-entry and secures numbering, at close to zero infrastructure cost when self-hosting Gotenberg. This kind of document automation naturally complements the workflows in the Compliance & Audit Pack (€149), which already logs every action to Supabase — the same foundation can record every generated invoice for a complete audit trail. And if your needs also cover sorting the inbox or a RAG-powered document assistant, the Complete FlowKit Bundle (€269 instead of €347) brings all three packs together on a shared base.
FAQ
Frequently asked questions
Does n8n have a native node to generate a PDF from HTML?
No. n8n has nodes to read and manipulate existing PDFs (Extract from File), but no core node converts HTML into PDF. You need either an external service called via HTTP Request (a self-hosted Gotenberg instance, or an API like APITemplate.io, PDFShift, DocRaptor), or a dedicated community node such as @custom-js/n8n-nodes-pdf-toolkit.
Is the generated PDF a compliant electronic invoice under French regulation?
Not as-is. A PDF produced from an HTML template is a visual document, not a structured electronic invoice as defined by the reform (Factur-X, UBL, or CII formats sent through an accredited dematerialization platform). This workflow works very well for quotes, internal invoices, or B2C invoices, but compliant B2B e-invoicing additionally requires integration with a partner dematerialization platform (PDP).
How do you avoid gaps or duplicates in invoice numbering?
By storing a counter in an n8n Data Table or a Supabase table, incremented on every generation, and by forcing the workflow to run sequentially (concurrency setting set to 1) so two parallel executions never read the same number before it gets incremented. Unbroken sequential numbering is a legal requirement for invoices in France, not just a cosmetic detail.
Does this approach hold up at several hundred documents a day?
With a self-hosted Gotenberg instance (built on headless Chromium), yes: it's the same engine many billing services use internally, and it runs with no quota since it lives on your own infrastructure. SaaS APIs (PDFShift, APITemplate.io) are still easier to get started with, but they impose monthly quotas beyond which cost climbs fast.
Bundle FlowKit Complet
€269