Image does not display in mpdf

Asked

Viewed 230 times

-3

I’m not getting to put the logo in the header of mpdf.

Does not display and shows any error...

The PDF generates, with the text, but without the logo.

$mpdf = new \Mpdf\Mpdf();
$mpdf->showImageErrors = true;
$mpdf->SetHTMLHeader('
<div style="text-align: left;><img src="https://sistema.site.com.br/uploads/logo/logo.jpg" height="42"></div>
');
$mpdf->SetHTMLFooter('
<table width="100%">
    <tr>
        <td width="33%">{DATE d-m-Y}</td>
        <td width="33%" align="center">{PAGENO}/{nbpg}</td>
        <td width="33%" style="text-align: right;">My document</td>
    </tr>
</table>');
$mpdf->SetDisplayMode('fullpage');
//$css = file_get_contents("css/estilo.css");
//$mpdf->WriteHTML($css,1);
$mpdf->WriteHTML($html);
$mpdf->Output();

exit;

What I’m doing wrong?

1 answer

2


Could be two things:

The URL https://sistema.site.com.br/uploads/logo/logo.jpg makes a mistake 404 (URL does not exist on the server) or you did not close the style attribute with quotes:

style="text-align: left;
                        ↑
                falta aspas aqui
  • It was exactly this... "

Browser other questions tagged

You are not signed in. Login or sign up in order to post.