Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ajaykarthikr/a497585a9b4468f5fa0cf5c53b20151f to your computer and use it in GitHub Desktop.
Save ajaykarthikr/a497585a9b4468f5fa0cf5c53b20151f to your computer and use it in GitHub Desktop.
const templateHeader = fs.readFileSync('header.html','utf-8');
const templateFooter = fs.readFileSync('footer.html','utf-8');
const data = await page.pdf({
displayHeaderFooter: true,
headerTemplate: templateHeader,
footerTemplate: templateFooter,
margin: {
top: '16px',
bottom: '36px',
},
printBackground: true,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment