mirror of
https://github.com/kbenestad/reimburse.git
synced 2026-06-18 16:04:31 +00:00
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
This commit is contained in:
parent
8be37f29fe
commit
8f64694115
1 changed files with 11 additions and 6 deletions
17
index.html
17
index.html
|
|
@ -557,14 +557,17 @@ async function generatePDF() {
|
||||||
let pg, y;
|
let pg, y;
|
||||||
const receiptRefs = []; // { pageIdx, x, y, receiptKey }
|
const receiptRefs = []; // { pageIdx, x, y, receiptKey }
|
||||||
|
|
||||||
|
let justBroke = false;
|
||||||
function addPage(isFirst) {
|
function addPage(isFirst) {
|
||||||
pg = doc.addPage([pageW, pageH]);
|
pg = doc.addPage([pageW, pageH]);
|
||||||
pages.push(pg);
|
pages.push(pg);
|
||||||
y = pageH - M.top;
|
y = pageH - M.top;
|
||||||
|
justBroke = true;
|
||||||
if (!isFirst) drawContHeader();
|
if (!isFirst) drawContHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
function needSpace(h) {
|
function needSpace(h) {
|
||||||
|
justBroke = false;
|
||||||
if (y - h < M.bottom) { addPage(false); }
|
if (y - h < M.bottom) { addPage(false); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -632,8 +635,13 @@ async function generatePDF() {
|
||||||
y -= lh + 4;
|
y -= lh + 4;
|
||||||
|
|
||||||
// Lines
|
// Lines
|
||||||
item.lines.forEach(ln => {
|
item.lines.forEach((ln, li) => {
|
||||||
needSpace(lh * 5);
|
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 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;
|
const r2v=0, r2r=W*0.6, r2a=W*0.78;
|
||||||
|
|
||||||
|
|
@ -692,10 +700,7 @@ async function generatePDF() {
|
||||||
y -= lh;
|
y -= lh;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
y -= 4;
|
y -= 6;
|
||||||
// Light divider between lines
|
|
||||||
pg.drawLine({start:{x:M.left,y}, end:{x:M.left+W,y}, thickness:0.3, color:lineCol});
|
|
||||||
y -= 8;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Item divider
|
// Item divider
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue