fix: normalize numbered lists in PDFKit fallback renderer

The Puppeteer path uses <br> 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 <noreply@anthropic.com>
This commit is contained in:
admin
2026-02-25 12:22:46 -05:00
parent 8620ea87b7
commit 6c9ee877c9

View File

@@ -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);
}
});