# n8n workflow template: HTML to PDF
Free n8n workflow templates that turn HTML into PDF. Import the JSON, add your API key, and email Shopify invoices, Tally answers or Sheets rows as PDFs.
**Quick answer.** Download one of the four JSON files below, import it into n8n with **Import from File**, create a Header Auth credential with your html-pdf.com key, and run it. Each template uses a plain **HTTP Request** node that posts your HTML to `https://html-pdf.com/v1/pdf`, so there is nothing to install.
## The four templates
Each file is a ready workflow with renamed nodes and sticky notes that explain every step. None of them contain secrets.
### 1. HTML to PDF (basic)
This is the smallest working example. A manual trigger feeds a **Set** node with an `html` field, and the **HTTP Request** node returns the PDF as a binary file in the `data` field. Use it to test your key, or as a starting block to paste into a bigger workflow.
[Download html-to-pdf-basic.json](https://html-pdf.com/static/n8n/html-to-pdf-basic.json)
### 2. Shopify paid order to PDF invoice
A **Shopify Trigger** fires on `orders/paid`. A **Code** node builds a styled invoice from the order, with line items, shipping, tax and totals. The **HTTP Request** node asks for a link with `"response": "url"`, and **Gmail** emails that link to the customer. The link is valid for 24 hours.
[Download shopify-order-invoice-pdf.json](https://html-pdf.com/static/n8n/shopify-order-invoice-pdf.json)
### 3. Google Sheets rows to PDFs in Google Drive
A **Schedule Trigger** runs every morning. **Google Sheets** reads your rows, a **Code** node turns each row into its own HTML page, the **HTTP Request** node returns each PDF as a file, and **Google Drive** uploads them. Rows with a value in a `pdf_done` column are skipped.
[Download google-sheets-row-to-pdf.json](https://html-pdf.com/static/n8n/google-sheets-row-to-pdf.json)
### 4. Tally form response to PDF
A **Webhook** node receives each Tally submission. A **Code** node lists every question and answer on a clean A4 page, and turns choice answers into their text. The **HTTP Request** node asks for a link, and **Gmail** sends it to the email the respondent entered. Setup details are in [Tally to PDF](https://html-pdf.com/tally-to-pdf).
[Download tally-form-to-pdf.json](https://html-pdf.com/static/n8n/tally-form-to-pdf.json)
## How to import a template
It takes about two minutes.
1. In n8n, create a new workflow.
2. Open the menu in the top right and choose **Import from File**, then pick the JSON. You can also choose **Import from URL** and paste the download link, or copy the file contents and paste them onto the canvas.
3. Go to **Credentials**, add a **Header Auth** credential, set the name to `Authorization` and the value to `Bearer hp_live_...`. [Get a free key](https://html-pdf.com/login) if you don't have one.
4. Open each node that shows a warning and pick your credential. The Shopify and Sheets templates also need Shopify, Gmail, Google Sheets or Google Drive credentials.
5. Click **Execute workflow** to test, then activate it.
## How the HTTP Request node is set up
All three templates use the same settings, so you can copy them into your own workflows.
- **Method** POST
- **URL** `https://html-pdf.com/v1/pdf`
- **Authentication** Generic credential type, then Header Auth
- **Send Body** on, with **Body Content Type** JSON and **Specify Body** Using JSON
- **JSON** an expression such as `{{ JSON.stringify({ html: $json.html, format: 'A4' }) }}`
- **Response Format** File, which puts the PDF in the `data` field
Using `JSON.stringify` matters. It escapes quotes and line breaks in your HTML, so the body is always valid JSON.
## How to customize the templates
Most changes happen in the JSON body or in the Code node.
- **Page size and margins.** Change `format` to `Letter` or `A5`, set `landscape: true`, or change `margin`.
- **A link instead of a file.** Add `response: 'url'` to the body and set the response format to JSON. The next node can read `{{ $json.url }}`, plus `pages` and `credits_remaining`.
- **A web page instead of HTML.** Send `url: 'https://example.com'` in place of `html`.
- **Headers, footers and page numbers.** Add `header_html` and `footer_html`. See [headers, footers and page numbers](https://html-pdf.com/pdf-headers-footers-page-numbers).
- **Your branding.** Edit the CSS and the `SHOP` block in the invoice Code node. Fonts, images and Tailwind all work, since the HTML is rendered in Chromium.
- **Attach the PDF in Gmail.** Keep the response format on File and add the `data` field under Gmail's attachment option.
- **A different trigger.** Swap the schedule for a Google Sheets Trigger on new rows, or use a Webhook node so other apps can request PDFs.
You can browse ready HTML designs in the [template gallery](https://html-pdf.com/templates) and paste them into the Set or Code node. The full step by step guide is in [HTML to PDF in n8n](https://html-pdf.com/guides/n8n), and every option is in the [API reference](https://html-pdf.com/docs).
## What it costs
One credit is one PDF page. You get 100 free credits once you confirm your email, with no card. After that, packs start at $10 for 1,000 credits, and purchased credits never expire. A one page invoice costs one credit, and failed renders cost nothing.
## FAQ
### Do I need a community node to make PDFs in n8n?
No. The templates use n8n's built-in HTTP Request node, so they work on n8n Cloud and self-hosted with nothing to install.
### Why does my PDF come out as JSON instead of a file?
The body probably includes `"response": "url"`, which returns a link. Remove it and set the response format to File to get the binary PDF.
### Can I attach the PDF to an email instead of sending a link?
Yes. Use the File response format, then add the `data` field as an attachment in the Gmail or Send Email node.
### Is it free to try?
Yes. You get 100 free credits once, with no card, and one credit is one PDF page.