import report from "puppeteer-report"; import puppeteer from "puppeteer-core"; import path from "path"; async function x() { const browser = await puppeteer.launch({ executablePath: "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe", args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"], }); try { // you must use full path `home/puppeteer/index.hmtl` const file = path.join(__dirname, "index.html"); await report.pdf(browser, file, { path: "report.pdf", format: "a4", margin: { bottom: "10mm", left: "10mm", right: "10mm", top: "10mm", }, }); } finally { await browser.close(); } } x();