Description
n8n-nodes-htmlcsstopdf

Get your api key from https://pdfmunk.com
For PDF Split/Merge and other powerful PDF features, try our new product PDFAPIHub
An n8n community node for creating PDFs from HTML/CSS or URLs, manipulating PDFs (merge/split/compress), securing PDFs (lock/unlock), and parsing PDFs to structured JSON — powered by the PDFMunk API.
Features
- PDF Creation
- PDF Manipulation
- PDF Security
- PDF Extraction & Parsing
– HTML to PDF: Render HTML + optional CSS into a PDF
– URL to PDF: Capture a website as a PDF (full-page support)
– Dynamic Params: Template placeholder replacement for HTML generation
– Viewport Control: Configure viewport width/height
– Flexible Output: Return a direct URL or a binary PDF file
– Output Filename: Set the resulting PDF filename
– Configurable Timeout: Increase timeouts for large/slow renders
– Merge PDFs: Merge 2–15 PDFs from URLs or multiple binary PDF inputs
– Split PDF: Extract specific pages, split each page, or split into chunks
– Compress PDF: Reduce file size with selectable compression levels
– Watermark PDF: Add text watermark with angle/opacity/font controls
– Convert PDF to Image: Convert selected pages to PNG/JPG/JPEG/WEBP
– Convert Image to PDF: Merge one or multiple images into a PDF
– Lock PDF: Add password protection (optionally provide input password for already-encrypted PDFs), via URL or file input
– Unlock PDF: Remove password protection, via URL or file input
– Parse PDF to JSON: Extract text/layout/tables/full extraction with page selection, via URL or file input
– Parse PDF with OCR: OCR parse scanned PDFs with language/PSM/OEM settings
Installation
Follow the installation guide in the n8n community nodes documentation.
Community Nodes (Recommended)
1. Go to Settings > Community Nodes in your n8n instance
2. Click Install a community node
3. Enter n8n-nodes-htmlcsstopdf
4. Click Install
Manual Installation
Navigate to your n8n installation directory
cd ~/.n8n/nodesInstall the package
npm install n8n-nodes-htmlcsstopdf
Docker
Add the package to your n8n Docker container:
FROM n8nio/n8n:latest
USER root
RUN npm install -g n8n-nodes-htmlcsstopdf
USER node
Getting Your PDFMunk API Key
1. Sign Up: Visit PDFMunk.com and create an account
2. Verify Email: Check your email and verify your account
3. Access Dashboard: Log in to your PDFMunk dashboard
4. Generate API Key:
– Navigate to the “API Keys” section
– Click “Generate New API Key”
– Copy your API key securely
5. Choose Plan: Select a plan based on your usage needs (see PDFMunk pricing for current limits).
Configuration
Setting Up Credentials
1. In n8n, go to Credentials
2. Click + Add Credential
3. Search for “HtmlCssToPdf API”
4. Enter your PDFMunk API key
5. Test the connection
6. Save the credential
Operations
The node exposes operations grouped by Resource.
PDF Creation
#### HTML to PDF
Generate a PDF from custom HTML and optional CSS.
Parameters:
html_content)css_content, optional)dynamic_params, optional key/value pairs for templating)viewPortWidth, viewPortHeight)output_format: url or file)output_filename, without .pdf)timeout, default: 300)#### URL to PDF
Generate a PDF from a website URL.
Parameters:
url)full_page, default: true)wait_till, milliseconds to wait before capture)viewPortWidth, viewPortHeight)output_format: url or file)output_filename, without .pdf)timeout, default: 300)PDF Manipulation
#### Merge PDFs
Merge multiple PDFs into one document.
Parameters:
mergeinputtype: url or file)pdf_urls, comma-separated; minimum 2, maximum 15; URL mode)mergefilebinary_properties, file mode)merge_output: url, file, or base64)#### Split PDF
Split or extract pages from a PDF.
Parameters:
splitinputtype: url or file)split_url, URL mode)splitfilebinary_property, file mode)split_mode) – pages: extract a page range/list via Page Range (pages)
– each: split each page into its own PDF
– chunks: split into Number of Chunks (chunks)
split_output: url, file, or base64)#### Compress PDF
Compress a PDF to reduce file size.
Parameters:
compressinputtype: url or file)compress_url, max 10MB, URL mode)compressfilebinary_property, file mode)compression: low, medium, high, max)compress_output: url, file, or base64)compressoutputname, e.g. compressed.pdf)#### Watermark PDF
Add text watermark to a PDF.
Parameters:
watermarkinputtype: url or file)watermarkfileurl, URL mode)watermarkfilebinary_property, file mode)watermarkoutputformat: file, url, base64, or both)watermark_text)watermark_opacity)watermark_angle)watermarkfontsize, optional)#### Convert PDF to Image
Convert one or more PDF pages to images.
Parameters:
convertpdfimageinputtype: url or file)convertpdfimage_url, URL mode)convertpdfimagefilebinary_property, file mode)convertpdfimage_page, used when Pages is empty)convertpdfimage_pages, e.g. 1-3 or 1,3,5)convertpdfimage_format: png, jpg, jpeg, webp)convertpdfimage_dpi)convertpdfimage_quality)convertpdfimage_output: url, base64, both, or file)#### Convert Image to PDF
Convert one or multiple image URLs into a PDF.
Parameters:
convertimagepdf_urls, comma-separated)convertimagepdf_output: url, base64, both, or file)convertimagepdf_filename)PDF Security
#### Lock PDF
Add password protection to a PDF.
Parameters:
lockinputtype: url or file)lock_url, max 10MB, URL mode)lockfilebinary_property, file mode)lock_password)lockinputpassword, optional)lock_output: url, file, or base64)lockoutputname, e.g. locked.pdf)#### Unlock PDF
Remove password protection from a PDF.
Parameters:
unlockinputtype: url or file)unlock_url, max 10MB, URL mode)unlockfilebinary_property, file mode)unlock_password)unlock_output: url, file, or base64)unlockoutputname, e.g. unlocked.pdf)PDF Extraction & Parsing
#### Parse PDF
Parse a PDF into structured JSON.
Parameters:
parseinputtype: url or file)parse_url, URL mode)parsefilebinary_property, file mode)parse_mode: text, layout, tables, full)parse_pages: all or ranges like 1-3)#### Parse PDF with OCR
Parse scanned PDFs using OCR.
Parameters:
parseinputtype: url or file)parse_url, URL mode)parsefilebinary_property, file mode)lang, e.g. eng or eng+hin)parse_pages: all or ranges like 1-3)dpi)psm)oem)Usage
Basic HTML to PDF Conversion
{
"operation": "htmlToPdf",
"html_content": "Hello World
This is a test document.
",
"css_content": "h1 { color: blue; } p { font-size: 14px; }",
"viewPortWidth": 1080,
"viewPortHeight": 720,
"output_format": "file",
"output_filename": "hello-world",
"timeout": 300
}
Advanced Usage Examples
#### 1. Invoice Generation
Invoice #12345
Total: $299.99
#### 2. Report Generation
Monthly Report
Metric Value
Sales $50,000
Growth 15%
#### 3. Certificate Generation
Certificate of Completion
This certifies that John Doe has completed the course.
Authorized Signature
PDF Manipulation Examples
#### Merge PDFs
{
"resource": "pdfManipulation",
"operation": "mergePdfs",
"mergeinputtype": "url",
"pdf_urls": "https://example.com/a.pdf, https://example.com/b.pdf",
"merge_output": "url"
}
#### Merge PDFs (File input)
{
"resource": "pdfManipulation",
"operation": "mergePdfs",
"mergeinputtype": "file",
"mergefilebinary_properties": "data1,data2",
"merge_output": "file"
}
#### Split PDF (extract pages)
{
"resource": "pdfManipulation",
"operation": "splitPdf",
"splitinputtype": "url",
"split_url": "https://example.com/document.pdf",
"split_mode": "pages",
"pages": "1-3",
"split_output": "url"
}
#### Compress PDF
{
"resource": "pdfManipulation",
"operation": "compressPdf",
"compressinputtype": "url",
"compress_url": "https://example.com/document.pdf",
"compression": "high",
"compress_output": "file",
"compressoutputname": "compressed.pdf"
}
#### Watermark PDF
{
"resource": "pdfManipulation",
"operation": "watermarkPdf",
"watermarkinputtype": "url",
"watermarkfileurl": "https://example.com/document.pdf",
"watermarkoutputformat": "file",
"watermark_text": "CONFIDENTIAL",
"watermark_opacity": 0.15,
"watermark_angle": 30
}
#### Convert PDF to Image
{
"resource": "pdfManipulation",
"operation": "convertPdfToImage",
"convertpdfimageinputtype": "url",
"convertpdfimage_url": "https://example.com/document.pdf",
"convertpdfimage_pages": "1-3",
"convertpdfimage_format": "png",
"convertpdfimage_output": "url"
}
#### Convert Image to PDF
{
"resource": "pdfManipulation",
"operation": "convertImageToPdf",
"convertimagepdf_urls": "https://example.com/a.png, https://example.com/b.jpg",
"convertimagepdf_output": "file",
"convertimagepdf_filename": "combined-images.pdf"
}
PDF Security Examples
#### Lock PDF
{
"resource": "pdfSecurity",
"operation": "lockPdf",
"lockinputtype": "url",
"lock_url": "https://example.com/document.pdf",
"lock_password": "your-password",
"lock_output": "file",
"lockoutputname": "locked.pdf"
}
#### Unlock PDF
{
"resource": "pdfSecurity",
"operation": "unlockPdf",
"unlockinputtype": "url",
"unlock_url": "https://example.com/locked.pdf",
"unlock_password": "your-password",
"unlock_output": "file",
"unlockoutputname": "unlocked.pdf"
}
PDF Parsing Example
#### Parse PDF to JSON
{
"resource": "pdfParsing",
"operation": "parsePdf",
"parseinputtype": "url",
"parse_url": "https://example.com/document.pdf",
"parse_mode": "full",
"parse_pages": "all"
}
#### Parse PDF with OCR
{
"resource": "pdfParsing",
"operation": "parsePdfOcr",
"parseinputtype": "url",
"parse_url": "https://example.com/scanned.pdf",
"lang": "eng",
"parse_pages": "all",
"dpi": 200,
"psm": 3,
"oem": 3
}
Use Cases
Business Applications
Content Management
Marketing & Sales
Workflow Examples
Example 1: E-commerce Invoice
{
"nodes": [
{
"name": "Order Webhook",
"type": "n8n-nodes-base.webhook"
},
{
"name": "Generate Invoice HTML",
"type": "n8n-nodes-base.function"
},
{
"name": "Convert to PDF",
"type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf"
},
{
"name": "Email PDF",
"type": "n8n-nodes-base.emailSend"
}
]
}
Example 2: Scheduled Reports
{
"nodes": [
{
"name": "Schedule Trigger",
"type": "n8n-nodes-base.cron"
},
{
"name": "Fetch Analytics Data",
"type": "n8n-nodes-base.httpRequest"
},
{
"name": "Build Report HTML",
"type": "n8n-nodes-base.function"
},
{
"name": "Generate PDF Report",
"type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf"
},
{
"name": "Save to Google Drive",
"type": "n8n-nodes-base.googleDrive"
}
]
}
Output
The node returns:
Error Handling
The node provides detailed error messages for common issues:
FAQ
Q: Is there a free tier?
A: PDFMunk may offer trial/free usage depending on current plans. Check the PDFMunk dashboard/pricing for the latest limits.
Q: What HTML features are supported?
A: Most modern HTML5 and CSS3 features are supported, including flexbox, grid, and media queries.
Q: Can I use external images?
A: Yes, images accessible via URL will be included in the PDF.
Q: What’s the maximum file size?
A: Some operations in this node expect PDFs up to 10MB (as indicated in the node parameters). Check PDFMunk documentation for current limits and plan-specific constraints.
Q: How do I generate large PDFs (100+ pages)?
A: Increase the timeout setting in the node configuration. For large PDFs, set timeout to 600-900 seconds (10-15 minutes).
Q: What should I do if I get a gateway timeout error?
A: Increase the timeout parameter in the node settings. The default is 300 seconds (5 minutes), but large PDFs may need 600-900 seconds.
Compatibility
Resources
PDF Creation
Support
For questions or support, please contact us at: support@pdfmunk.com
You can also join the n8n community forum for general n8n-related discussions.
Contributing
Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.
License
MIT License – see LICENSE.md file for details.
Changelog
v2.1.1
v2.0.2
v2.0.1
v2.0.0
—
Built with ❤️ for the n8n community