Using puppeteer
This example shows how to use puppeteer module.
puppeteer
module is imported as puppeteer
Export web page to PDF
// launch chrome browser (headless)
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://integray.com');
const pdfBuffer = await page.pdf({ format: 'A4' });
// important step is to close browser process
await browser.close();
const file = {
Content: pdfBuffer.toString('base64'),
Name: 'integray.pdf'
};
return [file]
See Puppeteer documentation for more examples.