Skip to content

Instantly share code, notes, and snippets.

@mayank
Created March 10, 2021 18:28
Show Gist options
  • Save mayank/d934254f164d47d1908438c734068a6d to your computer and use it in GitHub Desktop.
Save mayank/d934254f164d47d1908438c734068a6d to your computer and use it in GitHub Desktop.
const options = {
ignorePDF: <boolean>,
generateJPG: <boolean>,
jpgQuality: <numeric>,
chrome: <puppeteer-chrome-opts>,
};
// returns a buffer consists of pdf, html and jpeg as requested
const pdfBuffer = await mould.pdf('via', {
company_report_details: {
name: "Roadzen",
email: "support@roadzen.io",
phone: "23874983589234"
}
}, options);
const html = pdfBuffer.getHtml();
const pdf = pdfBuffer.getPdf();
const jpeg = pdfBuffer.getJPG();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment