📜  创建一个 pdf puppeteer js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:16.906000             🧑  作者: Mango

代码示例1
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://news.ycombinator.com', {
    waitUntil: 'networkidle2',
  });
  await page.pdf({ path: 'hn.pdf', format: 'a4' });

  await browser.close();
})();