Chartjs-Render Javascript in DOMPDF is not working as expected

0👍

I had a similar issue with CSS a while ago, it appears it wasn’t possible to load the css directly inside the template, so the treatment went into the controller. This solution worked for me.

$dompdf = new Dompdf();
$html = $this->renderView('path/your_page.html.twig');
$html .= '<link type="text/css" href="/absolute/path/to/pdf.css" rel="stylesheet" />';
$dompdf->loadHtml($html);

I suspect it might be the same for your javascript.

Leave a comment