n8n community node to convert HTML and CSS to PDF using PdfMunk API - perfect for invoices, reports, certificates, and document generation
npm install n8n-nodes-htmlcsstopdfAn n8n community node for converting HTML content to PDF documents and capturing website screenshots as PDFs using the PDFMunk API.
- HTML to PDF: Convert custom HTML/CSS content to PDF documents
- Website to PDF: Capture full-page website screenshots as PDF files
- Flexible Output: Support for URL and File response formats
- Customizable Viewport: Configure viewport dimensions for optimal rendering
- Full Page Capture: Option to capture entire web pages or specific viewport areas
- Configurable Timeout: Adjust timeout settings for large PDF generation
Follow the installation guide in the n8n community nodes documentation.
1. Go to Settings > Community Nodes in your n8n instance
2. Click Install a community node
3. Enter n8n-nodes-htmlcsstopdf
4. Click Install
``bashNavigate to your n8n installation directory
cd ~/.n8n/nodes
$3
Add the package to your n8n Docker container:
`dockerfile
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:
- Free Tier: 100 conversions/month
- Starter: 1,000 conversions/month
- Professional: 10,000 conversions/month
- Enterprise: Custom limits
Configuration
$3
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
$3
Convert custom HTML and CSS content into PDF documents.Parameters:
- HTML Content: The HTML content to convert
- CSS Content: Optional CSS styling for the HTML
- Viewport Width: Viewport width in pixels (default: 1080)
- Viewport Height: Viewport height in pixels (default: 720)
- Output Format: Choose between URL or File output
- Timeout: Request timeout in seconds (default: 300 seconds = 5 minutes). Increase this for large PDFs.
Example Use Cases:
- Generate invoices from HTML templates
- Create reports with custom styling
- Convert rich text content to PDF documents
$3
Capture website screenshots and save them as PDF documents.Parameters:
- URL: The website URL to capture
- Full Page: Capture the entire page (default: true)
- Wait Time: Milliseconds to wait before capturing (default: 10000)
- Viewport Width: Viewport width in pixels (default: 1080)
- Viewport Height: Viewport height in pixels (default: 720)
- Output Format: Choose between URL or File output
- Timeout: Request timeout in seconds (default: 300 seconds = 5 minutes). Increase this for large PDFs.
Example Use Cases:
- Archive web pages as PDFs
- Generate website screenshots for documentation
- Create visual reports of web content
Usage
$3
`json
{
"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",
"timeout": 300
}
`$3
#### 1. Invoice Generation
`html
Invoice #12345
Total: $299.99
`#### 2. Report Generation
`html
Monthly Report
Metric Value
Sales $50,000
Growth 15%
`#### 3. Certificate Generation
`html
Certificate of Completion
This certifies that John Doe has completed the course.
Authorized Signature
`Use Cases
$3
- Invoice Generation: Automatically generate invoices from order data
- Report Creation: Convert analytics data into professional PDF reports
- Contract Generation: Create contracts from templates with dynamic data
- Certificate Issuance: Generate certificates for course completions
- Receipt Creation: Convert transaction data into PDF receipts$3
- Document Archival: Convert web pages to PDF for archival purposes
- Newsletter PDFs: Transform HTML newsletters into PDF format
- eBook Creation: Generate PDF books from HTML content
- Documentation: Convert online docs to downloadable PDFs$3
- Proposal Generation: Create branded proposals from CRM data
- Brochure Creation: Generate marketing materials dynamically
- Price Lists: Convert product catalogs to PDF format
- Quotation PDFs: Transform quotes into professional PDFsWorkflow Examples
$3
`json
{
"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"
}
]
}
`$3
`json
{
"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"
}
]
}
``The node returns:
- URL format: Direct link to the generated PDF
- File format: Binary PDF file data that can be saved or sent via email
The node provides detailed error messages for common issues:
- Invalid API Key: Check your PDFMunk credentials
- HTML Parse Error: Validate your HTML syntax
- CSS Error: Check your CSS for syntax errors
- Rate Limit: Upgrade your PDFMunk plan or wait for reset
- Network Error: Check your internet connection
- Timeout Error: Increase the timeout setting for large PDFs (default: 300 seconds)
Q: Is there a free tier?
A: Yes, PDFMunk offers 100 free conversions per month.
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: PDFs can be up to 10MB on most plans. Check PDFMunk documentation for current limits.
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.
- n8n version: 0.187.0+
- Node.js: 18.0.0+
- Supported formats: HTML, CSS, PDF
- n8n community nodes documentation
- PDFMunk API Documentation
- n8n workflow examples
For questions or support, please contact us at: support@pdfmunk.com
You can also join the n8n community forum for general n8n-related discussions.
Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.
MIT License - see LICENSE.md file for details.
---
Built with ❤️ for the n8n community