Update PDF generation height calculation and corresponding test value
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good

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.
This commit is contained in:
Tom Butcher 2026-08-20 00:12:27 +01:00
parent 0b94774443
commit 322a086040
2 changed files with 2 additions and 2 deletions

View File

@ -94,7 +94,7 @@ describe('PDF Factory', () => {
expect(page.pdf).toHaveBeenCalledWith( expect(page.pdf).toHaveBeenCalledWith(
expect.objectContaining({ expect.objectContaining({
width: '80mm', width: '80mm',
height: '121px', height: '122px',
}) })
); );
}); });

View File

@ -129,7 +129,7 @@ export async function generatePDF(html, options = {}) {
printBackground: true, printBackground: true,
preferCSSPageSize: true, preferCSSPageSize: true,
width: options.width ? `${options.width}mm` : undefined, 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: { margin: {
top: '0mm', top: '0mm',
right: '0mm', right: '0mm',