diff --git a/src/Legacy/Pdf.php b/src/Legacy/Pdf.php index 4ef5686a..04eaeeca 100644 --- a/src/Legacy/Pdf.php +++ b/src/Legacy/Pdf.php @@ -893,7 +893,7 @@ public function textBox( //remover espaços desnecessários $text = trim($text); //converter o charset para o fpdf - $text = mb_convert_encoding($text, 'ISO-8859-1'); + $text = $this->convertToIso($text); //decodifica os caracteres html no xml $text = html_entity_decode($text); } else { @@ -1034,7 +1034,7 @@ public function textBox90( //remover espaços desnecessários $text = trim($text); //converter o charset para o fpdf - $text = mb_convert_encoding($text, 'ISO-8859-1'); + $text = $this->convertToIso($text); //decodifica os caracteres html no xml $text = html_entity_decode($text); } else { @@ -1117,4 +1117,15 @@ public function textBox90( $this->rotate(0, $x, $y); return ($y1 - $y) - $incY; } + + /** + * Converte os caracteres para ISO-88591. + * + * @param string $text + * @return string + */ + private function convertToIso($text) { + return mb_convert_encoding($text, 'ISO-8859-1', ['UTF-8', 'windows-1252']); + } + }