Guide · n8n automation

How to generate PDFs in n8n

The money-event workflow — Stripe payment in, invoice out, email sent — always has the same gap in the middle: n8n cannot run headless Chromium, so the PDF step becomes a self-hosted converter or a brittle HTML hack. The Doclinth community node closes that gap with one node.

1. Install the community node

In n8n, open Settings → Community Nodes → Install and enter n8n-nodes-doclinth. Self-hosted n8n installs it today; n8n Cloud only offers verified community nodes, and this one is newly published — use self-hosted for now.

2. Connect your API key

Create a free account (50 documents a month, no card), then create a key under Dashboard → API keys. In n8n, add a Doclinth API credential and paste the key. The credential test lists your templates, so you know immediately that the connection works.

3. Pick or author a template

Start from the template gallery, or author one from the workflow itself with Template → Create From Prompt(“a consulting invoice with hourly line items and 8% tax”). Either way, a template is a draft until you publish it — editing never silently changes what production renders, so your next invoice cannot surprise you.

4. The workflow: payment in, invoice out

Three nodes: a Stripe trigger on payment_intent.succeeded, a Doclinth node (Document → Generate), and a Gmail node. In the Doclinth node, choose your template from the dropdown and map the event into the Data field:

{
  "invoice_number": "INV-{{ $json.id }}",
  "customer": { "name": "{{ $json.customer_name }}" },
  "items": [{ "description": "{{ $json.description }}", "amount": {{ $json.amount }} }],
  "total": {{ $json.amount }}
}

With Output: Binary File, the rendered PDF lands on the item as a binary field — attach it directly in the email node, no download step. Choose Signed URL instead when you want a 24-hour link to store or forward.

5. Options that matter once it runs unattended

Strict fails the run instead of rendering blanks when a field is missing from the data — and consumes no quota doing it. Validate Data checks the payload against the template’s typed contract before rendering. Idempotency Keymakes n8n’s retries safe: a repeated execution within 24 hours will not generate (or bill) a second document.

The render path is deterministic and never calls a model: the same template and data produce the same PDF, every execution. Before the workflow meets real customer data, stress-test the template— long names, 60-row tables, Unicode — so the layout breaks on our adversarial data instead of your customer’s invoice.

See the generate API reference →

Create a free account