From 322a086040a8eb201dfca5f96f2728016cd33afa Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Thu, 20 Aug 2026 00:12:27 +0100 Subject: [PATCH] Update PDF generation height calculation and corresponding test value This commit modifies the height calculation in the PDF generation function to increase the height by 2 pixels when the height option is set to 'auto'. Additionally, the related test has been updated to reflect this change, ensuring that the expected height value is now 122px instead of 121px. These adjustments improve the accuracy of the PDF rendering process. --- src/templates/__tests__/pdffactory.test.js | 2 +- src/templates/pdffactory.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/__tests__/pdffactory.test.js b/src/templates/__tests__/pdffactory.test.js index 412415b..b3cf0d1 100644 --- a/src/templates/__tests__/pdffactory.test.js +++ b/src/templates/__tests__/pdffactory.test.js @@ -94,7 +94,7 @@ describe('PDF Factory', () => { expect(page.pdf).toHaveBeenCalledWith( expect.objectContaining({ width: '80mm', - height: '121px', + height: '122px', }) ); }); diff --git a/src/templates/pdffactory.js b/src/templates/pdffactory.js index e30cd22..d3a41cd 100644 --- a/src/templates/pdffactory.js +++ b/src/templates/pdffactory.js @@ -129,7 +129,7 @@ export async function generatePDF(html, options = {}) { printBackground: true, preferCSSPageSize: true, width: options.width ? `${options.width}mm` : undefined, - height: height ? (options.height == 'auto' ? `${height + 1}px` : `${height}mm`) : undefined, + height: height ? (options.height == 'auto' ? `${height + 2}px` : `${height}mm`) : undefined, margin: { top: '0mm', right: '0mm',