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 1/6] 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; From 5640987b140d14dd9175dc28b9cc1aed2b977bd0 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:58 +0000 Subject: [PATCH 2/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index f2db8bd..d6a55cc 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -244,10 +244,21 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string y += LINE_H * 1.5; } - const blocks = input.bodyHtml && input.bodyHtml.trim() + setFont(pdf, {}); // reset to non-bold for body + const blocks: Block[] = input.bodyHtml && input.bodyHtml.trim() ? htmlToBlocks(input.bodyHtml) : (input.body || "").split("\n").map((line) => ({ kind: "para", align: "left", tokens: [{ text: line, style: {} }] })); + if (blocks.length === 0 && input.bodyHtml) { + // Fallback: strip HTML tags and render as plain text paragraphs + const plain = input.bodyHtml + .replace(/<\/?(p|div|h[1-6]|li|br)[^>]*>/gi, "\n") + .replace(/<[^>]+>/g, ""); + plain.split(/\n+/).filter((l) => l.trim()).forEach((line) => { + blocks.push({ kind: "para", align: "left", tokens: [{ text: line, style: {} }] }); + }); + } + for (const block of blocks) { if (block.kind === "spacer" || block.kind === "rule") { y += LINE_H; continue; } @@ -276,6 +287,7 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string if (lines.length === 1 && lines[0].length === 0) { y += LINE_H; continue; } lines.forEach((line, i) => { ensureSpace(LINE_H); + setFont(pdf, {}); // reset per-line so prior block styling never bleeds in drawLine(pdf, line, x, y, block.align, maxW, i === lines.length - 1); y += LINE_H; }); From 8ed07701ae31cb9b405b90092c94183df110ca7d 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:53:09 +0000 Subject: [PATCH 3/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/docx-pleading.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index 484f737..d16a452 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -83,6 +83,13 @@ const captionLeftBorders = { right: { style: BorderStyle.SINGLE, size: 8, color: "000000" }, }; +const captionRightBorders = { + top: { style: BorderStyle.NONE, size: 0, color: "FFFFFF" }, + bottom: { style: BorderStyle.SINGLE, size: 8, color: "000000" }, + left: { style: BorderStyle.NONE, size: 0, color: "FFFFFF" }, + right: { style: BorderStyle.NONE, size: 0, color: "FFFFFF" }, +}; + function run(text: string, opts: { bold?: boolean; italic?: boolean; underline?: boolean; superscript?: boolean; size?: number } = {}) { return new TextRun({ text, From bd0cf78ea4777e4b9dad189f3b0aece7c0dd6401 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:53:19 +0000 Subject: [PATCH 4/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/docx-pleading.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index d16a452..f182288 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -102,9 +102,10 @@ function run(text: string, opts: { bold?: boolean; italic?: boolean; underline?: }); } -function p(text: string, opts: { bold?: boolean; align?: (typeof AlignmentType)[keyof typeof AlignmentType] } = {}) { +function p(text: string, opts: { bold?: boolean; align?: (typeof AlignmentType)[keyof typeof AlignmentType]; indent?: number } = {}) { return new Paragraph({ alignment: opts.align, + indent: opts.indent ? { left: opts.indent } : undefined, children: [run(text, { bold: opts.bold })], }); } From 839325ea0d1d4cfd32acf6dadd6f48b6325d51ea 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:53:36 +0000 Subject: [PATCH 5/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/docx-pleading.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index f182288..53f8459 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -271,19 +271,20 @@ export function buildPleadingDoc(input: PleadingInput): Document { const plaintiffLines = (input.plaintiffs || "").split("\n").filter((l) => l.trim().length > 0); const defendantLines = (input.defendants || "").split("\n").filter((l) => l.trim().length > 0); - // Left side of caption — all bold + // Left side of caption — all bold; "Plaintiff(s)," / "Defendant(s)." indented + const LABEL_INDENT = 720; // 0.5" const leftCells: Paragraph[] = []; plaintiffLines.forEach((l) => leftCells.push(p(l, { bold: true }))); if (plaintiffLines.length === 0) leftCells.push(p("", { bold: true })); leftCells.push(emptyP()); - leftCells.push(p("Plaintiff(s),", { bold: true })); + leftCells.push(p("Plaintiff(s),", { bold: true, indent: LABEL_INDENT })); leftCells.push(emptyP()); leftCells.push(p("v.", { bold: true })); leftCells.push(emptyP()); defendantLines.forEach((l) => leftCells.push(p(l, { bold: true }))); if (defendantLines.length === 0) leftCells.push(p("", { bold: true })); leftCells.push(emptyP()); - leftCells.push(p("Defendant(s).", { bold: true })); + leftCells.push(p("Defendant(s).", { bold: true, indent: LABEL_INDENT })); const rightCells: Paragraph[] = [ p(`CASE NO.: ${input.caseNumber || ""}`, { bold: true }), @@ -304,7 +305,7 @@ export function buildPleadingDoc(input: PleadingInput): Document { }), new TableCell({ width: { size: 3960, type: WidthType.DXA }, - borders: noBorder, + borders: captionRightBorders, margins: { top: 80, bottom: 80, left: 200, right: 0 }, children: rightCells, }), From 3e37c565763a256cbdc7ac31dceb5c5651c0a974 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:53:48 +0000 Subject: [PATCH 6/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/documents.pleading.new.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/routes/documents.pleading.new.tsx b/src/routes/documents.pleading.new.tsx index a8dc10c..2749521 100644 --- a/src/routes/documents.pleading.new.tsx +++ b/src/routes/documents.pleading.new.tsx @@ -304,15 +304,15 @@ function PleadingNewPage() {
{headerLine2}
-
-
+
+
{plaintiffs || " "}
-
Plaintiff(s),
+
Plaintiff(s),
v.
{defendants || " "}
-
Defendant(s).
+
Defendant(s).
-
+
CASE NO.: {caseNumber}