Tools API Blog
Sign in Create account

HTML to PDF

HTML to PDF is an API that turns an HTML design into a PDF document. You send your design and get the PDF back, ready to save, email or print. Great for generating invoices, reports, tickets or certificates automatically from n8n, Make or Zapier, with no servers to maintain.

How it works

This tool turns an HTML design (text describing how it should look, with its CSS, images and fonts) into a PDF. You send the design and it returns the PDF, ready to save, send or print.

It's made to be used from no-code platforms like n8n, Make or Zapier, without coding. Great for generating documents automatically: invoices, reports, tickets, certificates, etc. Nothing is stored: the PDF is generated on the fly. If what you have isn't HTML but the address of a web page, use URL to PDF.

All you need

  • Your API key (your “password” for the tool). Create it in your dashboard with “+ Create key”. It's shown only once, so copy and save it.
  • In your automation platform, an “HTTP Request” step (n8n, Make, Zapier, Pipedream… all have one).

How to use it in n8n (step by step)

You send your HTML as is and you get the PDF back directly, ready to use. In the HTTP Request node:

  • Method: POST
  • URL: https://api.cofferdock.com/pdf
  • Send Query Parameters: on, and add format = A4 (and whatever you want: landscape, margin… see the table).
  • Send Headers: on → add two: x-api-key = your key, and Content-Type = text/html
  • Send Body: on → Body Content Type: Raw → paste your HTML in Body (or connect it from a previous step)
  • Under Options → Response → Response Format: choose File

The node's output is already the PDF as a file: connect it straight to Drive, email, Telegram… One node and done.

In Make (HTTP → Make a request module): same method and URL, in Query String add format, in Headers the two headers, Body type: Raw, Content type: text/html, and paste your HTML into Request content. The response is already the PDF file.

In short: POST to …/pdf, format as a Query Parameter, the x-api-key and Content-Type: text/html headers, your HTML in Body as Raw, and Response Format as File.

Options (as Query Parameters)

Options you can add as Query Parameters (name/value fields in n8n/Make):

OptionDefaultWhat it does
formatA4Size: A4, A3, A5, Letter, Legal, Tabloid.
landscapefalseLandscape orientation. Set it to true.
margin0Margin in millimetres (0–100), same on all sides.
scale1Content scale (0.1–2).
print_backgroundtruePrint backgrounds/colors. Set false for white background.

Internet images and fonts: you can use photos, logos or fonts hosted online by putting their link (https://…) inside the HTML/CSS, and they'll load into the PDF. The design is rendered without running JavaScript, so use HTML and CSS.

What you get back

The PDF itself (a .pdf file), ready to save, email or print. Nothing to convert: the next step of your automation already receives the file. (In technical mode with JSON, the PDF comes in base64.)

If you get “busy” during a spike

At peak times, the API may reply “busy” (status 503) and ask you to wait a few seconds. It's rare and brief, but to let your automation handle it on its own, turn on retry on the request step:

  • In n8n: on the HTTP Request node, Settings tab, turn on “Retry On Fail”. 2–3 attempts is plenty.
  • In Make: add an error handler to the module (right-click → Add error handler) with the Break directive, which retries automatically.

Our response includes a Retry-After header telling how many seconds to wait. With retry on, your flow won't even notice.