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:26:57 +00:00
co-authored by renee-png
parent 07e5c856aa
commit cc951def85
+13 -8
View File
@@ -272,29 +272,34 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string
});
}
// Signature block (above footnotes)
// Signature block (above footnotes) — right-side, indented ~2/3 of page width
const sig = input.signature;
if (sig && (sig.block?.trim() || sig.imageDataUrl)) {
const SIG_X = MARGIN + CONTENT_W * (2 / 3);
if (sig && (sig.block?.trim() || sig.imageDataUrl || sig.typed?.trim())) {
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;
pdf.addImage(sig.imageDataUrl, fmt as any, SIG_X, y - LINE_H, 150, 50);
y += 50 - LINE_H + 4;
} catch {
y += LINE_H * 2;
}
} else if (sig.typed?.trim()) {
// Typed cursive signature — fall back to italic Bookman (script fonts not embedded)
setFont(pdf, { italic: true }, 18);
pdf.text(sig.typed.trim(), SIG_X, y);
y += LINE_H;
} else {
y += LINE_H * 3; // reserve space for a wet signature
y += LINE_H * 3;
}
setFont(pdf, {});
pdf.text("_______________________________", MARGIN, y);
pdf.text("_______________________________", SIG_X, y);
y += LINE_H;
sig.block.split("\n").forEach((line) => {
ensureSpace(LINE_H);
pdf.text(line, MARGIN, y);
pdf.text(line, SIG_X, y);
y += LINE_H;
});
}