Convert HTML to PDF with an API

To convert HTML to PDF with DocKiln, submit self-contained HTML and inline CSS to the document API, poll the returned job ID, then download the completed file. DocKiln uses Chromium for HTML rendering and disables page scripts and external subresources.

Try HTML to PDF without an account

Open the HTML converter, paste a small HTML document with inline styles, and generate a sample PDF. Use fictional data in the public demo. For saved history and application integration, use a workspace API key and the API quickstart.

Submit HTML from your server

Set DOCKILN_URL to your instance URL and DOCKILN_API_KEY to a workspace key. Run this request from your backend or terminal:

curl --fail-with-body "$DOCKILN_URL/v1/documents" \
  -H "Authorization: Bearer $DOCKILN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: html-invoice-example-1" \
  -d '{"html":"<style>body{font:16px sans-serif}h1{color:#203c34}</style><h1>Invoice DK-104</h1><p>Example customer</p>","page":{"format":"A4","margin":16}}'

The API returns HTTP 202 with a job ID. Follow the polling and authenticated download steps in the quickstart. Use a new idempotency key when intentionally submitting a different document.

Will JavaScript and remote images work?

No. The renderer blocks scripts and external subresources. Build the final HTML on your server, inline its CSS, and embed supported image data. A URL request captures public HTML; it does not reproduce an interactive application after login or client-side JavaScript execution.

How do you handle long tables?

Use appropriate print CSS, repeat table headers, and test page breaks with a realistic long document. For repeated structured layouts, consider a published JSON template rendered by Typst. Read the pagination guide and compare Chromium and DocKiln.

Inspect a real output

Download the sample receipt PDF and compare it with the source example on the homepage. Check text selection, page size, embedded images and font appearance before integrating a production document.