Generate pixel-perfect documents from raw HTML asPDFPNG
SnapHTML accepts HTML payloads, renders them in a browser context, and returns the final file as a binary response. Send one document per request and receive a PDF or PNG directly in the response body.
await fetch("https://api.snhtml.com/v1/render", {
method: "POST",
headers: {
"authorization": "Bearer sn_live_...",
"content-type": "application/json"
},
body: JSON.stringify({
html: "<main><h1>Invoice #1842</h1></main>",
format: "png",
width: 1024,
height: 900,
fullPage: false,
fileName: "invoice-1842"
})
});What you specify
The request describes the browser, the output, and the document.
Send raw HTML
Post the exact markup you already generate. Inline styles, external stylesheets, and Tailwind CSS classes can all render with it.
Choose PDF or PNG
Return a print-ready PDF for documents or a pixel-perfect PNG for previews, invoices, cards, and visual exports.
Set the viewport
Choose width, height, and full-page capture settings for each individual render.
API-first access
A small JSON request gives you one binary response. No SDK, browser automation, or rendering worker required.
Keep the integration small enough to remember.
The API is designed for server-side use from billing systems, CRMs, email pipelines, and screenshot workers. You control the HTML template and receive bytes ready to store, stream, or attach.
Create an API key.
POST HTML with render settings.
Read the response body as a PDF or PNG binary.
Request body
Every render option you can send.
htmlstringRequiredRaw HTML document to render.format"png" | "pdf"OptionalOutput format. Defaults to png.widthnumberOptionalViewport width in pixels. Defaults to 1024.heightnumberOptionalViewport height in pixels. Defaults to 768.fullPagebooleanOptionalCapture the full page for PNG output.deviceScaleFactornumberOptionalViewport scale factor from 1 to 4.waitUntil"load" | "domcontentloaded" | "networkidle"OptionalPage load state before rendering.waitForTimeoutnumberOptionalExtra wait in milliseconds before capture.media"screen" | "print"OptionalCSS media mode used during render.reducedMotion"reduce" | "no-preference"OptionalMotion preference used by the browser.transparentBackgroundbooleanOptionalUse a transparent PNG background.omitBackgroundbooleanOptionalAlias for transparent PNG background.printBackgroundbooleanOptionalInclude CSS backgrounds in PDF output.marginobjectOptionalPDF margins with top, right, bottom, and left strings.scalenumberOptionalPDF scale from 0.1 to 2.pdfFormatstringOptionalPDF paper format such as A4 or Letter.preferCSSPageSizebooleanOptionalUse CSS @page size for PDF output.fileNamestringOptionalAttachment filename without extension.Pricing
Start tiny, then pay for the render volume you actually need.
Starter
For low-volume automation and tests.
- 100 renders / month
- PNG and PDF output
- Direct binary response
Builder
For apps generating customer-facing documents.
- 2,000 renders / month
- PNG and PDF output
- Direct binary response
Pro
For production queues and higher throughput.
- 10,000 renders / month
- PNG and PDF output
- Direct binary response
Max
For larger production workloads.
- 50,000 renders / month
- PNG and PDF output
- Direct binary response