Invoice PDF Generation
HTML Templates to Downloadable PDFs
Generate professional, branded invoice PDFs from HTML templates. Design your invoice with CSS, inject dynamic line items, and get a pixel-perfect A4 or Letter PDF back. No wkhtmltopdf, no Puppeteer, no server setup.
PDF generation shouldn't require DevOps
Self-hosting PDF generation means choosing between wkhtmltopdf (outdated WebKit engine, poor CSS support), Puppeteer/Playwright (full browser infrastructure to manage), or PDFKit/jsPDF (programmatic drawing, no HTML/CSS support).
SnapRender lets you design invoices with the tools you already know — HTML and CSS. Send your template to the API, get a PDF back. Modern CSS support, custom fonts, images — everything just works.
Generate invoices in any language
import requests
invoice_html = """
<html>
<head>
<style>
body { font-family: 'Helvetica', sans-serif; padding: 40px; color: #333; }
.header { display: flex; justify-content: space-between; margin-bottom: 40px; }
.logo { font-size: 24px; font-weight: bold; }
.invoice-info { text-align: right; color: #666; }
table { width: 100%; border-collapse: collapse; margin: 30px 0; }
th { background: #f5f5f5; text-align: left; padding: 12px; border-bottom: 2px solid #ddd; }
td { padding: 12px; border-bottom: 1px solid #eee; }
.total { text-align: right; font-size: 20px; font-weight: bold; margin-top: 20px; }
</style>
</head>
<body>
<div class="header">
<div class="logo">Acme Corp</div>
<div class="invoice-info">
<div>Invoice #INV-2026-0412</div>
<div>Date: April 12, 2026</div>
</div>
</div>
<table>
<tr><th>Item</th><th>Qty</th><th>Price</th><th>Total</th></tr>
<tr><td>Pro Plan (Monthly)</td><td>1</td><td>$49.00</td><td>$49.00</td></tr>
<tr><td>Additional Users (5)</td><td>5</td><td>$10.00</td><td>$50.00</td></tr>
</table>
<div class="total">Total: $99.00</div>
</body>
</html>
"""
resp = requests.post('https://api.snaprender.dev/v1/pdf',
headers={'Authorization': 'Bearer YOUR_KEY'},
json={
'html': invoice_html,
'format': 'A4',
'margin': {'top': '20mm', 'bottom': '20mm', 'left': '15mm', 'right': '15mm'}
})
with open('invoice.pdf', 'wb') as f:
f.write(resp.content)const res = await fetch('https://api.snaprender.dev/v1/pdf', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
html: invoiceHtml, // Your HTML template with injected data
format: 'A4',
margin: {
top: '20mm',
bottom: '20mm',
left: '15mm',
right: '15mm'
}
})
});
const pdfBuffer = Buffer.from(await res.arrayBuffer());
// Save to disk, upload to S3, or send as email attachment
fs.writeFileSync('invoice.pdf', pdfBuffer);Three steps to invoice PDFs
Design your invoice template
Create an HTML/CSS invoice template with your company branding, logo, and layout. Use CSS @page rules for margins, headers, and footers. Add placeholders for dynamic data.
Inject data and send to the API
Populate your template with invoice data — customer info, line items, totals, due dates. POST the complete HTML to /v1/pdf with your preferred paper size and margins.
Deliver the PDF
Save the PDF to storage, attach it to an email, or serve it as a download link. The PDF is print-ready with proper page breaks and formatting.
Simple pricing for invoice generation
Each PDF generation counts as one request. No per-page charges, no file size limits.
Frequently asked questions
You send an HTML invoice template to the /pdf endpoint with your dynamic data (line items, totals, customer info). SnapRender renders it in a headless browser and returns a downloadable PDF. You design the invoice with HTML/CSS — full control over layout, fonts, and branding.
Yes. Your HTML template can include any CSS, web fonts, your company logo, brand colors, and custom layouts. The PDF is rendered from a real browser, so it looks exactly like your HTML design.
SnapRender supports standard paper sizes including A4, Letter, Legal, and custom dimensions. You can set margins, orientation (portrait/landscape), and page breaks using CSS @page rules or API parameters.
Yes. Send parallel requests to the /pdf endpoint with different invoice data. SnapRender handles concurrent requests automatically. The $29/mo plan includes 5,000 requests — enough for most SaaS billing needs.
Typical generation time is 1-3 seconds per PDF. For time-sensitive workflows, you can pre-generate PDFs when invoices are created rather than on-demand when users click "download."
Almost always. Self-hosting wkhtmltopdf or Puppeteer for PDF generation requires server infrastructure ($20-200/mo), maintenance time, and debugging Chrome crashes. SnapRender starts at $9/mo with zero infrastructure.
Stop wrestling with PDF libraries.
HTML in, PDF out. Start free with 100 invoices/month. No credit card required.
Start Free — 100 requests/month