@bsight/smart-pdf-generator
Smart PDF Generator
Installation
$ npm i smart-pdf-generator
Features
- Export beautiful Handlebars templates to PDF in one command
- Save PDF to file
Basic usage
const smartPDF = require("smart-pdf-generator");
let people = ["Arthur", "Julie", "Martin"];
let hbsTemplatePath = "./templates/people-list.handlebars";
const pdf = smartPDF.generatePDF(hbsTemplatePath, { people });
smartPDF.savePDFToFile(pdf, "./exports/myAwesomePDF.pdf");
It is also possible to use options
as a third argument of generatePDF
function where you pass
everything in a single object. The list of options is listed below.
Options
format
Format of the exported PDF, A4
by defaultprintBackground
Print images that are on the template background or not, true
by default