Guides · webhook to PDF
Webhook to PDF: Why Not Just Zapier or n8n?
Searching for webhook to PDF usually lands you on a Zapier template or an n8n workflow — not a dedicated PDF API. That is fine for many teams. This guide explains what those recipes actually do, when they are the right tool, and when a single data + html HTTP call is simpler.
What Google shows first
Two common hits:
- Zapier: receive webhook → PDF.co → email — catch inbound data, generate a PDF report, send it by email.
- n8n: HTML → PDF via CustomJS, respond on the webhook — accept HTML on a webhook, convert with CustomJS, return the PDF binary.
Both are orchestration recipes. Zapier or n8n owns the glue; a separate PDF product (PDF.co, CustomJS, …) does the bytes. DocuHook sits in the second layer: merge JSON into an HTML template and return a PDF (or HTML) from one API call. You can still put Zapier or n8n in front of it when you need branching, CRM steps, or email — they are not mutually exclusive.
The Zapier path
Typical shape:
- Webhooks by Zapier catches a POST from Stripe, Typeform, your app, etc.
- A PDF.co (or similar) action turns fields or HTML into a PDF.
- Email by Zapier attaches the file.
Use Zapier when:
- A non-dev owns the flow and needs a visual builder
- The trigger is already a SaaS event Zapier supports well
- Volume is low and task cost is acceptable
- You care more about “email this PDF” than about embedding render in your own backend
Friction to budget for:
- Each step is a task (catch + convert + email = multiple billable tasks per event)
- Webhooks by Zapier often needs a paid Zapier plan
- Nested JSON (briefs, line items, decision makers) usually needs Formatter or Code steps before the PDF action
- Latency and retries are owned by Zapier’s runner, not your app’s SLOs
- Layout changes mean editing the Zap and whatever HTML/template the PDF step expects
Zapier is excellent glue. It is a weak substitute for a stateless render endpoint your code can call from a checkout handler or serverless function.
The n8n path
The CustomJS webhook workflow is clear:
- Webhook receives HTML
- CustomJS converts HTML → PDF
- Respond to Webhook returns the binary
Use n8n when:
- You already run n8n (self-hosted or Cloud) for other automations
- You need branches, filters, queues, or human-in-the-loop around the PDF
- You are fine owning HTML assembly in a Code node (common on Cloud when community PDF nodes are limited)
Friction to budget for:
- That template expects self-hosted n8n plus a CustomJS API key — Cloud setups often swap in HTTP Request + another HTML-to-PDF vendor
- You still pay (or self-host) for the PDF conversion layer
- Nested webhook JSON is not “PDF-ready”; someone has to walk objects into headings/lists first
- Respond-to-webhook holds the HTTP connection open for the full convert — awkward under bursts unless you redesign around async + poll/callback
n8n is a strong workflow engine. It does not remove the need for a PDF merge/print service; it routes traffic to one.
When a dedicated webhook → PDF API fits better
Prefer a single render API when any of these are true:
- Call from your own backend / SDK — Zapier mid-request is awkward; a Bearer
POSTis natural - Stateless
data+htmlper request — you stop rebuilding merge in Code/Formatter nodes - Sync PDF in one response — no multi-step race or polling for the happy path
- Webhook bursts — async
202+ job URLs so the sender is not held open - Same template everywhere — WooCommerce, Next.js, and a Zap share one contract
DocuHook’s contract is intentionally small:
POST https://docuhook.com/api/v1/render
Authorization: Bearer dh_…
Content-Type: application/json
{
"mode": "sync",
"data": { "invoice": { "number": "INV-1042" }, "customer": { "name": "Ada" } },
"html": "<h1>Invoice {{invoice.number}}</h1><p>{{customer.name}}</p>",
"filename": "invoice.pdf"
}→ 200 application/pdf
For SaaS outbound hooks that can only POST a body, the webhook alias is the same payload:
POST https://docuhook.com/api/v1/hooks/render
Authorization: Bearer dh_…Bursts: "mode": "async" (or Prefer: respond-async) → 202 with status_url / result_url so the sender is not held open while Dompdf runs.
Complementary, not either/or
A useful hybrid:
- Zapier or n8n catches the business event (new order, form submit, CRM stage change).
- One HTTP Request / Custom Request step posts
data+htmlto DocuHook. - The workflow emails Drive/Slack/Gmail with the returned file (or polls the async job).
You keep the visual orchestrator for routing. You keep a stable render API for documents. That is usually cheaper to maintain than rebuilding merge + print inside every Zap or Code node.
Decision checklist
- One-off “when X happens, email a PDF” and a non-dev owns it → start with Zapier’s webhook → PDF → email template.
- Already deep in n8n, need branches and an HTML body ready → use an HTML→PDF workflow (or HTTP Request to any converter on Cloud).
- Your app must merge nested JSON into a template and get a PDF back (checkout, WooCommerce, serverless, SDK) → call a render API directly; put Zapier/n8n only around the edges if you still want email/CRM steps.
The 3-line version
const dh = new DocuHookClient({ apiKey: process.env.DOCUHOOK_API_KEY });
const pdf = await dh.render(payload, templateHtml); // or format: 'pdf' via HTTP
// Attach pdf, store it, or return it from your webhook handlerTry the sandbox (no signup): docuhook.com · API key: register · full contract: docs.