I'm building a PDF with dompdf, but my pdf doesn't contains a specified image. I already set the value to true in dompdf_config.inc.php
def("DOMPDF_ENABLE_REMOTE", true);
and this is my image HTML item:
<img src="logoweb.png" width="150" height="150"/>
What is happening? How can I show the image within my PDF?
You should convert your image to base64 encoding for pdf.
<?php
$path = 'logoweb.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
?>
<img src="<?php echo $base64?>" width="150" height="150"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With