Headless Chrome
If you install wget.exe
, curl.exe
, and chrome.exe
, you can print an HTML file using
chrome --headless
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('file://c:/Node/projects/public_html/pdf-print/your-pdf.html');
await page.pdf({
path: 'test.pdf',
format: 'A4',
margin: {
top: "20px",
left: "20px",
right: "20px",
bottom: "20px"
}
});
await browser.close();
})();