Note: This tutorial uses these specific tools for demonstration. You can swap them out for alternatives and customize the nodes to fit your needs.
Generate Secure PDFs for Contracts and Email Them Instantly
What You'll Have When Done: An automated system that generates personalized, password-protected contracts and emails them to clients — all without manual effort.
Prerequisites
Before you begin, make sure you have:
- A PDF.co API Key
- A Google Sheet with client data (Sample Here)
- A contract template PDF (Sample Here)
- An image of your signature (PNG/JPG format)
- An n8n instance (cloud or self-hosted)
- Google Sheets OAuth2 credentials added in n8n
- A Gmail app password (if you’re sending email via Gmail)
Quick Start Options
Option A: I Want It Working Now
- Import this workflow template → Download JSON File
- Connect your Google Sheets and PDF.co accounts
- Configure your contract template PDF and signature
- Set up Gmail SMTP credentials
- Test with sample data
- Activate and run
Option B: I Want to Build It Step-by-Step
Follow the 7-step guide below to create the automation from scratch:
What This Automation Does (Overview):
- Watches Google Sheets for new client contracts
- Populates a contract PDF with client data
- Adds a signature (optional)
- Secures the PDF with a password (client's email or chosen password)
- Emails the contract directly to the client
Step 1: Prepare Your Google Sheets
First, create a Google Sheets document to serve as your client database or download our sample.
Step 2: Prepare Your Contract Template and Signature
Create a PDF contract template with placeholders (e.g., {CLIENT_NAME}
, {CLIENT_EMAIL}
) or [use our sample].
Hosting Options: Upload your contract PDF and signature image to:
- PDF.co Built-in Storage, or
- Any public file host (Google Drive, AWS S3, etc).
Note: Your files must be publicly accessible via direct link) so PDF.co can process them. Private or restricted files will cause the automation to fail.
Step 3: Trigger on New Client
- Node: Google Sheets → Row Added
- Settings:
- Document:
YOUR_GOOGLE_SHEET
- Sheet:
SHEET_NAME
- Document:
Success Looks Like: Fires when a new client is added. The client data is returned as JSON for use in the workflow.
Step 4: Add Client Data in the Contract
- Node: PDF.co → Search and Replace Text
- Settings:
- PDF URL:
INSERT_PDF_TEMPLATE_LINK
- Add the Search Text and Replacement Text mappings e.g.,
{CLIENT_NAME}
→{{ $json.Name }}
{CLIENT_ADDRESS}
→{{ $json.Address }}
{CLIENT_EMAIL}
→{{ $json.Email }}
- Replacement Limit:
0
(replaces every match found in the PDF) - File Name:
{{ $json.Name }}_Service_Contract.pdf
- PDF URL:
Success Looks Like: A PDF is generated with all placeholders replaced by client’s actual data. The output URL points to the personalized contract.
Note: You can learn more about the PDF Search and Replace Text API at the API Docs.
Step 5: Sign the Contract
- Node: PDF.co → Add Text/Images to PDF
- Settings:
- Url:
{{ $json.url }}
(from previous node) - Images: Add your signature configuration:
- Image Url:
INSERT_IMAGE_LINK
- X Position: 102.46
- Y Position: 406.1
- Width: 160.86
- Height: 167.28
- Tip: Use the PDF Inspector tool to easily find and fine-tune the placement of text and images on your certificate.
- Import this sample project in the tool to explore how it works.
- Image Url:
- Url:
Success Looks Like: Your signature appears at the correct position in the contract PDF. The output URL points to the signed contract.
Note: You can learn more about the PDF Add Image at the API Docs.
Step 6: Add Password to PDF
- Node: PDF.co → PDF Security
- Settings:
- Mode: Add Security
- Url:
{{ $json.url }}
(from previous node) - Owner Password:
SET_YOUR_PASSWORD
- User Password:
SET_CLIENT_PASSWORD
Success Looks Like: The contract PDF now requires a password to open. The output URL points to the secured file.
Note: You can learn more about the PDF Security API at the API Docs.
Step 7: Send the Contract to the Client
- Node: HTTP Request
- Settings:
- Method: POST
- URL:
https://api.pdf.co/v1/email/send
- Headers:
x-api-key
: YOUR_PDF_CO_API_KEYContent-Type
: application/json
- Body Parameters:
- Url:
{{ $json.url }}
- from:
your-email@domain.com
- to:
{{ $('Google Sheets Trigger').item.json.Email }}
- subject:
{{ $json.name }}
- bodytext: "Please check the attached contract PDF. The password is your email address."
- smtpserver: smtp.gmail.com
- smtpport:
587
- smtpusername:
your-email@domain.com
- smtppassword: Create app password at https://myaccount.google.com/apppasswords
- Url:
Success Looks Like: The client receives an email with the contract PDF attached.
Note: You can learn more about the Send Email API at the API Docs.
Congrats! You've automated your scalable contract system that runs hands-free.
Built something cool? Share it with us @pdfdotco
Related Tutorials



