n8n-nodes-dante-pdf
v2.3.1
Published
n8n custom node for PDF conversion with support for Markdown, Text, DOCX, HTML, Image to PDF and PDF merging
Maintainers
Readme
n8n-nodes-dante-pdf
A powerful n8n custom node for PDF conversion with support for multiple formats. Convert Markdown, HTML, Text, DOCX, and Images to PDF with ease, or merge multiple PDFs into one.
🌟 Features
Multiple Format Support: Convert various formats to PDF
- 📝 Markdown to PDF - With theme support and Korean/CJK language support
- 🌐 HTML to PDF - Full browser rendering with Chrome/Chromium
- 📄 Text to PDF - Simple text conversion with formatting options
- 📑 DOCX to PDF - Microsoft Word document conversion
- 🖼️ Image to PDF - Convert images with layout options
- 🔄 PDF Merge - Combine multiple PDFs into one
Advanced Features:
- 🌍 Multi-language Support - Full support for Korean, Chinese, Japanese, and other languages
- 🎨 Theme Support - Multiple themes for Markdown (GitHub, Dark, Minimal)
- 📊 Custom Styling - CSS customization for HTML/Markdown
- 📄 Page Options - Headers, footers, page numbers
- ⚡ High Performance - Optimized with Chrome/Chromium for quality and speed
- 🔒 System Chrome Priority - Uses system Chrome/Chromium for better performance
📦 Installation
🐳 Docker Installation (Recommended for Production)
Quick Start with Docker Compose
- Create a
docker-compose.ymlfile:
version: '3.8'
services:
n8n:
image: docker.n8n.io/n8nio/n8n:latest
ports:
- 5678:5678
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=password
volumes:
- n8n_data:/home/node/.n8n
- ./custom-nodes:/home/node/.n8n/custom
command: >
sh -c "
apk add --no-cache chromium chromium-chromedriver ttf-liberation fontconfig &&
npm install n8n-nodes-dante-pdf &&
n8n start
"
volumes:
n8n_data:- Start the container:
docker-compose up -d- Access n8n at
http://localhost:5678
Using Dockerfile (Custom Image)
Create a Dockerfile:
FROM docker.n8n.io/n8nio/n8n:latest
USER root
# Install Chromium for web automation
RUN apk add --no-cache chromium chromium-chromedriver
# Install Firefox and all required dependencies for PDF generation
RUN apk add --no-cache \
firefox \
firefox-esr \
ttf-liberation \
fontconfig \
gcompat \
libstdc++ \
dbus \
dbus-x11 \
mesa-gl \
mesa-dri-gallium \
udev \
xvfb
# Install Playwright globally
RUN npm install -g playwright-core
# Create symbolic links for Playwright to find browsers
RUN ln -sf /usr/bin/firefox /usr/bin/firefox-stable && \
ln -sf /usr/bin/chromium-browser /usr/bin/chromium
# Set environment variables
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
ENV PLAYWRIGHT_BROWSERS_PATH=/usr/bin
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV PLAYWRIGHT_FIREFOX_EXECUTABLE_PATH=/usr/bin/firefox
USER node
# Install the PDF node
RUN npm install n8n-nodes-dante-pdf
# The package will automatically use system ChromiumBuild and run:
docker build -t n8n-with-pdf .
docker run -d -p 5678:5678 -v n8n_data:/home/node/.n8n n8n-with-pdf💻 Windows Installation
Prerequisites for Windows
Install Node.js (18+ recommended):
- Download from nodejs.org
- Choose the LTS version
Install Chrome or Chromium:
Option A - Google Chrome (Recommended):
Download from: https://www.google.com/chrome/Option B - Chromium:
Download from: https://www.chromium.org/getting-involved/download-chromium/
Install n8n globally:
npm install -g n8nInstall the PDF node:
cd %USERPROFILE%\.n8n\custom npm install n8n-nodes-dante-pdfVerify Chrome is detected:
# The package will automatically find Chrome at: # C:\Program Files\Google\Chrome\Application\chrome.exe # or # C:\Program Files (x86)\Google\Chrome\Application\chrome.exeStart n8n:
n8n start
Troubleshooting Windows
If Chrome is not detected:
# Set Chrome path explicitly (if needed)
set CHROME_PATH="C:\Program Files\Google\Chrome\Application\chrome.exe"
# Or install Playwright Chrome as fallback
cd %USERPROFILE%\.n8n\custom\node_modules\n8n-nodes-dante-pdf
npx playwright install chromium🍎 macOS Installation
Prerequisites for macOS
Install Node.js (18+ recommended):
# Using Homebrew brew install node # Or download from nodejs.orgInstall Chrome or Chromium:
Option A - Google Chrome (Recommended):
# Download from website open https://www.google.com/chrome/ # Or using Homebrew brew install --cask google-chromeOption B - Chromium:
brew install --cask chromium
Install n8n globally:
npm install -g n8nInstall the PDF node:
cd ~/.n8n/custom npm install n8n-nodes-dante-pdfVerify Chrome is detected:
# The package will automatically find Chrome at: # /Applications/Google Chrome.app/Contents/MacOS/Google Chrome # or # /Applications/Chromium.app/Contents/MacOS/ChromiumStart n8n:
n8n start
Troubleshooting macOS
If Chrome is not detected:
# Check if Chrome is installed
ls -la "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# Install Playwright Chrome as fallback (if needed)
cd ~/.n8n/custom/node_modules/n8n-nodes-dante-pdf
npx playwright install chromium🐧 Linux Installation (Ubuntu/Debian)
# Install Chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Or install Chromium
sudo apt-get install chromium-browser
# Install n8n and the PDF node
npm install -g n8n
cd ~/.n8n/custom
npm install n8n-nodes-dante-pdf
# Start n8n
n8n startManual Installation (Development)
# Clone the repository
git clone https://github.com/dante-pdf/n8n-nodes-dante-pdf.git
cd n8n-nodes-dante-pdf
# Install dependencies
npm install
# Build and link to n8n
npm run build
npm run link
# Start n8n
n8n start🚀 Browser Configuration
Priority Order
The package searches for browsers in this order:
System Chrome/Chromium (Recommended)
- Windows:
C:\Program Files\Google\Chrome\Application\chrome.exe - macOS:
/Applications/Google Chrome.app - Linux:
/usr/bin/chromiumor/usr/bin/google-chrome
- Windows:
Playwright Chrome (Fallback - not available on Alpine Linux)
- Automatically downloaded if system Chrome not found
- Not compatible with Alpine Linux (musl libc)
Verify Installation
After installation, verify the browser setup:
// In n8n, create a test workflow with DantePDF node
{
"operation": "convertToPdf",
"conversionType": "textToPdf",
"inputType": "text",
"textContent": "Test PDF Generation"
}🚀 Usage
Basic Workflow Example
- Add a DantePDF node to your workflow
- Select the operation: Convert to PDF
- Choose conversion type (e.g., Markdown to PDF)
- Configure options:
- Input source (text, file, or binary data)
- Format options (A4, Letter, etc.)
- Theme (for Markdown)
- Additional settings
Markdown to PDF
// Node configuration
{
"operation": "convertToPdf",
"conversionType": "markdownToPdf",
"inputType": "text",
"markdownContent": "# Hello World\n\nThis is **markdown** content.",
"markdownOptions": {
"format": "A4",
"theme": "github",
"displayHeaderFooter": true
}
}HTML to PDF
// Node configuration
{
"operation": "convertToPdf",
"conversionType": "htmlToPdf",
"inputType": "text",
"htmlContent": "<h1>Hello World</h1><p>HTML content</p>",
"htmlOptions": {
"format": "A4",
"printBackground": true,
"waitUntil": "networkidle"
}
}🎨 Markdown Themes
The node includes 4 built-in themes for Markdown conversion:
- Default - Clean and professional
- GitHub - GitHub-style markdown rendering
- Dark - Dark mode theme
- Minimal - Simple, typography-focused
🌏 Language Support
Full support for international languages including:
- 🇰🇷 Korean (한국어)
- 🇨🇳 Chinese (中文)
- 🇯🇵 Japanese (日本語)
- And many more...
The node automatically handles font embedding for proper rendering of all languages.
⚙️ Configuration Options
Common Options
format: Page size (A4, A3, A5, Letter, Legal, Tabloid)landscape: Landscape orientationdisplayHeaderFooter: Show header and footerscale: Scale of the webpage rendering (0.1 - 2)
Markdown Specific
theme: Visual themeprintBackground: Print background graphicspageRanges: Page ranges to print (e.g., '1-5, 8, 11-13')
HTML Specific
waitUntil: When to consider navigation succeededwaitFor: Wait for specific element or timeoutexecuteScript: JavaScript to execute before conversion
🛠️ Development
Prerequisites
- Node.js 18+
- n8n 1.0+
- TypeScript 5+
Setup
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Lint
npm run lint
# Format code
npm run formatProject Structure
n8n-nodes-dante-pdf/
├── src/
│ ├── nodes/ # n8n node definitions
│ ├── converters/ # Format converters
│ ├── utils/ # Utility functions
│ └── types.ts # TypeScript types
├── test/ # Test files
├── package.json
└── tsconfig.json🧪 Testing
# Run all tests
npm test
# Test specific converter
node test/test-markdown-converter.js
node test/test-html-converter.js
# Test with Korean content
node test/test-korean-converter.js🐛 Troubleshooting
Common Issues
Browser Not Found
- Windows: Ensure Chrome is installed in the default location or set
CHROME_PATHenvironment variable - macOS: Check if Chrome.app exists in Applications folder
- Linux: Install chromium-browser package
- Docker: Ensure Chromium is installed in the container
Alpine Linux / Docker Issues
- Must use system Chromium (Playwright browsers don't work with musl libc)
- Install required packages:
apk add chromium chromium-chromedriver ttf-liberation fontconfig
Font Issues
- Install additional fonts for better rendering
- Docker:
apk add font-noto font-noto-cjk - Ubuntu:
apt-get install fonts-noto fonts-noto-cjk - macOS: Fonts are usually pre-installed
📝 License
MIT
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
🐛 Known Issues
- Large files (>50MB) may cause memory issues
- Some complex CSS animations may not render in HTML to PDF
- Alpine Linux requires system Chromium (Playwright incompatible)
📮 Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📺 YouTube: Dante Labs
- 🎥 Tutorials: Check out our YouTube channel for tutorials and guides
🙏 Acknowledgments
- Built with Playwright for reliable PDF generation
- Uses marked for Markdown parsing
- Powered by pdf-lib for PDF manipulation
Made with ❤️ for the n8n community
