From 8620ea87b72740de8773b8d5aac1e6d880604728 Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 25 Feb 2026 12:18:07 -0500 Subject: [PATCH] fix: normalize numbered lists and FY labels in PDF export - Convert "1) ... 2) ..." inline lists to line-separated items in PDF - Use FY-3/FY-2/FY-1 labels in financial table (was FY3/FY2/FY1) - Applies to both top-level and nested field values Co-Authored-By: Claude Sonnet 4.6 --- backend/src/services/pdfGenerationService.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/services/pdfGenerationService.ts b/backend/src/services/pdfGenerationService.ts index ac52a25..ec73d6c 100644 --- a/backend/src/services/pdfGenerationService.ts +++ b/backend/src/services/pdfGenerationService.ts @@ -1244,12 +1244,13 @@ class PDFGenerationService { html += ``; const periods = ['fy3', 'fy2', 'fy1', 'ltm']; + const periodLabels: Record = { fy3: 'FY-3', fy2: 'FY-2', fy1: 'FY-1', ltm: 'LTM' }; periods.forEach(period => { if (value && typeof value === 'object' && value[period as keyof typeof value]) { const data = value[period as keyof typeof value] as any; html += ` - ${period.toUpperCase()} + ${periodLabels[period] || period.toUpperCase()} ${data?.revenue || '-'} ${data?.revenueGrowth || '-'} ${data?.ebitda || '-'} @@ -1264,20 +1265,22 @@ class PDFGenerationService { html += `

📋 ${this.formatFieldName(key)}

`; Object.entries(value).forEach(([subKey, subValue]) => { if (subValue && typeof subValue !== 'object') { + const displaySubValue = String(subValue).replace(/\.\s+(\d+)\)\s/g, '.
$1) '); html += `
${this.formatFieldName(subKey)} - ${subValue} + ${displaySubValue}
`; } }); } else if (value) { - // Handle simple fields + // Handle simple fields — normalize inline numbered lists to line-separated + const displayValue = String(value).replace(/\.\s+(\d+)\)\s/g, '.
$1) '); html += `
${this.formatFieldName(key)} - ${value} + ${displayValue}
`; }