1const puppeteer = require('puppeteer');
2
3(async () => {
4 const browser = await puppeteer.launch();
5 const page = await browser.newPage();
6 await page.goto('https://news.ycombinator.com', {
7 waitUntil: 'networkidle2',
8 });
9 await page.pdf({ path: 'hn.pdf', format: 'a4' });
10
11 await browser.close();
12})();