Search code examples
phpcodeigniterdompdf

Dompdf 0.8.3 not fetching remote CSS in PHP 7.2 and CodeIgniter 3


I'm upgrading my environment to PHP7.3 (from PHP5.5) and my DomPDF new installation (from 0.6 to 0.8.3) does not fetch any external CSS files. All server-related configuration seems ok, but only relative CSS files are loaded.

What may I be missing?

I'm using the following lines to generate the PDF:

require_once("dompdf_0-8-3/autoload.inc.php");

$options = new Dompdf\Options();
$options->set(array('isPhpEnabled'          => true, 
                    'isRemoteEnabled'       => true, 
                    'isJavascriptEnabled'   => false, 
                    'isHtml5ParserEnabled'  => true, 
                    'tempDir'               => sys_get_temp_dir())
        );

$dompdf = new Dompdf\Dompdf();
$dompdf->setOptions($options);    
$dompdf->loadHtml($html);    
$dompdf->setPaper($size, $orientation);            
$dompdf->render();
$dompdf->stream($filename.".pdf");

Note: I'm using base_url() in link href's tag, inside the HTML view.

Anyone has the same problem or any suggestion on how to solve?


Solution

  • The problem was due to a port redirection issue in the server. Solved :) Thank you all!