Call pdf-mcp from a Zapier Zap with Webhooks by Zapier. The same setup works for invoices, reports, certificates, and other HTML-based documents.
What Zapier does
Zapier connects more than 5,000 apps without code. A Zap can call pdf-mcp to:
- 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
Before you start
- 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 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 the 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 settings
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 |
Configure the webhook
1. Add the 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 the URL
Enter the pdf-mcp API endpoint:
https://api.pdf-mcp.io/htmlToPdf3. Set the 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
Select Test step. A successful request returns the PDF data.
Dynamic HTML with Zapier fields
Use Zapier’s field mapping to create dynamic PDFs from your trigger data.
Form response example
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.
Payment invoice example
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}}.pdfZap examples
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
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 request and response details.
cURL examples
Test the API directly before configuring Zapier:
Basic HTML to PDF request
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.pdfStyled 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.pdfText 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.pdfMCP clients
For an MCP client, enter the hosted Streamable HTTP URL directly. There is no pdf-mcp package or local server to install. See the verified MCP client setup guide.
Handle the response
The Webhooks action returns the PDF as binary data. Map that output into the next action that needs the file.
Send by 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 a 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 can notify you about failures or route them through a separate path.
Common status codes
| Code | Description | Solution |
|---|---|---|
| 200 | Success | PDF generated successfully |
| 401 | Unauthorized | Check your API key in headers |
| 402 | Payment Required | Add credits to the account |
| 403 | Forbidden | Verify API key permissions |
| 400 | Bad Request | Check your request body format |
| 500 | Server Error | Review HTML syntax or contact support |
Set up error notifications
- Go to your Zap settings
- Enable Error notifications
- Choose to be notified by email when the Zap fails
Use paths for errors
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
Insufficient credits (402)
- 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
Implementation notes
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
Credit usage
- 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 an API key
- HTML to PDF: endpoint details
- API reference: all available endpoints
- MCP server: AI agent integration
- n8n integration: n8n setup
- Make integration: Integromat/Make setup
Credit usage
Zapier requests use the same credits as direct API requests:
- HTML to PDF: 1 credit for the first page, plus 0.01 per additional page
- Render template: 1 credit for the first page, plus 0.01 per additional page
- PDF to image: 1 credit for the first page, plus 0.01 per additional page
- AI template generation: 1 credit per successful message
- Other PDF utilities, including form operations and file search: 0.01 credits per request
- Direct file, template, asset, and theme management: free
The dashboard shows current usage.