HTML to PDF API
for developers
Convert HTML or a URL into a pixel-perfect PDF with one REST call. Real Chromium rendering, page sizing, and auth — no browser or PDF library to run yourself.
One request, a PDF back
POST to /v1/pdf with your HTML and get raw PDF bytes.
cURL
curl -X POST https://api.rendershot.io/v1/pdf \
-H 'X-API-Key: sk_live_...' \
-H 'Content-Type: application/json' \
-d '{"html":"<h1>Invoice #123</h1>","format":"A4"}' \
--output invoice.pdfPython
import httpx
resp = httpx.post(
"https://api.rendershot.io/v1/pdf",
headers={"X-API-Key": "sk_live_..."},
json={"html": "<h1>Invoice #123</h1>", "format": "A4"},
)
open("invoice.pdf", "wb").write(resp.content)Node.js
import { writeFileSync } from "node:fs";
const res = await fetch("https://api.rendershot.io/v1/pdf", {
method: "POST",
headers: { "X-API-Key": "sk_live_...", "Content-Type": "application/json" },
body: JSON.stringify({ html: "<h1>Invoice #123</h1>", format: "A4" }),
});
writeFileSync("invoice.pdf", Buffer.from(await res.arrayBuffer()));What is an HTML to PDF API?
An HTML to PDF API turns markup into a PDF over a single HTTP request. Instead of installing a PDF library or running headless Chromium, you send HTML (or a URL) and get a finished document back.
Rendershot renders on real Chromium, so your CSS and JavaScript behave exactly as in a browser — the same reason a Python HTML-to-PDF tool that runs a real browser beats pure-Python libraries on fidelity. The difference here is there's nothing to host.
Built for real documents
HTML or URL input
Send a raw HTML string for templates you control, or a URL to render a live page.
Page format
A3, A4, Letter, or Legal — A4 by default — in portrait or landscape.
Custom margins
Set top, right, bottom, and left margins (default 1cm) to fit your layout.
Backgrounds printed
Background colors and images render by default, so branded templates look right.
Real Chromium rendering
Your CSS and JavaScript execute exactly as in a browser — web fonts, flexbox, charts, all of it.
Wait conditions
Hold the render until load, network idle, or a CSS selector appears, so dynamic pages finish.
AI cleanup
Strip cookie banners and popups before rendering for clean documents.
Authenticated pages
Pass headers, cookies, or basic auth to convert pages behind a login.
What developers build with it
Invoices & receipts
Render pixel-perfect invoices from an HTML template — no layout surprises.
Reports & statements
Turn data-driven HTML into styled PDF reports on demand or on a schedule.
Contracts & documents
Generate consistent, branded documents from your own markup.
Certificates & exports
Produce downloadable PDFs of generated content for users to keep.
Comparing HTML-to-PDF APIs?
See how Rendershot compares to the PDF-focused services — or convert a live URL instead of HTML.
HTML to PDF API FAQ
What is an HTML to PDF API?
An HTML to PDF API converts HTML (or a web page at a URL) into a PDF document over a single HTTP request, instead of running a headless browser or a PDF library yourself. You POST your HTML to Rendershot's /v1/pdf endpoint and get back PDF bytes rendered on real Chromium.
Can I send raw HTML, or only a URL?
Either. Send your markup in the "html" field to render a template that isn't hosted anywhere, or send a "url" to convert a live page. You provide one or the other, not both.
Does my CSS and JavaScript render?
Yes. Rendershot renders with real Chromium, so web fonts, modern CSS, and client-side JavaScript all execute — what you'd see in Chrome is what lands in the PDF.
Can I control page size, orientation, and margins?
Yes. Choose A3, A4, Letter, or Legal (A4 by default), portrait or landscape, and set custom top/right/bottom/left margins. Backgrounds are printed by default.
Is there a free HTML to PDF API tier?
Yes — Rendershot's free plan includes 200 renders per month with no credit card, covering both PDF generation and screenshots.
Start generating PDFs in minutes
Free plan includes 200 renders/month. No credit card required.
Start for free →