Description
n8n-nodes-wkhtmltopdf

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
Quick n8n installation
pnpm add n8n-nodes-wkhtmltopdf
—
✨ Features
– Base64
– Binary (n8n binary property)
– File path on disk
– Page size (A4, A3, A5, Letter, Legal)
– Orientation (Portrait / Landscape)
– Margins
– JavaScript execution
– Custom wkhtmltopdf options (CLI flags)
—
📦 Installation
As an n8n community node (pnpm)
From your n8n installation directory:
pnpm add n8n-nodes-wkhtmltopdf
n8n will automatically pick it up as a community node on restart (for recent versions with community nodes support enabled).
Local / custom nodes folder
If you manage custom nodes manually:
git clone https://github.com//n8n-nodes-wkhtmltopdf.git
cd n8n-nodes-wkhtmltopdf
pnpm install
pnpm build
Then 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.
---
🛠 wkhtmltopdf Requirement
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 |/usr/bin/wkhtmltopdf
| Linux | |/usr/local/bin/wkhtmltopdf
| macOS | |
You can also configure a custom path in the node options if your installation is elsewhere.
Install on macOS
brew install wkhtmltopdf
Install on Ubuntu/Debian
sudo apt-get update
sudo apt-get install wkhtmltopdf
Install on CentOS / RHEL / Fedora
sudo yum install wkhtmltopdf
or
sudo dnf install wkhtmltopdf
Install on Windows
Download and install from:
https://wkhtmltopdf.org/downloads.html
---
🐳 Using in Docker
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 wkhtmltopdf no longer works. The binary has to
> be copied in from a prebuilt source.
Local testing with docker compose
This repo includes a ready-to-run stack (docker-compose.yml + docker/) thatwkhtmltopdf
builds an n8n image with 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 server
Then open
HTML Content mode or HTML URL mode against http://web/ (the bundled
nginx sample page). After changing the node code:
pnpm build
REINSTALLWKHTMLTOPDFNODE=true docker compose up -d --force-recreate n8n
See docker/Dockerfile for how wkhtmltopdf is added (prebuiltsurnet/alpine-wkhtmltopdf
binary + its runtime libraries/fonts) — reuse that
pattern in your own image if you self-host n8n on the Alpine images.
---
🚀 Usage
1. In the n8n editor, search for “HTML to PDF (wkhtmltopdf)”.
2. Select Input Type:
* HTML Content → paste or map raw HTML
* URL → provide a web address
3. Choose Output Format:
* Base64 → returns a Base64 stringBinary
* → attaches PDF to an n8n binary propertyFile Path
* → write to disk in the container/host
4. Configure PDF options:
* Page size, orientation, margins
* Enable JavaScript
* Optional custom wkhtmltopdf flags
5. Execute the workflow and use the PDF in downstream nodes.
---
⚙️ Configuration Options
Input
Direct HTML string to convert.
URL of a webpage to convert. The node will pass the URL to wkhtmltopdf.
Output
Returns the PDF as a Base64-encoded string.
Exposes the PDF via a binary property (for use with other n8n nodes like Email, FTP, etc.).
Saves the PDF to the local filesystem. Useful in Docker with a mounted volume.
PDF Settings
, A3, A5, Letter, Legal, etc. / Landscape, Right, Bottom, Left.---
🐞 Troubleshooting
wkhtmltopdf: command not found
wkhtmltopdf is not installed or not in PATH.
Exit code 127 / 139 or blank PDF
Often due to missing system libraries or fonts. On Debian/Ubuntu, try:
apt-get install -y xfonts-base fontconfig libxrender1 libxext6
Also, for dynamic/JS-heavy pages:
—
🧩 Development
Clone and install:
git clone https://github.com//n8n-nodes-wkhtmltopdf.git
cd n8n-nodes-wkhtmltopdf
pnpm install
pnpm build
You can then symlink or mount the repo into your n8n custom nodes folder for live development.
—