HTML to PDF in n8n

HTML to PDF in n8n

Convert HTML or URLs to PDF in n8n workflows with the HTTP Request node and the html-pdf.com API. You get a binary PDF file or a 24h download link.

Quick answer. Add an HTTP Request node with these settings and run it. You get back a PDF download link.

Get an API key

This step gives you a key. Get one by email at https://html-pdf.com/login, or with one call:

curl -X POST https://html-pdf.com/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

Then open the link we email you to confirm your address. That adds the 100 free credits. 1 credit = 1 PDF page, and no card is needed.

Connect

Here is the full node setup. Add an HTTP Request node:

{
  "html": "<h1>Order {{ $json.orderId }}</h1><p>Total: {{ $json.total }}</p>",
  "format": "A4",
  "margin": "15mm",
  "filename": "order.pdf"
}

Your HTML may come from an earlier node and contain quotes or line breaks. In that case, build the body with an expression so it is escaped correctly.

{{ JSON.stringify({ html: $json.html, format: "A4", margin: "15mm" }) }}

Get the PDF as a file: under Options → Response, set Response Format to File. The PDF lands in the item's binary property data, ready for Gmail, Google Drive, S3 or Slack nodes.

Or get a link: add "response": "url" to the body and keep Response Format as JSON. You get {"url": "...", "pages": 1, "credits_remaining": 99, ...}. The link is valid for 24 hours.

For a web page, send {"url": "https://example.com"} instead of html.

Try it

These two workflows show common ways to use the node.

Tips

These settings help with layout, cost and monitoring.

Troubleshooting

Most problems come from the response format or broken JSON.

FAQ

Is there a free HTML to PDF node for n8n?

You can use the built-in HTTP Request node with html-pdf.com. New accounts get 100 free credits once, with no card, and each credit is one PDF page.

How do I get the PDF as a binary file in n8n?

Under Options → Response, set Response Format to File. The PDF is stored in the binary property data, which you can attach in Gmail or upload to Google Drive or S3.

Can I convert a URL to PDF in n8n?

Yes. Send {"url": "https://example.com"} in the body instead of html. The page must be publicly reachable.

Do credits expire?

No. Purchased credits never expire, and failed renders cost nothing. Packs start at $10 for 1,000 credits.

Full reference: API docs · MCP server

This page as markdown · text