Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get MPDF to render Bootstrap Table Styles

I've been trying for a while now to create a pdf of a bootstrap page with mpdf and not lose table and other styling. From what I've read on mpdf site is that the styles I'm referring to are supported, so not sure what the problem is. Other styling is being applied. Just not these table classes.

Tables have these classes: " table table-striped table-responsive small "

Bootstrap 3.3.1 and mPDF 5.7 & 6

The page displays as intended in browsers, but the pdf is stripped of table styling, and it's causing readability issues.

I've tried removing the @print from bootstrap.min.css as mentioned here: https://stackoverflow.com/a/27299382/1181367 but makes no difference.

Thanks in advance for any input you offer.

like image 313
Chris Avatar asked Nov 10 '22 13:11

Chris


1 Answers

For striping the table you can use the following css.

 <style>
    tr:nth-child(even) {
    background-color: #f2f2f2;
}
  </style>
like image 102
Udit Avatar answered Nov 15 '22 03:11

Udit