diff --git a/src/lib/invoice-pdf.ts b/src/lib/invoice-pdf.ts index 8e8d4d7..14f65f5 100644 --- a/src/lib/invoice-pdf.ts +++ b/src/lib/invoice-pdf.ts @@ -400,7 +400,12 @@ export async function downloadInvoicePdf(input: InvoicePdfInput, filename: strin const drawItem = (item: InvoiceLineItem) => { const isNonBillable = item.billable === false; - const descMaxW = colQtyR - colDescX - 14; + // Reserve generous padding before the QTY column so wrapped text never + // collides with the right-aligned numeric columns. Measure with the same + // font (incl. italic for non-billable rows) that will render the text, + // since italic glyphs are slightly wider than upright ones. + const descMaxW = colQtyR - colDescX - 24; + setFont(pdf, { size: 9, color: isNonBillable ? MUTED : TEXT, italic: isNonBillable }); const descLines = wrap(pdf, item.description || (item.kind === "expense" ? "Expense" : ""), descMaxW); const lineHeight = 12; const blockH = Math.max(lineHeight * descLines.length + 14, item.user_initials ? 32 : 26);