diff --git a/src/postprocesser.js b/src/postprocesser.js index a52886b308d7c9575370c4842092687a0dd0eb99..3610d5a049308ff7b771de389498a124955658be 100644 --- a/src/postprocesser.js +++ b/src/postprocesser.js @@ -184,10 +184,10 @@ class PostProcesser extends EventEmitter { const rectangle = PDFLib.PDFArray.fromArray( [ - PDFLib.PDFNumber.fromNumber(boxes.crop.x * 2), - PDFLib.PDFNumber.fromNumber(boxes.crop.y * 2), - PDFLib.PDFNumber.fromNumber(boxes.crop.width), - PDFLib.PDFNumber.fromNumber(boxes.crop.height), + PDFLib.PDFNumber.fromNumber(boxes.crop.x), + PDFLib.PDFNumber.fromNumber(boxes.crop.y), + PDFLib.PDFNumber.fromNumber(boxes.crop.width + boxes.crop.x), + PDFLib.PDFNumber.fromNumber(boxes.crop.height + boxes.crop.y), ], pdfPage.index, ); diff --git a/src/printer.js b/src/printer.js index b8b4f72d93c6d793eedc7c7250e3f88a4291beb5..662cf6a62f2bf3340404efcd67a0ca4149498f87 100644 --- a/src/printer.js +++ b/src/printer.js @@ -16,18 +16,6 @@ let scriptPath = paths[0] + "node_modules" + paths[paths.length-1]; const PostProcesser = require('./postprocesser'); -const PDF_SETTINGS = { - printBackground: true, - displayHeaderFooter: false, - preferCSSPageSize: true, - margin: { - top: 0, - right: 0, - bottom: 0, - left: 0, - } -}; - class Printer extends EventEmitter { constructor(headless, allowLocal) { super(); @@ -266,7 +254,7 @@ class Printer extends EventEmitter { } } - let pdf = await page.pdf(PDF_SETTINGS) + let pdf = await page.pdf(settings) .catch((e) => { console.error(e); });