An n8n community node for converting HTML or webpage URLs to PDF using wkhtmltopdf.
This package is a maintained fork of an original HTML → PDF node, with fixes and improvements for:
- Better error handling
- Improved compatibility (Linux, macOS, Windows, Docker)
- More configuration and output options
pnpm add n8n-nodes-wkhtmltopdf- Convert raw HTML to PDF
- Convert URL/webpage to PDF
- Output formats:
- Base64
- Binary (n8n binary property)
- File path on disk
- Configurable:
- Page size (A4, A3, A5, Letter, Legal)
- Orientation (Portrait / Landscape)
- Margins
- JavaScript execution
- Custom
wkhtmltopdfoptions (CLI flags)
- Supports self-hosted n8n (including Docker)
From your n8n installation directory:
pnpm add n8n-nodes-wkhtmltopdfn8n will automatically pick it up as a community node on restart (for recent versions with community nodes support enabled).
If you manage custom nodes manually:
git clone https://github.com/<your-user>/n8n-nodes-wkhtmltopdf.git
cd n8n-nodes-wkhtmltopdf
pnpm install
pnpm buildThen copy or mount this folder into your n8n custom nodes directory, for example:
~/.n8n/custom/n8n-nodes-wkhtmltopdf
Restart n8n and the node should appear in the editor.
This node requires wkhtmltopdf to be installed and reachable from n8n.
The node will try common default paths:
| OS | Default Path Checked |
|---|---|
| Windows | C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe |
| Linux | /usr/bin/wkhtmltopdf |
| macOS | /usr/local/bin/wkhtmltopdf |
You can also configure a custom path in the node options if your installation is elsewhere.
brew install wkhtmltopdfsudo apt-get update
sudo apt-get install wkhtmltopdfsudo yum install wkhtmltopdf
# or
sudo dnf install wkhtmltopdfDownload and install from: https://wkhtmltopdf.org/downloads.html
If you are running n8n in Docker, most images do not include wkhtmltopdf by default.
Note: n8n 2.x ships as an Alpine-based hardened image with no package manager, so
apt-get install wkhtmltopdfno longer works. The binary has to be copied in from a prebuilt source.
This repo includes a ready-to-run stack (docker-compose.yml + docker/) that
builds an n8n image with wkhtmltopdf baked in and auto-installs this node from
your local build:
pnpm build # produce dist/ on the host
docker compose up --build # build the image and start n8n + a sample web serverThen open http://localhost:5678, add an HTML to PDF node, and test either
HTML Content mode or HTML URL mode against http://web/ (the bundled
nginx sample page). After changing the node code:
pnpm build
REINSTALL_WKHTMLTOPDF_NODE=true docker compose up -d --force-recreate n8nSee docker/Dockerfile for how wkhtmltopdf is added (prebuilt
surnet/alpine-wkhtmltopdf binary + its runtime libraries/fonts) — reuse that
pattern in your own image if you self-host n8n on the Alpine images.
-
In the n8n editor, search for “HTML to PDF (wkhtmltopdf)”.
-
Select Input Type:
- HTML Content → paste or map raw HTML
- URL → provide a web address
-
Choose Output Format:
Base64→ returns a Base64 stringBinary→ attaches PDF to an n8n binary propertyFile Path→ write to disk in the container/host
-
Configure PDF options:
- Page size, orientation, margins
- Enable JavaScript
- Optional custom wkhtmltopdf flags
-
Execute the workflow and use the PDF in downstream nodes.
-
HTML Content Direct HTML string to convert.
-
HTML URL URL of a webpage to convert. The node will pass the URL to
wkhtmltopdf.
-
Base64 Returns the PDF as a Base64-encoded string.
-
Binary Exposes the PDF via a binary property (for use with other n8n nodes like Email, FTP, etc.).
-
File Path Saves the PDF to the local filesystem. Useful in Docker with a mounted volume.
- Page Size:
A4,A3,A5,Letter,Legal, etc. - Orientation:
Portrait/Landscape - Margins:
Top,Right,Bottom,Left - Enable JavaScript: Enable or disable JS execution for the page.
- Custom Options: Raw CLI flags passed directly to
wkhtmltopdf.
wkhtmltopdf is not installed or not in PATH.
- Check:
which wkhtmltopdf - Install it inside your host / container
- Configure a custom path in the node if required
Often due to missing system libraries or fonts. On Debian/Ubuntu, try:
apt-get install -y xfonts-base fontconfig libxrender1 libxext6Also, for dynamic/JS-heavy pages:
- Add
--javascript-delay 2000 - Add
--enable-local-file-accessif you load local resources
Clone and install:
git clone https://github.com/<your-user>/n8n-nodes-wkhtmltopdf.git
cd n8n-nodes-wkhtmltopdf
pnpm install
pnpm buildYou can then symlink or mount the repo into your n8n custom nodes folder for live development.