Dynamic Invoice & Receipt PDF Generation
Generate pixel-perfect PDF invoices, receipts, and billing documents from HTML templates. Automate your financial document pipeline.
Overview
Billing documents need to be flawless. A misaligned column or broken currency symbol on an invoice erodes customer trust. Screenshotly lets you design invoices and receipts as HTML/CSS templates and convert them to pixel-perfect PDFs — no complex PDF libraries required.
Render your invoice template server-side with dynamic data (line items, taxes, totals, customer details), then pass the HTML to the Screenshotly API. The result is a production-ready PDF that matches your design exactly, complete with correct fonts, currency formatting, and page breaks.
SaaS billing systems use this to generate monthly subscription invoices at scale. E-commerce platforms produce order confirmations and packing slips. Freelancers and agencies automate recurring invoice generation. Support multi-currency, RTL text, and locale-specific number formatting using standard HTML and CSS.
Key Benefits
Results You Can Expect
How It Works
Create HTML/CSS invoice templates
Render templates with dynamic data
Host rendered HTML temporarily or use data URLs
Capture as PDF with Screenshotly
Deliver PDF to customers
Code Example
// Generate PDF invoice from HTML template
const generateInvoice = async (invoiceData) => {
// Render HTML template with data
const htmlContent = renderInvoiceTemplate(invoiceData);
// Capture as PDF
const pdfResponse = await fetch('https://api.screenshotly.app/screenshot', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
html: htmlContent, // Direct HTML input
format: 'pdf',
pdfOptions: {
pageSize: 'A4',
printBackground: true,
margin: { top: '20mm', bottom: '20mm' },
},
}),
});
return pdfResponse;
};Frequently Asked Questions
How does HTML-to-PDF generation compare to using wkhtmltopdf or Puppeteer?
Screenshotly handles browser rendering, fonts, and CSS support in the cloud — no need to install or maintain Puppeteer/Chromium on your server. The output matches what you see in a modern browser, unlike wkhtmltopdf which uses an older engine.
Can I customize PDF page margins and paper size?
Yes. Use CSS @page rules in your HTML template to set margins, paper size (A4, Letter), and orientation. The API's fullPage option captures the complete document, and the output respects your print-specific CSS.
How do I add page numbers and headers to PDF invoices?
Use CSS @page margin areas and position: fixed elements for headers/footers. The rendering engine supports CSS paged media features including page counters, running headers, and forced page breaks.
What's the best approach for generating invoices in multiple currencies?
Render each invoice as an HTML template with the correct currency symbol and formatting, then capture as PDF. Since you're using HTML, you have full control over locale-specific number formatting, RTL text, and font support.
Want a step-by-step walkthrough?
Read: Invoice & Report Generation Guide →Ready to automate invoices & pdfs?
Get started with 100 free screenshots. No credit card required.
Related Use Cases
Thumbnails
Generate thumbnail previews for link aggregators, directories, and bookmarking services. Create visual previews at any size.
Convert any web page or URL to a pixel-perfect PDF via API. Handles modern CSS, JavaScript rendering, and full-page capture.
Link Previews
Build link preview services for messaging apps, social platforms, and content aggregators. Generate rich previews for any URL.