Package Information
Available Nodes
Documentation generating…
Documentation
n8n-nodes-document-to-pdf
An n8n community node that converts HTML, Markdown, and Word (DOCX) documents to PDF — fully self-contained, no external API or credentials required.
- HTML → PDF — full CSS fidelity via headless Chromium when available, with a pure-JavaScript fallback that needs no browser at all
- Markdown → PDF — GitHub-flavored Markdown, rendered with clean default document styling (override with custom CSS)
- Word (DOCX) → PDF — .docx converted via mammoth (headings, lists, tables, bold/italic, images), then rendered to PDF
Rendering engines
| Engine | Requires | Best for |
|---|---|---|
| Chromium (Puppeteer) | Chrome/Chromium installed locally, or a remote browser service (Steel, browserless) | Pixel-perfect output: full CSS, backgrounds, web fonts, page headers/footers |
| Pure JavaScript (pdfmake) | Nothing | Markdown, DOCX, and simple HTML on hosts without a browser (e.g. stock n8n Docker image) |
The default Auto mode uses Chromium when a browser is found (local install or a configured remote endpoint) and silently falls back to the pure-JavaScript engine otherwise — so the node works out of the box on an unmodified n8n Docker container.
Using a remote browser (Steel, browserless, …)
If you run a browser service next to n8n, set the Remote Browser WebSocket URL option (or the BROWSER_WS_ENDPOINT environment variable) to its CDP websocket endpoint and the node connects to it instead of launching a local browser — full Chromium fidelity with no changes to the n8n image, and it survives n8n updates. Example with Steel in the same docker-compose network:
services:
n8n:
image: docker.n8n.io/n8nio/n8n
environment:
- BROWSER_WS_ENDPOINT=ws://steel:3000
steel:
image: ghcr.io/steel-dev/steel-browser-api:latest
Use the compose service name as the host (ws://steel:3000), not localhost — inside the n8n container, localhost is the n8n container itself.
Pure-JavaScript engine limitations: no CSS stylesheets (semantic HTML + inline basics only), images must be data URIs, and the Custom CSS / Print Background / Scale / Page Ranges / header-footer options are ignored (page size, orientation, and margins are honored). Text uses embedded Roboto, covering Latin (incl. Turkish), Cyrillic, and Greek.
Installation
In n8n: Settings → Community Nodes → Install and enter:
n8n-nodes-document-to-pdf
Or on a self-hosted instance:
npm install n8n-nodes-document-to-pdf
Note: this package depends on Puppeteer, which downloads a Chromium build (~150 MB) on install. In Docker images you can skip the download and point the node at an existing Chrome/Chromium binary instead:
PUPPETEER_SKIP_DOWNLOAD=true npm install n8n-nodes-document-to-pdf export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser(Or set Chrome Executable Path in the node's options.)
Operations
| Operation | Input | Output |
|---|---|---|
| HTML to PDF | HTML as text (expressions supported) or a binary file | PDF in a binary field |
| Markdown to PDF | Markdown as text or a binary file | PDF in a binary field |
| Word (DOCX) to PDF | .docx file in a binary field |
PDF in a binary field |
Legacy binary .doc files (Word 97–2003) are not supported — convert them to .docx first.
Options
- Page Format (A3–A5, Letter, Legal, Ledger, Tabloid), Landscape, Margins, Scale, Page Ranges
- Print Background — render background colors/images (on by default)
- Header/Footer templates — Chromium print header/footer HTML with
pageNumber/totalPages/date/titlespans - Custom CSS — injected into the document before rendering (works for all three operations)
- Wait for Network Idle — wait for external images/fonts to load before rendering; turn off for faster conversion of self-contained documents
- Chrome Executable Path — use a system Chrome/Chromium instead of the bundled one (also honors
PUPPETEER_EXECUTABLE_PATH)
Example: Markdown report → PDF → email
- Build your Markdown in a Set or Code node (e.g.
{{ $json.report }}) - Document to PDF → operation Markdown to PDF, Markdown
{{ $json.report }} - Send Email → attach the
databinary field
Troubleshooting
"Could not find Chrome" on n8n Docker
The official n8n Docker image ships without a browser, and community-node installation skips Puppeteer's Chromium download (which wouldn't run on the Alpine-based image anyway). Install Chromium in the container:
docker exec -u root -it <n8n-container> apk add --no-cache chromium
Or bake it into a custom image so it survives container recreation:
FROM docker.n8n.io/n8nio/n8n
USER root
RUN apk add --no-cache chromium
USER node
From v0.1.1 the node finds system Chromium automatically (/usr/bin/chromium-browser, /usr/bin/chromium, google-chrome, etc.). You can always point it somewhere explicitly with the Chrome Executable Path option or PUPPETEER_EXECUTABLE_PATH.
Compatibility
- Requires Node.js ≥ 18.10
- Tested against n8n 1.x
- Works on self-hosted n8n (Docker, npm, desktop). n8n Cloud only allows verified community nodes, so this node is self-hosted only for now.