Integrations
HTML to PDF in n8n without a backend
Key takeaways
- n8n can generate PDFs by posting HTML to a document API instead of running Chrome in your stack.
- Keep the template in n8n (or a CMS) and send the rendered HTML string in the request body.
- Use the HTTP Request node, then write the binary PDF to Drive, email, or the next step in the flow.
n8n can generate a PDF from HTML without you operating a browser farm. Post the finished HTML to Dokifly, receive a PDF, and pass that file to email, Drive, or the next node.
Why generate PDFs from n8n instead of a server?
Most PDF stacks assume a long-running process: Puppeteer, Playwright, or a queue worker watching HTML jobs. That is a backend. n8n already has the data, the template, and the destination. The missing piece is a render step that does not require you to keep Chrome online.
Dokifly is an HTML-to-PDF API built for that gap — n8n, Make, Bubble, FlutterFlow, and plain REST. You send HTML. You get a PDF.
What does the n8n workflow look like?
A minimal path is four nodes:
- Trigger — Webhook, schedule, or the app that already has the record (Stripe, Airtable, Typeform).
- Build HTML — a Set node, a Code node, or an HTTP request that returns a complete HTML document (styles inlined or linked to a public stylesheet).
- HTTP Request — POST the HTML to Dokifly. Use the endpoint, headers, and body shape from the Dokifly docs. Authenticate with the credentials you created in the product.
- Output — Gmail, Slack, Google Drive, or another HTTP Request. n8n should treat the response as a binary file so the next node receives a
.pdf.
Keep CSS simple and in the document. Remote fonts and images need publicly reachable URLs; the renderer cannot log into your private CDN.
How should I pass HTML in the HTTP Request node?
Use a complete document, not a fragment:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
body { font-family: sans-serif; color: #0a0a0a; }
</style>
</head>
<body>
<h1>Invoice {{ $('Trigger').item.json.number }}</h1>
<p>Amount due: {{ $('Trigger').item.json.total }}</p>
</body>
</html>
Resolve expressions in n8n so the string you POST is already filled in. Do not invent extra Dokifly fields — follow the current request format in the docs.
What should I do with the PDF after it returns?
Common next steps:
- Attach it to an email (receipt, contract, packing slip).
- Save it to Drive or S3 with a stable name like
invoice-1042.pdf. - POST it to another system that expects a file, not HTML.
If the run fails, inspect the HTTP status and response body in n8n. HTML that is not a full document, missing auth, or an unreachable image URL are the usual causes — not a missing “PDF server” on your side.
When is this the wrong tool?
If you need a pixel-perfect design system with private assets behind a VPN, render inside that network. If you need a no-code automation that turns HTML into a file and moves on, an HTTP Request node plus Dokifly is the whole backend.