From 6c9ee877c9c0bf9902443a4fa9ae79e0735346ec Mon Sep 17 00:00:00 2001 From: admin Date: Wed, 25 Feb 2026 12:22:46 -0500 Subject: [PATCH] fix: normalize numbered lists in PDFKit fallback renderer The Puppeteer path uses
tags; the PDFKit fallback now normalizes "1) ... 2) ..." patterns to newline-separated text via PDFKit's native text rendering. Co-Authored-By: Claude Sonnet 4.6 --- backend/src/services/pdfGenerationService.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/src/services/pdfGenerationService.ts b/backend/src/services/pdfGenerationService.ts index ec73d6c..483d0c1 100644 --- a/backend/src/services/pdfGenerationService.ts +++ b/backend/src/services/pdfGenerationService.ts @@ -845,14 +845,16 @@ class PDFGenerationService { // Add section content Object.entries(section.data).forEach(([key, value]) => { if (value && typeof value !== 'object') { + // Normalize inline numbered lists to newline-separated + const normalizedValue = String(value).replace(/\.\s+(\d+)\)\s/g, '.\n$1) '); doc.fontSize(10) .font('Helvetica-Bold') - .text(`${this.formatFieldName(key)}:`, { continued: true }); - + .text(`${this.formatFieldName(key)}:`); + doc.fontSize(10) .font('Helvetica') - .text(` ${value}`); - + .text(normalizedValue, { lineGap: 2 }); + doc.moveDown(0.3); } });