Automated Personalized PDF Generation and Email Delivery with n8n + PDF.co

Nov 13, 2025·6 Minutes Read

What You’ll Have When Done

You’ll build a fully automated system that:

  • Watches a Google Sheets sheet for new rows (e.g., new campaign data).
  • Dynamically generates a personalized PDF from an HTML template using PDF.co.
  • Automatically adds a company logo or image to the top of the PDF.
  • Sends the personalized PDF as an email attachment to each recipient in the sheet — all hands-free.

Prerequisites

Before starting, make sure you have:

  • A Google Sheet containing your campaign data (customer_name, customer_email, campaign_title, etc.)
  • A ready-to-use HTML template (with {{mustache_variables}} placeholders).
  • A PDF.co API Key https://app.pdf.co
  • A Google account connected to n8n
  • An SMTP email account (e.g., Gmail App Password)
  • An active n8n instance
  • A sample HTML Template you can test with.

Download Sample PDF (or use any of your own)

Quick Start Options

Option A: Import and Go

  • Import the provided workflow JSON file into your n8n instance.
  • Connect your Google Sheets and PDF.co accounts.
  • Update your SMTP email credentials.
  • Run a test — once a new row is added to your Google Sheet, your PDF gets generated and sent to the customer’s inbox.

Option B: Build It Step by Step

Follow the guide below to build the automation from scratch and understand each step.

What This Automation Does

Google Sheets TriggerPDF Generation from HTML TemplateAdd Logo to PDFSend Email with Attachment

Step-by-Step Guide

Step 1: Prepare Your Google Sheet

Google Sheet

Success looks like: Each new row in this sheet will trigger the workflow.

Step 2: Add Google Sheets Trigger Node

Node: Google Sheets Trigger

  • Trigger On: Row Added
  • Document: your sheet
  • Sheet Name: Sheet1

This node starts the workflow every time new data is added.

Success looks like: Adding a new row starts the workflow automatically.

Step 3: Generate PDF from HTML Template

Node: PDF.co → HTML to PDF

  • Operation: URL/HTML to PDF
  • Template ID: 16725 (from Template Manager)
  • Template Data:
{

"campaign_title": "{{ $json.campaign_title }}",

"campaign_subtitle": "{{ $json.campaign_subtitle }}",

"cta_text": "{{ $json.cta_text }}",

"cta_link": "{{ $json.cta_link }}",

"company_name": "{{ $json.company_name }}",

"customer_name": "{{ $json.customer_name }}"

}

💡 You can design the HTML template with spaces at the top to later insert your logo using the Add Image endpoint.

Success looks like: PDF.co returns a url of the newly generated PDF.

Step 4: Add Logo or Image to PDF

Node: PDF.co → Add Text/Images to PDF

  • URL: ={{ $json.url }} (from previous node)
  • Add Image:
{

"imageUrl": "filetoken://<your-uploaded-logo>",

"x": 0.96,

"y": 2.88,

"width": 252.38,

"height": 49.86

}

Success looks like: The logo appears at the top-left of the generated PDF.

Step 5: Send Email with PDF Attachment

Node: HTTP Request → PDF.co send Email endpoint

  • Method: POST
  • URL: https://api.pdf.co/v1/email/send
  • Headers:
    • x-api-key: Your PDF.co key
    • Content-Type: application/json
  • JSON Body:
{

"url": "{{ $json.url }}",

"from": "your_email@gmail.com",

"to": "{{ $('Google Sheets Trigger').item.json.customer_email }}",

"subject": "Check attached sample PDF",

"bodytext": "Hi {{ $('Google Sheets Trigger').item.json.customer_name }},\n\nPlease find your personalized campaign document attached.\n\nBest regards,\n{{ $('Google Sheets Trigger').item.json.company_name }} Marketing Team",

"bodyHtml": "<p>Hi {{ $('Google Sheets Trigger').item.json.customer_name }},</p><p>Please find your personalized campaign document attached.</p><p>Best regards,<br>{{ $('Google Sheets Trigger').item.json.company_name }} Marketing Team</p>",

"smtpserver": "smtp.gmail.com",

"smtpport": "587",

"smtpusername": "your_email@gmail.com",

"smtppassword": "<app_password>",

"async": false

}

Success looks like: The recipient receives an email with the personalized PDF as an attachment.

Step 6: Test Your Automation

  1. Add a new row to your Google Sheet.
  2. Wait a few seconds for n8n to detect it.
  3. Check the email inbox of the recipient.
  4. You should see the personalized PDF attached with your logo.

Success looks like: PDF generated → logo added → email sent.

Congratulations!

You’ve just built a hands-free, personalized PDF email automation using:

  • Google Sheets Trigger (Data source)
  • PDF.co HTML to PDF (Document generation)
  • PDF.co Add Image (Branding)
  • PDF.co Email Send (Distribution)

Built something amazing? Share your workflow and tag us @pdfdotco — we’d love to feature your automation!

Related Tutorials

See Related Tutorials