tenta fix pdfservice.js
This commit is contained in:
1 parent
06165db8bb
commit
bbff8eb317
1 file changed
-37
@@ -316,43 +316,6 @@ export class PdfService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Função para decodificar entidades HTML comuns
|
// Função para decodificar entidades HTML comuns
|
||||||
function decodeHtmlEntities(str: string): string {
|
|
||||||
if (!str) return '';
|
|
||||||
const textarea = document.createElement('textarea');
|
|
||||||
textarea.innerHTML = str;
|
|
||||||
let result = textarea.value;
|
|
||||||
|
|
||||||
// Substitui manualmente as entidades mais comuns para funcionar em Node.js
|
|
||||||
return result
|
|
||||||
.replace(/ /g, ' ')
|
|
||||||
.replace(/&/g, '&')
|
|
||||||
.replace(/</g, '<')
|
|
||||||
.replace(/>/g, '>')
|
|
||||||
.replace(/"/g, '"')
|
|
||||||
.replace(/'/g, "'")
|
|
||||||
.replace(/á/g, 'á')
|
|
||||||
.replace(/é/g, 'é')
|
|
||||||
.replace(/í/g, 'í')
|
|
||||||
.replace(/ó/g, 'ó')
|
|
||||||
.replace(/ú/g, 'ú')
|
|
||||||
.replace(/ç/g, 'ç')
|
|
||||||
.replace(/ã/g, 'ã')
|
|
||||||
.replace(/õ/g, 'õ')
|
|
||||||
.replace(/ñ/g, 'ñ')
|
|
||||||
.replace(/Á/g, 'Á')
|
|
||||||
.replace(/É/g, 'É')
|
|
||||||
.replace(/Í/g, 'Í')
|
|
||||||
.replace(/Ó/g, 'Ó')
|
|
||||||
.replace(/Ú/g, 'Ú')
|
|
||||||
.replace(/Ç/g, 'Ç')
|
|
||||||
.replace(/Ã/g, 'Ã')
|
|
||||||
.replace(/Õ/g, 'Õ')
|
|
||||||
.replace(/Ñ/g, 'Ñ')
|
|
||||||
.replace(/º/g, 'º')
|
|
||||||
.replace(/ª/g, 'ª');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Corrigir manualmente a função decodeHtmlEntities para ambiente Node.js
|
|
||||||
function decodeHtmlEntities(str: string): string {
|
function decodeHtmlEntities(str: string): string {
|
||||||
if (!str) return '';
|
if (!str) return '';
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user