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:
@@ -845,14 +845,16 @@ class PDFGenerationService {
|
|||||||
// Add section content
|
// Add section content
|
||||||
Object.entries(section.data).forEach(([key, value]) => {
|
Object.entries(section.data).forEach(([key, value]) => {
|
||||||
if (value && typeof value !== 'object') {
|
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)
|
doc.fontSize(10)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
.text(`${this.formatFieldName(key)}:`, { continued: true });
|
.text(`${this.formatFieldName(key)}:`);
|
||||||
|
|
||||||
doc.fontSize(10)
|
doc.fontSize(10)
|
||||||
.font('Helvetica')
|
.font('Helvetica')
|
||||||
.text(` ${value}`);
|
.text(normalizedValue, { lineGap: 2 });
|
||||||
|
|
||||||
doc.moveDown(0.3);
|
doc.moveDown(0.3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user