mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
scrollHeight is defined as the larger of an element's content height and its own (viewport) height — for a receipt shorter than the placeholder 1123px viewport, it silently returned the viewport height back, producing a correctly-formatted but page-length-tall PDF with a huge trailing blank strip below the real content. Found by actually rendering one and looking at it, not caught by unit tests (buildThermalHtml is pure string output, never exercises page.pdf() sizing). Fix: use a deliberately tiny (100px) viewport height for the thermal measurement pass, forcing content to overflow it so scrollHeight always reflects the receipt's real height. Also round the computed mm value before templating it into the CSS length string. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>