Convert HTML to PDF is a PDF4me action for Zapier that turns an HTML file into a print ready PDF. Paired with Generate Document, a five step Zap watches a Dropbox folder, merges order data into an HTML invoice template, converts the result to A4, and saves the finished PDF back to Dropbox.
Most "convert HTML to PDF" results hand you a box to drop a file into. That is fine once. It stops being fine when a new order lands every hour and somebody has to open the converter, upload, download, rename, and file the result. This walkthrough replaces that loop with five Zapier steps that run on their own, with real screenshots from a Zap that ran on 02 November 2026 and the exact field values it used.
Drop an order JSON into a watched Dropbox folder. Zapier picks it up within two minutes, pulls your HTML invoice template from a second folder, and hands both to PDF4me. Generate Document merges the data into the template, Convert HTML to PDF renders it at A4 with 40px margins, and Dropbox stores the result as Invoice-order-INV-2026-1042.pdf. Nobody opens a converter.
Why-Based Q&A
Why two PDF4me actions instead of one? Generate Document does the data merge and returns HTML. Convert HTML to PDF does the rendering and page setup. Splitting them means you can change the paper size or margins without touching the template, and you can reuse the same template for a different output format later.
Why fetch the template with a separate Find File step? The trigger only carries the file that just arrived, which is the order data. The template lives somewhere stable, so step 2 reads it from /DocGen/Templates on every run. Edit the template in Dropbox and the next invoice picks it up with no Zap change.
Why set Scale to 0.8? HTML is laid out for a screen, not a page. A scale of 0.8 pulls a typical invoice table inside the A4 content width so columns do not wrap awkwardly or spill onto a second page. Raise it toward 1.0 if your template is already narrow.
Why does Print Background matter? With Print Background set to False, browsers and renderers drop CSS background colours and images, so a coloured invoice header prints blank. Set it to True and the PDF matches what the HTML looks like on screen.
What You'll Get
Input: an order JSON dropped into a watched Dropbox folder, plus one HTML invoice template that stays put. Output: a finished A4 PDF in /DocGen/Output/, named from the order number, with a Dropbox sharing link returned by the final step.
What You Need
- Zapier. Open the PDF4me Zapier app. A free Zapier plan runs single step Zaps only, so this five step Zap needs a paid Zapier plan.
- PDF4me API key. Get your API key. Connect it the first time you add a PDF4me action.
- Dropbox with three folders: /DocGen/Orders for incoming data, /DocGen/Templates for the template, /DocGen/Output for results.
- An HTML invoice template and a sample order. Both are below.
Grab the samples first. Put invoice-template.html in /DocGen/Templates before you build the Zap, so step 2 has something to find when you test it.
The Flow at a Glance
- New File in Folder (Dropbox trigger, polls every 2 minutes).
- Find File (Dropbox) pulls invoice-template.html.
- Generate Document (PDF4me) merges the JSON into the HTML template.
- Convert HTML to PDF (PDF4me) renders A4 portrait at scale 0.8.
- Upload File (Dropbox) saves the PDF under a runtime name.
Complete flow overview

A successful run on 02 November 2026. Each step reports what it passed on, which is the fastest way to spot where a failed run stopped.
Step 1: How do you watch a Dropbox folder for new orders?
Flow so far: nothing yet, this is the trigger.
The trigger decides what starts the Zap. Point it at the folder your order data lands in, and make sure it carries the file contents forward.
- Add Dropbox as the trigger app and pick the New File in Folder event.
- Configure:
- Space:
Default - Folder:
/DocGen/Orders - Include files in subfolders?:
False - Include file contents?:
Yes - Include sharing link?:
No
- Space:
New File in Folder configuration

Include file contents has to be Yes. With No, step 3 receives a file reference with no data behind it and the merge fails.
Tip. The trigger polls on a schedule, shown as 2 min in the run history, so this is near real time rather than instant. Keep the output folder outside the watched folder or the saved PDF can retrigger the Zap.
Step 2: Why fetch the template before merging?
Flow so far: New File in Folder.
The trigger hands you the order data only. The template is a separate file in a separate folder, so you read it explicitly.
- Add Dropbox and pick the Find File action.
- Configure:
- Space:
Default - Folder:
/DocGen/Templates - Include files in subfolders?:
False - File Name:
invoice-template.html - Include Deleted Files?:
False - Include file contents?:
Yes - Include sharing link?:
No - Successful if no search results are found?:
False: step run status is "stopped: halted" - If multiple search results are found:
Return first search result
- Space:
Find File configuration

Leaving "Successful if no search results are found" on False is deliberate. A missing template halts the run instead of producing an empty PDF.
Step 3: How does Generate Document merge JSON into an HTML template?
Flow so far: New File in Folder plus Find File.
Generate Document takes two inputs: the template from step 2 and the data from step 1. It returns the merged HTML, not a PDF.
- Add PDF4me and pick the Generate Document action.
- Configure:
- Template File: the File output of step 2, Find File
- Template File Name:
invoice-template.html - Template File Type:
HTML - Input Data Format Type:
File - Data File: the File output of step 1, New File in Folder
- Input Data Type:
Json - Meta Data: leave empty
- Keep Pdf Editable:
False
Generate Document configuration

Template File Type is HTML and Input Data Type is Json. Those two dropdowns are the pair people most often mismatch, and a mismatch returns the template with the placeholders still in it.
Tip. If your data arrives as a Zapier field rather than a file, switch Input Data Format Type from File to the text option and paste the JSON in. The rest of the step is unchanged.
Step 4: How do you convert HTML to PDF without losing formatting?
Flow so far: New File in Folder plus Find File plus Generate Document.
This is the step the whole post is named after. It takes the merged HTML from step 3 and renders it, and the page setup fields here are what decide whether the result looks like the original.
- Add PDF4me and pick the Convert HTML to PDF action.
- Configure:
- File: the File Url output of step 3, Generate Document
- File Name:
invoice.html - Layout:
Portrait - Paper Size:
A4 (8.27in x 11.7in) - Scale:
0.8 - Margins:
40pxon each side - Print Background:
True
Convert HTML to PDF parameters
| Field | Value used | What it controls |
|---|---|---|
| File | File Url from step 3 | The merged HTML. Supply either File or File URL, not both. |
| File Name | invoice.html | Names the input for the renderer. The .html extension matters. |
| Index File Path | empty | Only used when the input is an archive with several HTML files. |
| Layout | Portrait | Portrait or Landscape. |
| Paper Size | A4 (8.27in x 11.7in) | Page dimensions of the output PDF. |
| Scale | 0.8 | Shrinks the rendered page so wide tables fit the content width. |
| Margins | 40px | Set per side. See the note below about the field labels. |
| Print Background | True | Keeps CSS background colours and images. False prints them blank. |

Scale 0.8 with 40px margins is a safe starting point for an invoice. Print Background True is what keeps the coloured header from printing blank.
Tip. In the current Zapier app the four margin fields read Top Margin, Bottom Margin, Left Margin and Bottom Margin. The fourth box is the right margin despite its label, so fill all four in the order they appear. Setting every side to the same value, as here, sidesteps the ambiguity entirely.
Step 5: Where does the finished PDF go?
Flow so far: New File in Folder plus Find File plus Generate Document plus Convert HTML to PDF.
The last step writes the PDF back to Dropbox and gives it a name you can trace to the order.
- Add Dropbox and pick the Upload File action.
- Configure:
- Space:
Default - Folder:
/DocGen/Output/ - File: the File Url output of step 4
- Overwrite:
True - Specify File Name: the literal text
Invoice-followed by the File Name field from step 1 - Specify File Extension:
pdf - Include sharing link?:
Yes
- Space:
Upload File configuration

Specify File Name mixes a literal prefix with a value from the trigger, so the output is Invoice-order-INV-2026-1042.pdf rather than a random identifier.
Run the Flow and Verify
- Publish the Zap.
- Drop a sample order JSON into /DocGen/Orders and wait for the next poll, up to two minutes.
- Open Zap runs in Zapier and confirm all five steps show a green tick.
- Look in /DocGen/Output/ for the new PDF and open it. The header should be coloured, the table should fit the page width, and the filename should carry the order number.
What did you actually build? A document factory. The template is editable by anyone with Dropbox access, the data arrives from whatever system writes the JSON, and the rendering settings live in one Zapier step. The same five step shape runs on Make, n8n and Power Automate with the same two PDF4me actions.
Common Variations You Can Add Without Rebuilding
Automated Zap versus a manual converter
| Zap vs manual | This Zap | A manual online converter |
|---|---|---|
| Who runs it | Nobody, it fires on file arrival | A person, once per file |
| Naming | Taken from the order data every time | Whatever the browser downloads |
| Page setup | Fixed in the Zap, identical on every run | Re-chosen by hand each time |
| Record | A Zap run history you can audit | None |
| Cost shape | Zapier plan plus PDF4me calls | Free per file, costly in minutes |
Common questions
How do I convert HTML to PDF?
Give an HTML file to a renderer and tell it the page setup. In this Zap, PDF4me's Convert HTML to PDF action takes the HTML produced by step 3, applies Portrait layout, A4 paper, scale 0.8 and 40px margins, and returns a PDF. The same action accepts a file you upload directly if you are not merging data first.
Can you convert HTML to PDF for free?
Converting one file by hand is free in plenty of places, including a browser's own Print to PDF. Automating it is where the cost sits, and it is two separate costs: a paid Zapier plan, because a five step Zap is not a single step Zap, and PDF4me API calls. For a handful of documents a month, manual conversion is genuinely cheaper. The arithmetic changes quickly once the volume is daily.
How do I convert HTML to PDF without losing formatting?
Three fields do most of the work. Set Print Background to True so CSS background colours and images survive. Lower Scale below 1.0, here 0.8, so a wide table fits inside the content width instead of wrapping. Match Paper Size to the region you print in, A4 or Letter. If a template still breaks across pages badly, add CSS page break rules to the HTML rather than fighting the renderer.
Can I batch convert HTML to PDF?
Yes, and this Zap already does it one file at a time, continuously, which is usually what people actually want from "batch". Every file dropped into /DocGen/Orders produces its own PDF. For a true batch of many files in one run, use Zapier's Looping action to iterate a list and call Convert HTML to PDF once per item.
Troubleshooting
Generate Document did not merge. Check that Input Data Type is Json and that the order file really is valid JSON. A trailing comma is enough to make the merge silently return the untouched template.
Print Background is set to False. Set it to True. This is the single most common formatting complaint with any HTML to PDF renderer, not just PDF4me. The underlying browser behaviour is documented by Mozilla under print-color-adjust.
Find File could not locate invoice-template.html in /DocGen/Templates. Check the spelling and that the file is in that exact folder, not a subfolder, since Include files in subfolders is False.
The output folder sits inside the watched folder, so each saved PDF counts as a new file. Keep /DocGen/Output outside /DocGen/Orders, as in this build.
Next Steps
The same five step pattern (watch a folder, fetch the template, merge, render, save with a runtime name) handles any "data in, branded document out" automation.
