Zapier doesn't have a built-in PDF generation action, but a Webhooks by Zapier step can call the HTML to PDF API in under 5 minutes. The resulting file can be attached to emails, uploaded to Google Drive, posted to Slack, or passed to any other Zapier action.
Webhooks by Zapier Action Settings
Add a "Webhooks by Zapier" action to your Zap:
Action Event: POST
URL: https://platform.htmltopdfapi.co/api/v1/pdf/generate
Payload Type: json
Data: html → your HTML (mapped from a previous step), paper_size → a4
Headers: Authorization → Bearer YOUR_API_KEY, Accept → application/pdf
The response body contains the PDF as binary data, available as a file in subsequent steps.
Using a Code Step for Dynamic HTML
If you need to build the HTML from Zapier data fields, use a Code step (JavaScript):
const html = `
<!DOCTYPE html>
<html>
<body style="font-family:sans-serif;padding:32px">
<h1>Invoice #${inputData.invoiceNumber}</h1>
<p>Customer: ${inputData.customerName}</p>
<p>Amount: ${inputData.amount}</p>
<p>Date: ${inputData.date}</p>
</body>
</html>
`
const res = await fetch('https://platform.htmltopdfapi.co/api/v1/pdf/generate', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.HTMLTOPDF_API_KEY,
'Content-Type': 'application/json',
'Accept': 'application/pdf',
},
body: JSON.stringify({ html, paper_size: 'a4' }),
})
const arrayBuffer = await res.arrayBuffer()
const base64 = Buffer.from(arrayBuffer).toString('base64')
return { pdf_base64: base64 }Common Zap Patterns
New Stripe payment → Generate invoice PDF → Email to customer via Gmail
New Typeform submission → Generate certificate PDF → Upload to Google Drive
New Airtable row → Generate report PDF → Post to Slack channel
WooCommerce order → Generate receipt PDF → Attach to order confirmation