From 75ed5d4c06f8b5edd07d50c4bd1b4c4a600cb24d 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 02:01:35 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index 204685f..1cc9ca5 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -270,6 +270,33 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string }); } + // Signature block (above footnotes) + const sig = input.signature; + if (sig && (sig.block?.trim() || sig.imageDataUrl)) { + ensureSpace(LINE_H * 6); + y += LINE_H * 1.5; + if (sig.imageDataUrl) { + try { + const fmt = (sig.imageType || "png").toUpperCase(); + // ~3 inches wide, ~1 inch tall + pdf.addImage(sig.imageDataUrl, fmt as any, MARGIN, y - LINE_H, 220, 70); + y += 70 - LINE_H + 4; + } catch { + y += LINE_H * 2; + } + } else { + y += LINE_H * 3; // reserve space for a wet signature + } + setFont(pdf, {}); + pdf.text("_______________________________", MARGIN, y); + y += LINE_H; + sig.block.split("\n").forEach((line) => { + ensureSpace(LINE_H); + pdf.text(line, MARGIN, y); + y += LINE_H; + }); + } + const fns = (input.footnotes || []).filter((f) => f.text.trim().length > 0); if (fns.length > 0) { ensureSpace(LINE_H * 2);