Skip to content Skip to sidebar Skip to footer

Dompdf : Image Not Found Or Type Unknown

Here is my code, I mostly tried all the methods for displaying image on PDF but still didnt work. Could you please help me for this. I also set DOMPDF_ENABLE_REMOTE to true and sti

Solution 1:

You should be using the full URL instead of a direct path. Especially when it is not a static image: dompdf will open that php script directly, so it won't be executed as if it's a PHP script.

If the full URL doesn't work, you can also show what the result of header.php is. Some good things to keep in mind are to send proper content-type headers and so on.

Solution 2:

Finally I Got Correct Solution to work with any server -> Use Base64 in Img src attribute :)

Solution 3:

You need to add 'isRemoteEnabled' => true

return PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('reports.invoiceSell')->stream();

Solution 4:

On mac, below error will be generated, but in Dompdf this error message will not be displayed.

"Unable to create temporary image in /var/folders/cc/nxb7r62n4vb0dds455ss6pw0000gn/T "

$options = new Options();
$options->setTempDir('temp'); // temp folder with write permission$dompdf = new Dompdf();
$dompdf->setOptions($options);

Solution 5:

Another alternative that works in version 1.0.2 is to make a change to the file.

dompdf/src/Image/Cache.php

Set the variable ($chrootValid) to true

$chrootValid = true;

*In this situation you cannot have the full path

Post a Comment for "Dompdf : Image Not Found Or Type Unknown"