From 0dd4506ed5f25f817f6c72017f6a9fc1e7b2acbe Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 13 May 2026 09:59:54 +0000 Subject: [PATCH] PDF: right-align FX rate, use standard font for FX rate and amount https://claude.ai/code/session_014uUwDBtG5y5FuWcy5zqVD1 --- index.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index d829ce5..0eac17d 100644 --- a/index.html +++ b/index.html @@ -656,7 +656,8 @@ async function generatePDF() { pg.drawText(truncate(ln.vendor, fontBody, sz, (c3-c2)-8), {x:M.left+c2, y, size:sz, font:fontBody, color:black}); pg.drawText(ln.currency, {x:M.left+c3, y, size:sz, font:fontBody, color:black}); const fxStr = ln.currency === baseCur ? '–' : parseFloat(ln.fxRate).toFixed(5); - pg.drawText(fxStr, {x:M.left+c4, y, size:sz, font:fontMono, color:black}); + const fxW = fontBody.widthOfTextAtSize(fxStr, sz); + pg.drawText(fxStr, {x:M.left+W-fxW, y, size:sz, font:fontBody, color:black}); y -= lh + 2; // Row 2 labels @@ -668,8 +669,8 @@ async function generatePDF() { pg.drawText(truncate(ln.description, fontBody, sz, (r2r-r2v)-8), {x:M.left+r2v, y, size:sz, font:fontBody, color:black}); pg.drawText(ln.hasReceipt ? 'Yes' : 'No', {x:M.left+r2r, y, size:sz, font:fontBody, color:black}); const amtStr = `${ln.currency} ${fmtAmt(ln.amount)}`; - const amtW = fontMono.widthOfTextAtSize(amtStr, sz); - pg.drawText(amtStr, {x:M.left+W-amtW, y, size:sz, font:fontMono, color:black}); + const amtW = fontBody.widthOfTextAtSize(amtStr, sz); + pg.drawText(amtStr, {x:M.left+W-amtW, y, size:sz, font:fontBody, color:black}); y -= lh + 2; // Row 3 labels