1.0.3 • Published 6 years ago
node-html-to-pdf v1.0.3
Generate PDF's using HTML
Usage:
import PDF from 'html-to-pdf';
var pdf = new PDF({
templatePath: string,
data: {} // Data to parse into template
options: {
puppeteerPDFOptions: { path: './my.pdf' },
puppeteerLaunchOptions: { executablePath: '/usr/local/chromium' },
handlebarsCompileOptions: {}
}
});
var mypdf = pdf.build();For puppeteerPDFOptions see Puppeteer's Docs
For puppeteerLaunchOptions see Puppeteer's Docs
For handlebarsCompileOptions see Handlebars' Docs
Save PDF
To save the PDF define options.puppeteerPDFOptions.path. This will result in pdf.build() returning the same path.
Get PDF as Buffer
To get the PDF as a Buffer leave options.puppeteerPDFOptions.path blank. This will result in pdf.build() returning a Buffer.