HTML to PDF
All nodes are only available on the hosted n8n version and require you to install CustomJS community package . See Installation .
The HTML to PDF node allows you to generate PDF files from HTML using n8n. Unlike raw text-based PDFs, using HTML and CSS allows for beautifully formatted documents, including tables, colors, and branding.
HTML to PDF node
The first step in your workflow is setting up a Webhook node that will receive incoming data (e.g., invoice details, reports, or dynamic content).
Open a n8n workflow and add a Webhook node. Set the method to POST to accept dynamic HTML data. Copy the Webhook URL to test sending requests. Webhook URL Add the HTML to PDF (customJS) node to the workflow. In the HTML Input field, insert your dynamic HTML content. Example:< h1 >Invoice</ h1 >
< p >Customer: {{ $json.customer }}</ p >
< p >Amount: ${{ $json.amount }}</ p >
Connect the output of HTML to PDF (customJS) to the Respond to Webhook node. Webhook Flow Configure it to return the generated binary PDF file . Test the webhook with a sample request to receive the PDF.
This workflow template:
Accepts HTML input via a POST request.
Converts HTML to PDF using CustomJS's PDF toolkit.
Sends the PDF back to the original webhook requester.
Use this template
n8n pdf nodeImagine you have an online store, and you need to generate invoices automatically whenever an order is placed. Here's how n8n can handle it:
The Webhook receives order details via API. The HTML template dynamically fills in the customer’s name, items, and total price. The HTML to PDF node converts this into a professional invoice. The PDF is returned or emailed to the customer.