Product

HTML to PDF API

Use this page when you already have HTML and need a production PDF. POST /v1/pdf with html. Real CSS, webfonts, and print options — no browser process on your machine. Office files go to POST /v1/convert; merging existing PDFs is POST /v1/pdf/merge.

Send html as a UTF-8 JSON string — not Base64. Optional filename, response mode, and Chromium print options.

Input

Send exactly one source field. For this route: html is the direct path.

  • `html` string body
  • Optional `filename` ending in .pdf
  • `response`: binary (default), url, or async
  • Optional `callbackUrl` for job completion

Controls

Set format, margins, page ranges, header/footer templates, and network wait behavior.

  • format: letter, legal, tabloid, ledger, a0-a6
  • waitUntil: load, domcontentloaded, networkidle0, networkidle2
  • timeout max: 60000ms

curl

Binary response writes straight to file.

POST /v1/pdf
curl https://api.relaypdf.com/v1/pdf \
  -H "Authorization: Bearer pdf_live_..." \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1>Invoice 1042</h1>","filename":"invoice.pdf"}' \
  --output invoice.pdf