Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 18:45:47 +00:00
co-authored by renee-png
parent 2ade5e8fb5
commit 04fdf3d340
+28
View File
@@ -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);