I ran into this problem when I create an invoice using mpdf. it cannot apply the css specified in the .css file or in the tag. but the displayed format is correct in the browser depending on what I installed.
so I tried to give css as inline for example:
<div style="display:block;color:#000;"></div>
And it works and solves my problem.
Secondly, this method will also help you:
$mpdf=new mPDF(); $stylesheet = file_get_contents('stylesheet.css'); // external css $mpdf->WriteHTML($stylesheet,1); $mpdf->WriteHTML($html,2); //$html contain your html code to display in pdf. $mpdf->Output();
source share