This example shows how to generate a simple invoice PDF file from the HTML template using html2pdf.app API and NodeJS.
To separate code from the presentation we will use a template engine Handlebars.
The conversion result would look like fallowing:
- Register https://html2pdf.app/ and get a free api key.
- Set the
apiKeyvalue in the./src/generate-invoice.js. - Run
npm install. - Execute the script
node ./src/generate-invoice.js. - Check the generated result
./assets/invoice.pdf.
For more details check the conversion script ./src/generate-invoice.js.
