Question

i am trying to generate a pdf file from smarty template using dompdf: code is below:-

require_once('dompdf/dompdf_config.inc.php');
$dompdf = new DOMPDF();
$dompdf->load_html($smarty->fetch(CURRENT_TEMPLATE.'/module/shopping_cart.html'));
$dompdf->render();
$dompdf->stream("sample.pdf");

i am getting the pdf file.but i am getting pdf file without any styles,i found that dompdf is not loading external stylesheet.so how can i load external stylesheet in smarty template

thanks in advance

Was it helpful?

Solution

You are using $dompdf->load->html(). Because of this styles are loaded relative to the PHP document in the local file system, not relative to the web server root. The easiest fix is to include the full URL (e.g. http://example.com/style.css) when referencing external styles.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top