npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-html2pdf

v0.1.2

Published

Convert HTML content or URLs to PDF with exact visual rendering

Downloads

52

Readme

n8n-nodes-html-to-pdf

Convert HTML content or URLs to PDF files with exact visual rendering in n8n.

Features

  • Convert HTML to PDF - Direct HTML content conversion
  • Convert URLs to PDF - Capture any webpage as PDF
  • Exact Visual Rendering - Preserves structure, styling, fonts, colors, images
  • Multiple Page Formats - A4, Letter, Legal, A3
  • Flexible Orientation - Portrait or landscape
  • Configurable Margins - Custom margins with units (px, mm, cm, in)
  • CSS Support - Print backgrounds, colors, and images
  • Scale Control - Adjust rendering size (0.1x to 2.0x)
  • 🎯 Perfect for: Emails, invoices, reports, archiving, documentation

Installation

Via n8n UI (Recommended)

  1. Go to Settings > Community Nodes
  2. Click Install
  3. Enter: n8n-nodes-html-to-pdf
  4. Click Install
  5. Restart n8n (required for nodes to load)

Via npm

cd ~/.n8n
npm install n8n-nodes-html-to-pdf
# Then restart n8n

Usage

Convert HTML Content to PDF

  1. Add "HTML to PDF" node to your workflow
  2. Select Source Type: "HTML Content"
  3. Paste your HTML in the HTML Content field
  4. Configure PDF options (format, orientation, etc.)
  5. Execute workflow
  6. Download PDF from output

Convert URL to PDF

  1. Add "HTML to PDF" node to your workflow
  2. Select Source Type: "URL"
  3. Enter the webpage URL
  4. Configure PDF options
  5. Execute workflow
  6. Download PDF from output

Configuration Options

| Option | Description | Default | |--------|-------------|---------| | Source Type | "HTML Content" or "URL" | HTML Content | | HTML Content | HTML code to convert | - | | URL | Webpage URL to convert | - | | PDF File Name | Output filename | document.pdf | | Page Format | A4, Letter, Legal, A3 | A4 | | Orientation | Portrait (false) or Landscape (true) | Portrait | | Print Background | Include CSS backgrounds/colors/images | ✅ Enabled | | Scale | Rendering scale (0.1-2.0) | 1.0 | | Margins | Top, Right, Bottom, Left (with units) | 0 |

Examples

Example 1: Convert HTML Email to PDF

<html>
  <body style="font-family: Arial; padding: 20px;">
    <h1 style="color: #2c3e50;">Invoice #12345</h1>
    <p>Date: 2025-01-15</p>
    <table style="width: 100%; border-collapse: collapse;">
      <tr style="background: #3498db; color: white;">
        <th>Item</th><th>Quantity</th><th>Price</th>
      </tr>
      <tr>
        <td>Product A</td><td>2</td><td>$50</td>
      </tr>
    </table>
  </body>
</html>

Result: Professional PDF invoice with exact styling preserved

Example 2: Webpage to PDF

Source Type: URL
URL: https://example.com/article
Format: A4
Orientation: Portrait
Print Background: ✅

Result: Complete PDF of webpage with all styles and images

Example 3: In n8n Workflow

[HTTP Request] → [HTML to PDF] → [Email] / [Google Drive] / [Dropbox]
     ↓                ↓              ↓
  Get HTML      Convert to PDF   Send/Save

Technical Details

  • Rendering Engine: Chromium (via html-pdf-node/Puppeteer)
  • Output Format: Binary PDF compatible with n8n
  • Package Size: ~300 MB (includes Chromium)
  • Processing: Server-side, private, no external API calls

Requirements

  • n8n: Version 0.220.0 or higher
  • Node.js: Version 20.15 or higher
  • Environment: Self-hosted n8n only (not n8n Cloud)

Use Cases

  • 📧 Email Archiving - Convert HTML emails to PDF
  • 🧾 Invoice Generation - HTML templates → PDF invoices
  • 📄 Report Creation - Web data → PDF reports
  • 📊 Dashboard Snapshots - Save dashboards as PDF
  • 📋 Web Archiving - Archive webpages as PDF documents
  • 🎨 Marketing Materials - Convert designs to PDF

Troubleshooting

Node Not Appearing

  1. Restart n8n completely (critical step)
  2. Clear browser cache
  3. Verify package name: n8n-nodes-html-to-pdf
  4. Check n8n logs for errors

PDF Output Issues

Blank PDF:

  • Enable Print Background option
  • Verify HTML content is valid
  • For URLs, check webpage is publicly accessible

Missing Fonts:

  • Use web-safe fonts (Arial, Times, etc.)
  • Include font files in HTML
  • Or use web fonts (Google Fonts)

Missing Images:

  • Use absolute URLs (not relative)
  • Or encode as base64 data URIs
  • Ensure images are publicly accessible

Installation Issues

Module not found after install:

  • Solution: Restart n8n (nodes load at startup)

Permission errors:

  • Use sudo npm install if needed
  • Or fix npm permissions

Development

Built using the n8n Custom Node Template

To build from source:

git clone https://github.com/yourusername/n8n-nodes-html-to-pdf.git
cd n8n-nodes-html-to-pdf
npm install
npm run build
npm link

Then link in n8n:

cd ~/.n8n/custom
npm link n8n-nodes-html-to-pdf

Support

License

MIT

Changelog

0.1.0 (2025-01-15)

  • Initial release
  • HTML to PDF conversion
  • URL to PDF conversion
  • Configurable page formats (A4, Letter, Legal, A3)
  • Portrait/landscape orientation
  • Custom margins
  • CSS background rendering
  • Scale control
  • Chromium-based rendering for exact visual fidelity