I've got this code to export some data into a pdf. And I would like to add css from an external css file (which is not mentionned in the html used)
/*********************************** Export PDF ****************************************************/
if($request->query->get('exportPDF')!= null){
// Configure Dompdf according to your needs
$pdfOptions = new Options();
$pdfOptions->set('defaultFont', 'Arial');
// Instantiate Dompdf with our options
$dompdf = new Dompdf($pdfOptions);
// Retrieve the HTML generated in our twig file
$html = $this->renderView('dashboard/user_table.html.twig', [
'users' => $users
// Load HTML to Dompdf
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
$dompdf->setPaper('A3', 'landscape');
// Render the HTML as PDF
$dompdf->render();