I am using the Mpdf in symfony. I have installed the mpdf through composer like:
composer require mpdf/mpdf
After that require the Mpdf.php in autoload.php.
Then use the code for mpdf is:
$mpdf = new mPDF();
$html = '<p style="color:red;">PDF Generating...</p>';
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output('demo.pdf', 'F');
CSS is not affecting on the HTML. When I'm using the style on tag then it's working fine.
$mpdf = new mPDF();
$html = '<style>p{color:red;}</style><p>PDF Generating...</p>';
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output('demo.pdf', 'F');
When I try to use the CSS with class or ID then also not affecting.
$mpdf = new mPDF();
$html = '<style>p.text-color{color:red;}</style><p class="text-color">PDF Generating...</p>';
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output('demo.pdf', 'F');