Quote
A professional sales quote template for proposals, with line items and validity period.
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/quote.hbs
// and keep a copy next to your code, so our updates never change your PDFs.
const templateSource = await readFile('./templates/quote.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: 'Northwind Digital',
address: '42 Market Street, San Francisco, CA',
},
quoteNumber: 'Q-2026-017',
validUntil: 'July 10, 2026',
customer: {
company: 'Globex Corporation',
contact: 'Dana Wright',
email: 'dana.wright@example.com',
},
projectDescription: 'Website redesign package.',
services: [
{ name: 'Discovery workshop', quantity: 1, rate: '$1,200', amount: '$1,200' },
],
subtotal: '$1,200',
tax: '$0',
total: '$1,200',
terms: 'Acceptance requires a 40% deposit.',
};
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('./quote.pdf', pdf);