DOMPDF: Image not found or type unknown

If you are using DOMPDF on a server environment that has a self-signed security certificate, or perhaps the certificate name doesn’t match what it should, DOMPDF will not load images or other assets without specifically creating a stream context that allows it to do so.

// DOMPDF version 0.7.0
use Dompdf\Dompdf;
use Dompdf\Options;
require_once 'dompdf/';
$options = new Options();
$options->set('isRemoteEnabled', TRUE);
$dompdf = new Dompdf($options);
$contxt = stream_context_create([ 
	'ssl' => [ 
		'verify_peer' => FALSE, 
		'verify_peer_name' => FALSE,
		'allow_self_signed'=> TRUE 
// ...

For me this problem happened on the development environment (Ubuntu 16.04). I didn’t try it on the production environment, but it would have been fine there, because it has a valid security certificate.

Posted May 25th, 2016 in

Reader Comments (7)


Thanks, you saved me!


Thank you so much !!!


Thank you. I’m from Brazil and your solution saved me. Thanks anyway!


Thanks dude


Thank you, but where should we write that code?

Rodrigo Sandoval

Hey! Thanks!

Hendro PS

Thanks dude, you save my day !

Leave a comment