From bcb9fc363ed5ea2724886bb9023c80965a334a10 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 19:01:28 +0000 Subject: [PATCH 1/2] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/pdf-pleading.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index f368e2f..afa29f9 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -258,10 +258,22 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string y = captionEndY + LINE_H; if (input.title) { - ensureSpace(LINE_H * 2); setFont(pdf, { bold: true }); - pdf.text(input.title.toUpperCase(), PAGE_W / 2, y, { align: "center" }); - y += LINE_H * 1.5; + const titleText = input.title.toUpperCase(); + const titleLines = pdf.splitTextToSize(titleText, CONTENT_W) as string[]; + ensureSpace(LINE_H * (titleLines.length + 2)); + y += LINE_H; // one blank line before title + titleLines.forEach((line, i) => { + const isLast = i === titleLines.length - 1; + pdf.text(line, PAGE_W / 2, y, { align: "center" }); + if (isLast) { + const tw = pdf.getTextWidth(line); + pdf.setLineWidth(0.6); + pdf.line((PAGE_W - tw) / 2, y + 1.5, (PAGE_W + tw) / 2, y + 1.5); + } + y += LINE_H; + }); + y += LINE_H; // one blank line after title } setFont(pdf, {}); // reset to non-bold for body From 42e68881573838e62fa0a9fddd441aa31c2698c8 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 19:01:37 +0000 Subject: [PATCH 2/2] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/docx-pleading.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index a2fd1e9..062bc81 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -316,8 +316,16 @@ export function buildPleadingDoc(input: PleadingInput): Document { const bodyParagraphs: Paragraph[] = []; if (input.title) { + // Render title as one centered paragraph per manual line; underline only the last line. bodyParagraphs.push(emptyP()); - bodyParagraphs.push(p(input.title.toUpperCase(), { bold: true, align: AlignmentType.CENTER })); + const segments = input.title.toUpperCase().split("\n"); + const lastIdx = segments.length - 1; + segments.forEach((seg, i) => { + bodyParagraphs.push(new Paragraph({ + alignment: AlignmentType.CENTER, + children: [run(seg, { bold: true, underline: i === lastIdx })], + })); + }); bodyParagraphs.push(emptyP()); } if (input.bodyHtml && input.bodyHtml.trim()) {