Integrate pdf-mcp with Zapier to automate PDF generation in your Zaps. This guide covers setting up Webhooks by Zapier to generate invoices, reports, certificates, and any HTML-based documents.
What is Zapier?
Zapier is a popular automation platform that connects 5,000+ apps without code. With pdf-mcp integration, you can:
- Generate PDFs when form responses are submitted
- Create invoices automatically from payment events
- Produce reports when spreadsheet rows are added
- Convert HTML templates to PDFs in any Zap
Prerequisites
Before you begin:
- A Zapier account (Free or paid plan)
- A pdf-mcp account with an API key (Get your API key)
- Basic familiarity with Zapier Zaps
Quick Setup
Step 1: Create a New Zap
- Log into zapier.com and click Create Zap
- Set up your trigger (the event that starts the Zap)
- Add an action step and search for Webhooks by Zapier
Step 2: Configure Webhook Action
- Select Webhooks by Zapier as your action app
- Choose POST as the action event
- Click Continue to configure the webhook
Step 3: Set Up the Request
Configure the webhook with these settings:
| Field | Value |
|---|---|
| URL | https://api.pdf-mcp.io/htmlToPdf |
| Payload Type | json |
| Data | Your HTML content (see below) |
| Headers | Authorization: Bearer YOUR_API_KEY |
| Headers | Content-Type: application/json |
Replace YOUR_API_KEY with your actual API key from the dashboard.
Webhook Configuration
Basic Settings
| Setting | Value |
|---|---|
| URL | https://api.pdf-mcp.io/htmlToPdf |
| Payload Type | json |
Headers
Add these headers to authenticate and specify content type:
| Header | Value |
|---|---|
| Authorization | Bearer YOUR_API_KEY |
| Content-Type | application/json |
Data Fields
Configure the JSON payload with these fields:
| Field | Value |
|---|---|
| html | Your HTML content or mapped field from trigger |
| filename | document.pdf or dynamic filename |
| css | Optional CSS styles |
Step-by-Step Webhook Setup
1. Add Webhook Action
After your trigger, click the + button and search for “Webhooks by Zapier”:
- Select Webhooks by Zapier
- Choose POST as the event
- Click Continue
2. Configure URL
Enter the pdf-mcp API endpoint:
https://api.pdf-mcp.io/htmlToPdf
3. Set Payload Type
Select json from the dropdown.
4. Add Data Fields
Add the required fields:
Field 1:
- Key:
html - Value: Your HTML content (can be static or dynamic from trigger)
Field 2 (optional):
- Key:
filename - Value:
document.pdf(or use dynamic data)
Field 3 (optional):
- Key:
css - Value:
@page { size: A4; margin: 2cm; }
5. Configure Headers
Add two headers:
Header 1:
- Key:
Authorization - Value:
Bearer YOUR_API_KEY
Header 2:
- Key:
Content-Type - Value:
application/json
6. Test the Webhook
Click Test step to generate a test PDF. If successful, you’ll see a response with the PDF data.
Dynamic HTML with Zapier Fields
Use Zapier’s field mapping to create dynamic PDFs from your trigger data.
Example: Form Response to PDF
If your trigger is a form submission (Google Forms, Typeform, etc.), map the fields:
Data field html:
<h1>Form Submission</h1>
<p><strong>Name:</strong> {{Name}}</p>
<p><strong>Email:</strong> {{Email}}</p>
<p><strong>Message:</strong> {{Message}}</p>
<p><em>Submitted on {{Date}}</em></p>
Replace {{Name}}, {{Email}}, etc. with the actual field mappings from your trigger by clicking in the value field and selecting from the dropdown.
Example: Invoice from Payment
If your trigger is Stripe or PayPal:
Data field html:
<!DOCTYPE html>
<html>
<head><title>Invoice</title></head>
<body>
<h1>Invoice #{{Invoice Number}}</h1>
<p>Customer: {{Customer Name}}</p>
<p>Email: {{Customer Email}}</p>
<table style="width:100%; border-collapse:collapse;">
<tr style="background:#f0f0f0;">
<th style="border:1px solid #ddd; padding:8px;">Description</th>
<th style="border:1px solid #ddd; padding:8px;">Amount</th>
</tr>
<tr>
<td style="border:1px solid #ddd; padding:8px;">{{Product Name}}</td>
<td style="border:1px solid #ddd; padding:8px;">${{Amount}}</td>
</tr>
</table>
<p><strong>Total: ${{Amount}}</strong></p>
</body>
</html>
Data field filename:
invoice-{{Invoice Number}}.pdf
Common Use Cases
1. Google Form to PDF Receipt
[Google Forms: New Response] → [Webhooks: POST to pdf-mcp] → [Gmail: Send Email with Attachment]
Trigger: Google Forms - New Form Response Action 1: Webhooks by Zapier - POST with form data as HTML Action 2: Gmail - Send Email, attach the PDF from webhook response
2. Stripe Payment to Invoice PDF
[Stripe: New Payment] → [Webhooks: POST to pdf-mcp] → [Dropbox: Upload File]
Trigger: Stripe - New Payment Action 1: Webhooks by Zapier - POST with invoice HTML Action 2: Dropbox - Upload File with PDF data
3. Google Sheets to Certificate
[Google Sheets: New Row] → [Webhooks: POST to pdf-mcp] → [Email: Send Certificate]
Trigger: Google Sheets - New Spreadsheet Row Action 1: Webhooks by Zapier - Generate certificate PDF Action 2: Send certificate via email
4. Airtable Record to Report
[Airtable: New Record] → [Webhooks: POST to pdf-mcp] → [Google Drive: Upload File]
Trigger: Airtable - New Record Action 1: Webhooks by Zapier - Generate report PDF Action 2: Google Drive - Upload to specific folder
All API Endpoints
Configure your webhook with these endpoints:
| Endpoint | Method | Description |
|---|---|---|
/htmlToPdf | POST | Convert HTML to PDF |
/textToPdf | POST | Convert plain text to PDF |
/imageToPdf | POST | Convert images to PDF |
/pdfToImage | POST | Convert PDF pages to images |
/extractText | POST | Extract text from PDF |
/extractPages | POST | Extract specific pages |
/mergePdfs | POST | Combine multiple PDFs |
/pageCount | POST | Get PDF page count |
See the API Reference for detailed documentation on each endpoint.
cURL Examples
Test the API directly before configuring Zapier:
Basic HTML to PDF
curl -X POST https://api.pdf-mcp.io/htmlToPdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<h1>Hello, World!</h1><p>Generated from Zapier workflow.</p>"
}' \
--output document.pdf
Styled Invoice
curl -X POST https://api.pdf-mcp.io/htmlToPdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<!DOCTYPE html><html><head><title>Invoice</title></head><body><h1>Invoice #12345</h1><table><tr><th>Item</th><th>Amount</th></tr><tr><td>Service Fee</td><td>$99.00</td></tr></table><p>Total: $99.00</p></body></html>",
"css": "@page { size: A4; margin: 2cm; } body { font-family: Arial, sans-serif; } table { width: 100%; border-collapse: collapse; } th, td { border: 1px solid #ddd; padding: 8px; }",
"filename": "invoice-12345.pdf"
}' \
--output invoice-12345.pdf
Text to PDF
curl -X POST https://api.pdf-mcp.io/textToPdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Meeting Notes\n\nDate: January 15, 2025\n\n1. Project status review\n2. Timeline discussion\n3. Next steps",
"filename": "meeting-notes.pdf"
}' \
--output meeting-notes.pdf
MCP Integration
Using AI Agents? MCPs (Model Context Protocols) provide plug-and-play connectivity with pdf-mcp. AI agents like Claude can generate PDFs natively using our MCP Server without any HTTP configuration.
Handling the Response
Zapier’s Webhooks action returns the PDF as binary data. Here’s how to work with it in subsequent steps:
Send via Email
Use Gmail, Outlook, or SMTP actions to send the PDF as an attachment:
- Add an email action after the webhook
- In the attachment field, select the response body from the webhook step
- Set the attachment filename (e.g.,
document.pdf)
Upload to Cloud Storage
Use Google Drive, Dropbox, or OneDrive actions:
- Add a file upload action after the webhook
- Map the webhook response body to the file content
- Specify the destination folder and filename
Save to CRM
Some CRMs (Salesforce, HubSpot) accept file attachments:
- Use the CRM’s “Add Attachment” or “Upload File” action
- Map the PDF data from the webhook response
Error Handling
Zapier provides built-in error handling. Configure your Zap to handle failures:
Common Status Codes
| Code | Description | Solution |
|---|---|---|
| 200 | Success | PDF generated successfully |
| 401 | Unauthorized | Check your API key in headers |
| 403 | Forbidden | Verify API key permissions or credit balance |
| 400 | Bad Request | Check your request body format |
| 500 | Server Error | Review HTML syntax or contact support |
Setting Up Error Notifications
- Go to your Zap settings
- Enable Error notifications
- Choose to be notified by email when the Zap fails
Using Paths for Error Handling
Add a Paths action after the webhook to handle success/failure differently:
[Webhook] → [Paths]
├── Path A: Status = 200 → [Continue with PDF]
└── Path B: Status != 200 → [Send Alert Email]
Troubleshooting
PDF is empty or not generated
- Verify your API key is correct and has credits
- Check that the
htmlfield contains valid HTML - Ensure headers are correctly formatted
- Test with a simple HTML string first
Authentication errors (401/403)
- Check the Authorization header format:
Bearer YOUR_API_KEY - Ensure there’s a space between “Bearer” and your key
- Verify your API key hasn’t been revoked
- Check your credit balance in the dashboard
Webhook timeout
- Large or complex HTML may take longer to process
- Simplify your HTML template
- Use inline styles instead of external resources
Data mapping issues
- Click into the field value to see available mappings
- Use Zapier’s Formatter action to prepare data
- Test each step individually before running the full Zap
Binary data not recognized
- Some downstream actions may not accept binary data directly
- Use a Code step to base64 encode if needed
- Check the specific app’s documentation for file upload requirements
Tips and Best Practices
Performance
- Keep HTML simple for faster generation
- Use inline CSS instead of external stylesheets
- Avoid large images - use compressed versions
Reliability
- Test your Zap thoroughly before turning it on
- Use Zapier’s built-in error notifications
- Monitor your API credit balance
Security
- Never share your API key publicly
- Use Zapier’s secure storage for sensitive data
- Review your Zap’s data exposure
Cost Optimization
- Batch similar operations when possible
- Use filters to only generate PDFs when necessary
- Monitor your credit usage in the dashboard
Related Documentation
- Quick Start - Get your API key
- HTML to PDF - Detailed endpoint documentation
- API Reference - All available endpoints
- MCP Server - AI agent integration
- n8n Integration - Alternative automation platform
- Make Integration - Integromat/Make setup
Credit Usage
API calls from Zapier workflows use the same credit system as direct API calls:
- PDF generation: ~1 credit per page
- Text extraction: ~1 credit per page processed
- Page count: ~0.1 credits per request
Monitor your usage in the dashboard.