I am generating a PDF report using the dompdf API, and words that contain accent are not being displayed correctly.
I put the charset = 'utf-8' tag inside the head, but it does not solve the problem
<meta charset='utf-8'/>
In php elements if I do:
<?php echo utf8_decode($variavel); ?>
Content is displayed correctly with accentuation ...
* But HTML elements continue with accent problem ...
Example
Code
<?php
ob_start('geraPDF');
?>
<html>
<head>
<meta charset='utf-8'>
<style>
p{
border:1px solid black;
box-shadow:5px 5px 5px #ccc;
width:90%;
padding:5px;
}
</style>
</head>
<body>
<b>Empresa: </b><?php echo utf8_decode($empresas); ?><br>
<b>Data: </b><?php echo date('d/m/Y',strtotime($dt)); ?><br>
<b>Nº da OS: </b><?php echo $os; ?><br>
<b>Nº Orçamento: </b><?php $norcamento; ?><br><br>
</body>
</html>
<?php
// Importa arquivo de config da classe DOMPDF
require_once 'dompdf/dompdf_config.inc.php';
/**
* Função ob_get_clean obtém conteúdo que está no buffer
* e exclui o buffer de saída atual.
* http://br1.php.net/manual/pt_BR/function.ob-get-clean.php
*/
$html = ob_get_clean();
$pdf = new DOMPDF();
$pdf->load_html($html);
$pdf->render();
$pdf->stream(date('d/m/Y').'_orcamento.pdf', array('Attachment'=>0));
?>
The result does not come out as expected in the pdf ... what could be happening?