DOMPDF doesn’t work with external css file

This has in fact nothing to do with Zend Framework, but you need to supply DomPDF the right path to load the “external” files from.

$dompdf = new DOMPDF();
$dompdf->setBasePath(realpath(APPLICATION_PATH . '/path/to/css/'));
$dompdf->loadHtml($html);
$dompdf->render();

See also the manual of DomPDF for this feature.

Leave a Comment