This commit is contained in:
Nicolas Bally 2019-01-20 19:28:31 +01:00
parent 82328faa5d
commit 10af706d0b

8
pdf.js
View File

@ -10,9 +10,17 @@ const createPdf = async() => {
//await page.setViewport({width: 794, height: 1122, deviceScaleFactor: 1}); //await page.setViewport({width: 794, height: 1122, deviceScaleFactor: 1});
await page.goto(process.argv[2], {timeout: 3000, waitUntil: 'networkidle2'}); await page.goto(process.argv[2], {timeout: 3000, waitUntil: 'networkidle2'});
await page.waitFor(250); await page.waitFor(250);
await page._emulationManager._client.send(
'Emulation.setDefaultBackgroundColorOverride',
{ color: { r: 0, g: 0, b: 0, a: 0 } }
);
await page.pdf({ await page.pdf({
path: process.argv[3], path: process.argv[3],
format: 'A4', format: 'A4',
footerTemplate: '<div style="width:100%;font-family:arial;font-size: 8px; text-align:right;color:#3c3c3b; margin-right: 20px;margin-bottom:8px;">Page <span class="pageNumber"></span> sur <span class="totalPages"></span> </div>',
displayHeaderFooter: true,
margin: { top: 0, right: 0, bottom: 0, left: 0 }, margin: { top: 0, right: 0, bottom: 0, left: 0 },
printBackground: false printBackground: false
}); });