Invoice
A clean, minimal black & white invoice template ready for billing clients.
Accent color
Panel color
Black and white with grey panels by default. Both colors are template params, accentColor and panelColor, so one file works for every combination.
How to use
Render the template, then convert it to PDF
Download the prepared Handlebars template, render it with runtime params, and send the final HTML to the html2pdf.app API.
import { readFile, writeFile } from 'node:fs/promises';
import Handlebars from 'handlebars';
// Download the template from https://html2pdf.app/template-files/invoice.hbs
// and keep a copy next to your code, so our updates never change your PDFs.
const templateSource = await readFile('./templates/invoice.hbs', 'utf8');
const template = Handlebars.compile(templateSource);
const params = {
// Optional colors. Leave them out for black and white with grey panels.
// accentColor: '#1d4ed8',
// panelColor: '#edf1fc',
company: {
name: 'Acme Studio',
address: '123 Main Street, San Francisco, CA 94103',
},
customer: {
name: 'Globex Corporation',
address: '500 Market Street\nSan Francisco, CA 94105',
email: 'billing@globex.example',
},
invoice: {
number: 'INV-00042',
issueDate: '2026-06-09',
dueDate: '2026-07-09',
},
project: {
name: 'Brand and web delivery',
description: 'Design, development, and consulting services for the current billing period.',
},
items: [
{
description: 'Brand identity design',
quantity: 1,
unitPrice: '$2,400.00',
amount: '$2,400.00',
},
],
totals: {
subtotal: '$2,400.00',
tax: '$204.00',
total: '$2,604.00',
},
paymentTerms: 'Payment is due within 30 days.',
bankDetails: 'Acme Studio - Routing 021000021 - Account 000123456789',
notes: 'Thank you for your business.',
};
const html = template(params);
const response = await fetch('https://api.html2pdf.app/v1/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.HTML2PDF_API_KEY,
},
body: JSON.stringify({ html }),
});
if (!response.ok) {
throw new Error('PDF generation failed with status ' + response.status);
}
const pdf = Buffer.from(await response.arrayBuffer());
await writeFile('./invoice.pdf', pdf);