const puppeteer = require('puppeteer'); const path = require('path'); (async () => { const browser = await puppeteer.launch({ headless: true }); const page = await browser.newPage(); const htmlPath = path.resolve(__dirname, 'Prisa_Yachts_Brochure.html'); await page.goto(`file:///${htmlPath.replace(/\\/g, '/')}`, { waitUntil: 'networkidle0' }); await page.pdf({ path: path.resolve(__dirname, 'Prisa_Yachts_Brochure.pdf'), format: 'Letter', margin: { top: 0, right: 0, bottom: 0, left: 0 }, printBackground: true, preferCSSPageSize: true, }); await browser.close(); console.log('PDF generated: Prisa_Yachts_Brochure.pdf'); })();