this repo has no description
1import puppeteer from 'puppeteer';
2import { fileURLToPath } from 'url';
3import { dirname, join } from 'path';
4
5const __dirname = dirname(fileURLToPath(import.meta.url));
6const htmlPath = join(__dirname, 'web-feature-usage-one-pager.html');
7const pdfPath = join(__dirname, 'web-feature-usage-one-pager.pdf');
8
9const browser = await puppeteer.launch();
10const page = await browser.newPage();
11await page.goto('file://' + htmlPath, { waitUntil: 'networkidle0' });
12await page.pdf({
13 path: pdfPath,
14 format: 'A4',
15 printBackground: true,
16 margin: { top: 0, right: 0, bottom: 0, left: 0 },
17});
18await browser.close();
19console.log('PDF written to', pdfPath);