Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-17 02:03:10 +00:00
co-authored by renee-png
parent eee182b0e5
commit 59ea9c7d1f
+48
View File
@@ -183,6 +183,54 @@ function htmlToParagraphs(html: string): Paragraph[] {
return out;
}
function footerCell(width: number, align: (typeof AlignmentType)[keyof typeof AlignmentType], children: TextRun[]) {
return new TableCell({
width: { size: width, type: WidthType.DXA },
borders: noBorder,
margins: { top: 40, bottom: 40, left: 60, right: 60 },
children: [
new Paragraph({
alignment: align,
children: children.length ? children : [run("")],
}),
],
});
}
function buildFooterTable(left?: string, center?: string, right?: string): Table {
const total = 9360;
const col = Math.floor(total / 3);
const cols = [col, col, total - 2 * col];
const leftRuns: TextRun[] = left ? [run(left, { size: 20 })] : [];
const centerRuns: TextRun[] = center ? [run(center, { size: 20 })] : [];
// Right column: optional user text + always "Page X of Y"
const rightRuns: TextRun[] = [];
if (right && right.trim()) {
rightRuns.push(run(`${right} `, { size: 20 }));
}
rightRuns.push(run("Page ", { size: 20 }));
rightRuns.push(new TextRun({ children: [PageNumber.CURRENT], font: FONT, size: 20 }));
rightRuns.push(run(" of ", { size: 20 }));
rightRuns.push(new TextRun({ children: [PageNumber.TOTAL_PAGES], font: FONT, size: 20 }));
return new Table({
width: { size: total, type: WidthType.DXA },
columnWidths: cols,
borders: noBorder,
rows: [
new TableRow({
children: [
footerCell(cols[0], AlignmentType.LEFT, leftRuns),
footerCell(cols[1], AlignmentType.CENTER, centerRuns),
footerCell(cols[2], AlignmentType.RIGHT, rightRuns),
],
}),
],
});
}
export function buildPleadingDoc(input: PleadingInput): Document {
const headerLine1 = `IN THE ${input.courtType} COURT OF THE ${input.circuit} JUDICIAL CIRCUIT,`;
const headerLine2 = `IN AND FOR ${input.county.toUpperCase()} COUNTY, FLORIDA`;