tenta fix pdfservice.js

This commit is contained in:
rodrigo committed 2025-04-22 16:18:53 -03:00
1 parent 494ad6ef9e
commit 46f538332e
1 file changed
+5 -1
+5 -1
View File
@@ -57,6 +57,10 @@ export class PdfService {
// Gera HTML com timbrado e margens
private gerarHTML(content: string, config: any) {
// Limpa espaços, quebras de linha e tags vazias do final do conteúdo
let cleanContent = content
.replace(/(\s|<br\s*\/?>|<p>\s*<\/p>)+$/gi, '')
.replace(/(<p>\s*<\/p>)+/gi, '');
const timbradoUrl = config.timbradoUrl
? `${process.env.FRONTEND_URL || 'http://localhost:5000'}${config.timbradoUrl}`
: '';
@@ -133,7 +137,7 @@ export class PdfService {
<body>
${timbradoUrl ? '<div class="timbrado-bg"></div>' : ''}
<div class="content">
${content}
${cleanContent}
</div>
</body>
</html>