Generate PDF reports from HTML templates or live URLs. Tables, charts, summaries, all rendered by a full browser engine on every request.
Start freeFor server-rendered reports, build the HTML yourself and POST it. For client-rendered reports (charts drawn with JavaScript), pass the URL and let the API render it with a full browser.
const html = buildReportHtml(reportData)
const res = await fetch('https://platform.htmltopdfapi.co/api/v1/pdf/generate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HTMLTOPDF_API_KEY}`,
'Content-Type': 'application/json',
Accept: 'application/pdf',
},
body: JSON.stringify({
html,
paper_size: 'a4',
orientation: 'landscape',
margin_top: 20,
margin_bottom: 20,
}),
})
const pdfBuffer = Buffer.from(await res.arrayBuffer())const res = await fetch('https://platform.htmltopdfapi.co/api/v1/pdf/generate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.HTMLTOPDF_API_KEY}`,
'Content-Type': 'application/json',
Accept: 'application/pdf',
},
body: JSON.stringify({
url: 'https://your-app.com/reports/monthly?token=preview_xyz',
paper_size: 'a4',
orientation: 'landscape',
wait_until: 'networkidle0',
}),
})
const pdfBuffer = Buffer.from(await res.arrayBuffer())200 pages/day on the free tier. No credit card required.
Get your free API key