Español

Lee este artículo en español.

How to convert HTML to PDF in Zapier (Webhooks)

If you automate with Zapier and need to generate a PDF inside a Zap (an invoice, a report, a ticket), it can be done. There's no native "HTML to PDF" step, but with Webhooks by Zapier and the Cofferdock API you can set up the call without coding.

One honest thing to know before you start: Zapier handles files returned by APIs less smoothly than tools like n8n or Make. It works, but if your flow will move lots of PDFs or you need to chain them easily, n8n or Make will make your life easier. Still, for simple cases Zapier gets the job done. Here's the straight story.

What you'll get

You send your document in HTML and the API returns the PDF. In Zapier the usual pattern is to receive it and pass it to the next step (for example, upload it to Google Drive or attach it to an email).

What you need

Step by step with Webhooks by Zapier

  1. In your Zap, add an action step and choose Webhooks by Zapier.
  2. In Event, choose Custom Request.
  3. Set up the request:

- Method: POST - URL: https://api.cofferdock.com/pdf?format=A4 - Data Pass-Through?: No - Data: paste your HTML (or bring it in from a previous step). - Headers: add x-api-key with your key, and Content-Type with the value text/html.

  1. Test the step and check what it returns.

The tricky part: the PDF coming back

This is where Zapier is more limited. The API can return the PDF in two ways, and in Zapier it pays to choose well:

If your destination app (Google Drive, for example) doesn't handle either one well, the easiest route is to do this part in n8n or Make, which hand back the file ready for the next step with no fuss.

Options you can tweak

Add them to the URL, after the ?, separated by &:

OptionDefaultWhat it does
formatA4Page size: A4, A3, A5, Letter, Legal or Tabloid.
landscapefalseSet it to true for landscape orientation.
margin0Margin in millimeters, the same on all four sides (0 to 100).
outputper modepdf forces the binary; json forces base64.

Prefer to see it in code?

The same call with curl, in case you want to try it before building it in Zapier:

curl -X POST "https://api.cofferdock.com/pdf?format=A4" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: text/html" \
  --data-binary "<h1 style='color:#8a5210'>Invoice #1234</h1>" \
  -o invoice.pdf

How much does it cost?

Each PDF spends 1 credit from your Cofferdock plan. All tools share the same pool of credits.

FAQ

Does Zapier have a native HTML to PDF step? No. You do it with Webhooks by Zapier (a paid feature) calling the Cofferdock API.

Why do you recommend n8n or Make for files like the PDF? Because they hand back the file ready for the next step, while in Zapier handling the returned file is more awkward.

Can I get the PDF as base64? Yes. Send the request in JSON mode (Content-Type: application/json) and the response will carry the PDF in the pdf field as base64.

Try it yourself

You'll find the full instructions, with copy-and-paste examples, on the HTML to PDF tool page. And if you don't have an account yet, you can create one for free and try it today.