From 04fdf3d34028e1c5bce7795b8b768df7f7f10a33 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:45:47 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index 6243f1e..51252b3 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -328,6 +328,34 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string } } + // Service list — fresh page at end + const serviceList = (input.serviceList || []).filter((c) => c.name.trim().length > 0); + if (serviceList.length > 0) { + pdf.addPage(); + y = MARGIN; + const slTitle = (input.serviceListTitle || "SERVICE LIST").toUpperCase(); + setFont(pdf, { bold: true }); + drawLine(pdf, [{ text: slTitle, style: { bold: true } }], MARGIN, y, "center", CONTENT_W, true); + y += LINE_H * 2; + setFont(pdf, {}); + serviceList.forEach((c, idx) => { + const block: string[] = []; + block.push(c.name); + const sub = [c.role, c.company].filter(Boolean).join(", "); + if (sub) block.push(sub); + if (c.address) c.address.split("\n").forEach((l) => block.push(l)); + if (c.phone) block.push(`Tel: ${c.phone}`); + if (c.email) block.push(`Email: ${c.email}`); + block.forEach((line, i) => { + ensureSpace(LINE_H); + setFont(pdf, { bold: i === 0 }); + pdf.text(line, MARGIN, y); + y += LINE_H; + }); + if (idx < serviceList.length - 1) y += LINE_H * 0.5; + }); + } + const total = pdf.getNumberOfPages(); for (let i = 1; i <= total; i++) { pdf.setPage(i);