From 202d1c8b34d9294574ecabcb4cba20fa3f5d0c92 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 18:52:14 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index 7804c85..f2db8bd 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -195,28 +195,35 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string y += LINE_H * 1.5; const leftColW = CONTENT_W * 0.58; - const rightColW = CONTENT_W - leftColW - 24; const leftX = MARGIN; const rightX = MARGIN + leftColW + 24; + const captionRightEdge = MARGIN + CONTENT_W; + const labelIndent = 24; // ~1/3" indent for "Plaintiff(s)," / "Defendant(s)." const plaintiffLines = (input.plaintiffs || "").split("\n").filter((l) => l.trim()); const defendantLines = (input.defendants || "").split("\n").filter((l) => l.trim()); setFont(pdf, { bold: true }); - const captionLeft: string[] = []; - if (plaintiffLines.length) captionLeft.push(...plaintiffLines); else captionLeft.push(" "); - captionLeft.push(""); - captionLeft.push("Plaintiff(s),"); - captionLeft.push(""); - captionLeft.push("v."); - captionLeft.push(""); - if (defendantLines.length) captionLeft.push(...defendantLines); else captionLeft.push(" "); - captionLeft.push(""); - captionLeft.push("Defendant(s)."); + type CaptionRow = { text: string; indent?: number }; + const captionLeft: CaptionRow[] = []; + if (plaintiffLines.length) plaintiffLines.forEach((l) => captionLeft.push({ text: l })); + else captionLeft.push({ text: " " }); + captionLeft.push({ text: "" }); + captionLeft.push({ text: "Plaintiff(s),", indent: labelIndent }); + captionLeft.push({ text: "" }); + captionLeft.push({ text: "v." }); + captionLeft.push({ text: "" }); + if (defendantLines.length) defendantLines.forEach((l) => captionLeft.push({ text: l })); + else captionLeft.push({ text: " " }); + captionLeft.push({ text: "" }); + captionLeft.push({ text: "Defendant(s).", indent: labelIndent }); const captionStartY = y; let ly = y; - captionLeft.forEach((line) => { pdf.text(line, leftX, ly); ly += LINE_H; }); + captionLeft.forEach((row) => { + pdf.text(row.text, leftX + (row.indent || 0), ly); + ly += LINE_H; + }); setFont(pdf, { bold: true }); pdf.text(`CASE NO.: ${input.caseNumber || ""}`, rightX, y); @@ -225,9 +232,8 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string pdf.setLineWidth(0.6); // Vertical divider between caption columns pdf.line(MARGIN + leftColW + 12, captionStartY - LINE_H + 4, MARGIN + leftColW + 12, captionEndY); - // Bottom border under the left caption cell - pdf.line(leftX, captionEndY + 2, MARGIN + leftColW + 12, captionEndY + 2); - void rightColW; + // Bottom border spanning BOTH caption cells (full content width) + pdf.line(leftX, captionEndY + 2, captionRightEdge, captionEndY + 2); y = captionEndY + LINE_H;