Davix H2I allows you to convert HTML content into PDF documents using a simple API request.
This enables applications and workflows to generate documents such as invoices, reports, certificates, and other downloadable files automatically. HTML rendering into PDFs is one of the core capabilities of the platform and is executed by the H2I engine (PixLab). Successful /v1/h2i PDF requests return a signed output URL in the response.
Step 1: Prepare Your HTML #
Create the HTML layout you want to convert into a PDF.
Example HTML:
<div style="padding:40px;font-family:Arial,sans-serif">
<h1>Invoice #1001</h1>
<p>Customer: Example Client</p>
<p>Total: $199.00</p>
</div>
The public /v1/h2i endpoint accepts an html string as the required render input for PDF mode.
Step 2: Send the Request #
Use the public /v1/h2i endpoint and set action to pdf.
curl -sS -X POST "https://pixlab.davix.dev/v1/h2i" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Idempotency-Key: h2i-pdf-001" \
-H "Content-Type: application/json" \
-d '{
"action": "pdf",
"html": "<div style=\"padding:40px;font-family:Arial,sans-serif\"><h1>Invoice #1001</h1><p>Customer: Example Client</p><p>Total: $199.00</p></div>",
"css": "body{margin:0}",
"format": "A4"
}'
This is the correct full public pattern for an HTML-to-PDF request on /v1/h2i: JSON body, action=pdf, required html, optional css, optional PDF format control, and optional idempotency header.
Step 3: Receive the Result #
A successful request returns a 200 response with this shape:
{
"url": "https://pixlab.davix.dev/h2i/example-output.pdf?exp=EXPIRES_AT&sig=SIGNATURE",
"request_id": "REQUEST_ID"
}
The request lifecycle documentation confirms that successful file-producing requests return a signed output URL, and the broader platform documentation confirms that outputs may include rendered PDF documents.
Understanding the Result #
url #
The url field points to the generated PDF output. For /v1/h2i, successful file-producing requests build signed output URLs under the /h2i/* output path.
request_id #
The request_id field identifies the request and is useful for tracing and debugging. Public platform responses and health flows include request identifiers as part of the request lifecycle.
What Happens Behind the Scenes #
When you send this request:
- the API key is validated
- the request body is validated
- the
/v1/h2iroute passes the work to the H2I engine (PixLab) - the HTML is rendered as a PDF
- Davix H2I returns the signed output URL in the response.
Example Workflow #
A common HTML-to-PDF workflow looks like this:
- your system generates HTML from dynamic data
- it sends that HTML to Davix H2I
- Davix H2I renders the PDF
- your system receives the signed PDF URL
- your application stores, sends, or uses the document in its own workflow.
Common Use Cases #
HTML-to-PDF rendering is commonly used for:
- invoices
- reports
- certificates
- downloadable documents
- automated document generation.
Optional Next Steps #
The public /v1/h2i PDF flow supports the HTML-based request model used here and can be extended with additional render-related parameters described in the full API reference. For HTML rendering generally, Davix H2I also supports image output through the same /v1/h2i endpoint using action=image.
Summary #
To generate a PDF from HTML with Davix H2I:
- prepare your HTML
- send a
POSTrequest to/v1/h2i - set
actiontopdf - receive a signed output URL in the response.
All rendering is executed by the H2I engine (PixLab), which allows applications and workflows to generate PDF documents from HTML without managing their own rendering infrastructure.
