Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
4040a17c41
commit
202d1c8b34
+21
-15
@@ -195,28 +195,35 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string
|
||||
y += LINE_H * 1.5;
|
||||
|
||||
const leftColW = CONTENT_W * 0.58;
|
||||
const rightColW = CONTENT_W - leftColW - 24;
|
||||
const leftX = MARGIN;
|
||||
const rightX = MARGIN + leftColW + 24;
|
||||
const captionRightEdge = MARGIN + CONTENT_W;
|
||||
const labelIndent = 24; // ~1/3" indent for "Plaintiff(s)," / "Defendant(s)."
|
||||
|
||||
const plaintiffLines = (input.plaintiffs || "").split("\n").filter((l) => l.trim());
|
||||
const defendantLines = (input.defendants || "").split("\n").filter((l) => l.trim());
|
||||
|
||||
setFont(pdf, { bold: true });
|
||||
const captionLeft: string[] = [];
|
||||
if (plaintiffLines.length) captionLeft.push(...plaintiffLines); else captionLeft.push(" ");
|
||||
captionLeft.push("");
|
||||
captionLeft.push("Plaintiff(s),");
|
||||
captionLeft.push("");
|
||||
captionLeft.push("v.");
|
||||
captionLeft.push("");
|
||||
if (defendantLines.length) captionLeft.push(...defendantLines); else captionLeft.push(" ");
|
||||
captionLeft.push("");
|
||||
captionLeft.push("Defendant(s).");
|
||||
type CaptionRow = { text: string; indent?: number };
|
||||
const captionLeft: CaptionRow[] = [];
|
||||
if (plaintiffLines.length) plaintiffLines.forEach((l) => captionLeft.push({ text: l }));
|
||||
else captionLeft.push({ text: " " });
|
||||
captionLeft.push({ text: "" });
|
||||
captionLeft.push({ text: "Plaintiff(s),", indent: labelIndent });
|
||||
captionLeft.push({ text: "" });
|
||||
captionLeft.push({ text: "v." });
|
||||
captionLeft.push({ text: "" });
|
||||
if (defendantLines.length) defendantLines.forEach((l) => captionLeft.push({ text: l }));
|
||||
else captionLeft.push({ text: " " });
|
||||
captionLeft.push({ text: "" });
|
||||
captionLeft.push({ text: "Defendant(s).", indent: labelIndent });
|
||||
|
||||
const captionStartY = y;
|
||||
let ly = y;
|
||||
captionLeft.forEach((line) => { pdf.text(line, leftX, ly); ly += LINE_H; });
|
||||
captionLeft.forEach((row) => {
|
||||
pdf.text(row.text, leftX + (row.indent || 0), ly);
|
||||
ly += LINE_H;
|
||||
});
|
||||
|
||||
setFont(pdf, { bold: true });
|
||||
pdf.text(`CASE NO.: ${input.caseNumber || ""}`, rightX, y);
|
||||
@@ -225,9 +232,8 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string
|
||||
pdf.setLineWidth(0.6);
|
||||
// Vertical divider between caption columns
|
||||
pdf.line(MARGIN + leftColW + 12, captionStartY - LINE_H + 4, MARGIN + leftColW + 12, captionEndY);
|
||||
// Bottom border under the left caption cell
|
||||
pdf.line(leftX, captionEndY + 2, MARGIN + leftColW + 12, captionEndY + 2);
|
||||
void rightColW;
|
||||
// Bottom border spanning BOTH caption cells (full content width)
|
||||
pdf.line(leftX, captionEndY + 2, captionRightEdge, captionEndY + 2);
|
||||
|
||||
y = captionEndY + LINE_H;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user