1

I'm creating a pdf with DOMPDF and it's working fine on local and in a server with HTTP but when the source is in a server with HTTPS the images are not displayed.

$options->set('isRemoteEnabled', TRUE);
$dompdf = new Dompdf($options);

$context = stream_context_create([ 
    'ssl' => [ 
        'verify_peer' => FALSE, 
        'verify_peer_name' => FALSE,
        'allow_self_signed'=> TRUE 
    ] 
]);
$dompdf->setHttpContext($context);
Alejandro
  • 113
  • 2
  • 11
  • 1
    maybe (?????) http://stackoverflow.com/a/22911050/797620 – Abela Nov 16 '16 at 11:39
  • Probably is not an DOMpdf problem. Try read the remote web with the same stream context $fp = fopen($yourUrl, 'r', false, $context); or $response = file_get_contents($yourUrl, 0, $context); – Curlas Nov 16 '16 at 11:39
  • No. I'm sorry, dom pdf do not accept url with http format. – Curlas Nov 16 '16 at 11:41
  • Thanks! Using the path "var/www/mysite/public/images/image.jpg" works fine. But this doesn't work when I use a background image with css in the style attribute. Any idea? – Alejandro Nov 16 '16 at 13:24
  • Is your HTTPS issue resolved? If you have additional issues you need to resolve you should start a new question rather than work it out in the comments. SO is a question-and-answer forum, not a discussion forum. – BrianS Nov 21 '16 at 15:48

1 Answers1

0

To fix this I've used the path "var/www/mysite/public/images/image.jpg". I couldn't fix the problem with a background image, so I use the image with position absolute instead of background image with css.

Alejandro
  • 113
  • 2
  • 11