n8n PDF Generator: Create and Send PDFs Automatically in Your Workflows
A surprisingly common business requirement is sending the same type of document — an invoice, a contract, a report, a certificate — to different people with different data filled in. Doing this manually is tedious and error-prone. With n8n, you can automate the entire process: generate a personalized PDF, send it by email, save it to Google Drive, and log the record — all without touching a single file by hand.
In this guide we cover how to generate PDFs in n8n workflows, the different approaches available, practical examples for the most common use cases, and how to build a complete end-to-end PDF automation pipeline.
PDF Generation Approaches in n8n
n8n doesn’t have a single built-in “make a PDF” button — instead it gives you several flexible approaches depending on your source format and workflow requirements. The most common approaches are: generating a PDF from an HTML template using a tool like Puppeteer or an HTML-to-PDF API, using a dedicated PDF generation API (like PDFMonkey, DocRaptor, or PDF.co) via the HTTP Request node, or filling a PDF form template with dynamic data using a library or API that supports it.
Each approach has tradeoffs. HTML-to-PDF gives you full design control and works well if you’re comfortable with HTML/CSS. Dedicated API services are easier to set up and often produce higher-quality output with less configuration. PDF form filling is ideal when you already have a designed PDF template and just need to populate specific fields. For most n8n users, starting with an HTML template or a dedicated API service is the fastest path to a working pipeline.
Generating PDFs from HTML Templates
The HTML-to-PDF approach works by building an HTML document with your dynamic data injected, then converting it to PDF. In n8n, you construct the HTML string in a Code node or Edit Fields node using template literals and expressions — inserting values like customer name, invoice items, and totals directly into the HTML markup. The resulting HTML string is then passed to a conversion service.
For the conversion step, you can use an HTTP Request node to call a service like Browserless, Puppeteer (if self-hosted), or any HTML-to-PDF REST API. These services accept your HTML content and return a PDF binary that n8n captures and can immediately pass to email, storage, or any other node. This approach gives you pixel-perfect control over layout and styling since you write the HTML and CSS yourself.
Using PDF Generation APIs
Dedicated PDF generation services make the process even simpler by accepting a template and data, handling the rendering internally, and returning a ready-made PDF. Services like PDFMonkey, PDF.co, DocRaptor, and Carbone all work well with n8n via the HTTP Request node. The general pattern is: create a template in the service’s dashboard (usually with a drag-and-drop editor), then call their API with your dynamic data as JSON — the service merges the data into the template and returns the PDF.
This approach requires less coding but does introduce an external dependency and usually a per-document cost. For high volumes, evaluate pricing carefully. For moderate volumes (hundreds per month), these services are often the most cost-effective option because they eliminate the need to maintain your own PDF rendering infrastructure.
Sending PDFs via Email
Once you have a PDF as binary data in your workflow, sending it as an email attachment is straightforward. The Gmail node and the Send Email node both support binary attachments — connect the PDF-generating step to the email node, specify the binary property name in the attachment field, set the filename, and the email goes out with the PDF attached.
For personalized bulk sending — for example, sending invoices to 50 customers in a single workflow run — use a loop (Split In Batches node) to iterate through each customer, generate their personalized PDF, and send their individual email. Each iteration handles one customer’s data, so no PDF ever goes to the wrong recipient. Add a delay between iterations if needed to respect email provider rate limits.
Saving PDFs to Google Drive or Cloud Storage
After generating a PDF, saving it to cloud storage is a common next step — for record-keeping, sharing with clients, or archiving. The Google Drive node accepts binary data directly from the PDF generation step. Set the operation to Create (File), specify the parent folder ID where the PDF should land, set the filename (use dynamic values like the customer name or invoice number to make files easy to find later), and the Google Drive node uploads it immediately.
For organized archiving, combine the Date & Time node with the Google Drive node to automatically create dated folders — for example, saving all invoices from March 2026 into a “2026/03” folder structure. The Create Folder operation can create the folder if it doesn’t exist, and the Create File operation uploads the PDF into it. The entire save-and-organize step is two or three nodes.
A Complete PDF Automation Example
Here’s a full end-to-end workflow pattern. A Schedule Trigger fires on the first of each month. A database query node fetches all customers with active subscriptions. A Split In Batches node processes them one at a time. For each customer, an Edit Fields node assembles their invoice data — name, items, amounts, dates. A Code node builds the HTML invoice template with that data injected. An HTTP Request node calls a PDF conversion API and receives the PDF binary. A Google Drive node saves the PDF to the customer’s folder. A Gmail node sends the invoice to their email with the PDF attached. A database update node marks the invoice as sent.
The entire pipeline runs automatically every month without human intervention. Every customer gets their personalized invoice on time, every file lands in the right place, and the record is updated — all in one workflow. This is the kind of automation that saves hours of manual work every billing cycle.
