How to use bootstrap in mPDF?
mPDF does not support Bootstrap styles entirely. An option would be some alternative such as headless-chrome based wkhtmltopdf.
one of the mpdf guy told that bootstrap not supported out-of-the-box inside mpdf and you have to use some custom style. Github link
Hope this will help to solve your problem.
In my case, I'm using Bootstrap 3.3.7 with MPDF version 6.0.It's working perfectly without any error.
$stylesheet = file_get_contents('css/bootstrap-3.3.7.min.css');$pdf->WriteHTML($stylesheet, 1); // CSS Script goes here.$pdf->WriteHTML($html, 2); //HTML Content goes here.$pdf->Output();
Here is a Bootstrap CSS file for mPDF: https://github.com/kartik-v/yii2-mpdf/blob/master/src/assets/kv-mpdf-bootstrap.css
It is part of the kartik-v/yii2-mpdf PHP library which encapsulates mPDF.