A landscape certificate of achievement with border, seal, and signature lines.
Download the prepared Handlebars template, render it with runtime params, and send the final HTML to the html2pdf.app API.
import fs from 'fs';
import axios from 'axios';
import Handlebars from 'handlebars';
const templateSource = fs.readFileSync('./templates/certificate.hbs', 'utf8');
const template = Handlebars.compile(templateSource);
const params = {
certificateTitle: 'Certificate of Achievement',
heading: 'Presented To',
recipientName: 'Morgan Parker',
description: 'In recognition of successfully completing the program.',
year: '2026',
signatureLeft: 'Program Director',
issueDate: 'June 10, 2026',
};
const html = template(params);
const response = await axios.post(
'https://api.html2pdf.app/v1/generate',
{ html },
{
responseType: 'arraybuffer',
headers: {
'X-API-Key': process.env.HTML2PDF_API_KEY,
},
},
);
fs.writeFileSync('./certificate.pdf', response.data);