From 6766a3d0dcc558cbf375a90fbd53387bc8e1e2f4 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 12 Nov 2019 15:45:26 +0100 Subject: [PATCH] fix(core): update --- ts/smartpdf.classes.smartpdf.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ts/smartpdf.classes.smartpdf.ts b/ts/smartpdf.classes.smartpdf.ts index 4857f91..8d50452 100644 --- a/ts/smartpdf.classes.smartpdf.ts +++ b/ts/smartpdf.classes.smartpdf.ts @@ -99,8 +99,16 @@ export class SmartPdf { page.emulateMedia('screen'); const response = await page.goto(websiteUrl, { waitUntil: 'networkidle2' }); const pdfId = plugins.smartunique.shortId(); + const { documentHeight, documentWidth } = await page.evaluate(() => { + return { + documentHeight: document.height, + documentWidth: document.width + }; + }); const pdfBuffer = await page.pdf({ format: 'A4', + height: documentWidth, + width: documentWidth, printBackground: true, displayHeaderFooter: false, preferCSSPageSize: true @@ -125,6 +133,7 @@ export class SmartPdf { }; }); const pdfBuffer = await page.pdf({ + format: 'A4', height: documentWidth, width: documentWidth, printBackground: true,