What This Workflow Does
This automation solves the common business challenge of converting HTML content into polished PDF documents. Many companies need to generate reports, invoices, contracts, or other documents from dynamic web content, but manual conversion processes are time-consuming and inconsistent.
The workflow leverages Gotenberg, an open-source document conversion service, to transform HTML strings into professional PDFs with proper formatting, margins, and styling. It's designed as a reusable component that can be integrated into larger automation systems for document generation.
How It Works
1. HTML Input
The workflow accepts HTML content as input, either from a previous step in your automation or directly through an API call. This could be a complete HTML document or just a fragment that needs PDF formatting.
2. PDF Conversion
The HTML content is sent to Gotenberg's API endpoint, which handles all the complex conversion work. Gotenberg uses Chrome's rendering engine to ensure accurate formatting and styling preservation.
3. PDF Delivery
The generated PDF file is returned and can be saved to cloud storage, attached to emails, or processed further in your automation system. The workflow includes error handling to manage conversion failures gracefully.
Pro tip: Use CSS print media queries in your HTML to optimize how content appears in the PDF version.
Who This Is For
This workflow is ideal for businesses that regularly generate documents from web content, including:
- E-commerce stores creating order invoices
- SaaS platforms generating customer reports
- Marketing teams producing whitepapers from blog content
- HR departments converting job postings to PDF applications
What You'll Need
- An n8n instance (self-hosted or cloud)
- Access to a Gotenberg server (self-hosted or cloud service)
- HTML content ready for conversion
- A destination for the PDF files (storage, email, etc.)
Quick Setup Guide
- Import the workflow template into your n8n instance
- Configure the Gotenberg connection with your API endpoint
- Set up your HTML input method (webhook, manual trigger, etc.)
- Define where the PDF should be saved or sent
- Test with sample HTML to verify formatting
Key Benefits
Consistent document formatting: Eliminates manual PDF conversion errors and ensures all documents follow the same professional styling.
Time savings: Automates what would otherwise be a manual copy-paste process, saving hours per week for document-heavy businesses.
Scalability: Process hundreds of PDF conversions simultaneously without additional effort.
Integration ready: Easily connects with other systems through n8n's extensive app integrations.