From 8f64694115b8f87aca68eb730bb71b4d4e63b1ad Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 13 May 2026 09:53:46 +0000 Subject: [PATCH] Fix PDF line separator position and footer bleed-through - Move inter-line separator from bottom to top of each expense line; skip on first line and on page breaks (justBroke flag) so the continuation header is never followed immediately by a divider - Increase needSpace from lh*5 (70pt) to lh*7 (98pt) to match the actual line block height (~6lh + 16pt), preventing content from overrunning M.bottom and bleeding into the footer area https://claude.ai/code/session_014uUwDBtG5y5FuWcy5zqVD1 --- index.html | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 527d86e..78c5cb5 100644 --- a/index.html +++ b/index.html @@ -557,14 +557,17 @@ async function generatePDF() { let pg, y; const receiptRefs = []; // { pageIdx, x, y, receiptKey } + let justBroke = false; function addPage(isFirst) { pg = doc.addPage([pageW, pageH]); pages.push(pg); y = pageH - M.top; + justBroke = true; if (!isFirst) drawContHeader(); } function needSpace(h) { + justBroke = false; if (y - h < M.bottom) { addPage(false); } } @@ -632,8 +635,13 @@ async function generatePDF() { y -= lh + 4; // Lines - item.lines.forEach(ln => { - needSpace(lh * 5); + item.lines.forEach((ln, li) => { + needSpace(lh * 7); + if (li > 0 && !justBroke) { + y -= 4; + pg.drawLine({start:{x:M.left,y}, end:{x:M.left+W,y}, thickness:0.3, color:lineCol}); + y -= 8; + } const c1=0, c2=W*0.18, c3=W*0.6, c4=W*0.78; const r2v=0, r2r=W*0.6, r2a=W*0.78; @@ -692,10 +700,7 @@ async function generatePDF() { y -= lh; }); } - y -= 4; - // Light divider between lines - pg.drawLine({start:{x:M.left,y}, end:{x:M.left+W,y}, thickness:0.3, color:lineCol}); - y -= 8; + y -= 6; }); // Item divider