Send any HTML payload to our endpoint and receive a temporary link to download a pixel-perfect PDF — rendered by a real browser engine.
$50/mo — Subscribe →Renders HTML to PDF and returns a temporary download link (valid for 1 hour, single-use).
Streams the generated PDF. Link expires after 1 hour or upon first download.
| Header | Value |
|---|---|
Content-Type | application/json |
X-API-Key | Your API key (required if key is configured) |
| Field | Type | Description |
|---|---|---|
html |
string | Full HTML string to render. Max 5 MB. |
options.format |
string | Page format: A4, Letter, A3… Default: A4 (optional) |
options.landscape |
boolean | Landscape orientation. Default: false (optional) |
options.printBackground |
boolean | Render CSS backgrounds. Default: true (optional) |
options.margin |
object | { top, right, bottom, left } — CSS values. Default: 1cm each (optional) |
curl -X POST https://trilogicppp.com/api/html-to-pdf \
-H "Content-Type: application/json" \
-H "X-API-Key: your-key" \
-d '{
"html": "<!DOCTYPE html><html><body><h1>Hello PDF</h1></body></html>",
"options": {
"format": "A4",
"margin": { "top": "2cm", "bottom": "2cm", "left": "2cm", "right": "2cm" }
}
}'
{
"url": "https://trilogicppp.com/api/download/550e8400-e29b-41d4-a716-...",
"expires_at": "2026-02-28T14:30:00.000Z",
"token": "550e8400-e29b-41d4-a716-446655440000"
}
| Status | Meaning |
|---|---|
400 | Missing or invalid html field |
401 | Missing or invalid API key |
404 | Download token not found or expired |
413 | HTML payload exceeds 5 MB |
500 | Rendering failure — see detail field |
const res = await fetch('https://trilogicppp.com/api/html-to-pdf', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-key',
},
body: JSON.stringify({ html: '<h1>Hello</h1>' }),
});
const { url } = await res.json();
window.open(url); // opens PDF download
import requests
r = requests.post(
'https://trilogicppp.com/api/html-to-pdf',
headers={'X-API-Key': 'your-key'},
json={'html': '<h1>Hello</h1>', 'options': {'format': 'A4'}},
)
print(r.json()['url']) # temporary download link
$ch = curl_init('https://trilogicppp.com/api/html-to-pdf');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'X-API-Key: your-key'],
CURLOPT_POSTFIELDS => json_encode(['html' => '<h1>Hello</h1>']),
]);
$data = json_decode(curl_exec($ch), true);
echo $data['url'];