tenta fix pdfservice.js

This commit is contained in:
rodrigo committed 2025-04-22 10:47:12 -03:00
1 parent e21dea582c
commit a208caec55
1 file changed
+6 -7
+6 -7
View File
@@ -423,7 +423,7 @@ export class PdfService {
if (remaining.startsWith('<b>') || remaining.startsWith('<strong>')) {
// Adiciona o texto acumulado antes da tag
if (currentChunk) {
formattedChunks.push({ text: currentChunk, isItalic, isBold });
formattedChunks.push({ text: currentChunk, isItalic: inItalic, isBold: inBold });
currentChunk = '';
}
@@ -433,7 +433,7 @@ export class PdfService {
else if (remaining.startsWith('</b>') || remaining.startsWith('</strong>')) {
// Adiciona o texto acumulado em negrito
if (currentChunk) {
formattedChunks.push({ text: currentChunk, isItalic, isBold: true });
formattedChunks.push({ text: currentChunk, isItalic: inItalic, isBold: true });
currentChunk = '';
}
@@ -443,7 +443,7 @@ export class PdfService {
else if (remaining.startsWith('<i>') || remaining.startsWith('<em>')) {
// Adiciona o texto acumulado antes da tag
if (currentChunk) {
formattedChunks.push({ text: currentChunk, isItalic, isBold });
formattedChunks.push({ text: currentChunk, isItalic: inItalic, isBold: inBold });
currentChunk = '';
}
@@ -453,7 +453,7 @@ export class PdfService {
else if (remaining.startsWith('</i>') || remaining.startsWith('</em>')) {
// Adiciona o texto acumulado em itálico
if (currentChunk) {
formattedChunks.push({ text: currentChunk, isItalic: true, isBold });
formattedChunks.push({ text: currentChunk, isItalic: true, isBold: inBold });
currentChunk = '';
}
@@ -463,7 +463,7 @@ export class PdfService {
else if (remaining.startsWith('<br>') || remaining.startsWith('<br/>') || remaining.startsWith('<br />')) {
// Adiciona o texto acumulado e então adiciona uma quebra de linha
if (currentChunk) {
formattedChunks.push({ text: currentChunk, isItalic, isBold });
formattedChunks.push({ text: currentChunk, isItalic: inItalic, isBold: inBold });
currentChunk = '';
}
@@ -479,10 +479,9 @@ export class PdfService {
// Adiciona qualquer texto restante
if (currentChunk) {
formattedChunks.push({ text: currentChunk, isItalic, isBold });
formattedChunks.push({ text: currentChunk, isItalic: inItalic, isBold: inBold });
}
// Agora temos o texto dividido em chunks com formatação
let lines: { chunks: { text: string, isItalic: boolean, isBold: boolean }[], width: number }[] = [{ chunks: [], width: 0 }];
let currentLineIndex = 0;