Skip to content
Advertisement

How to split text into another page if the text is large in table?

My code looks like this:

$html = '<table style="width: 793px; overflow: wrap" autosize="1">
   <tr>
       <td>small text</td>
       <td>large text</td>
   </tr>
   <tr>
       <td>small text</td>
       <td>large text</td>
   </tr>
</table';

$mpdf = new Mpdf();
$mpdf->shrink_tables_to_fit = 1;
$mpdf->WriteHTML($html);

I don’t know why, but mpdf tries to put one TR on one page. But if text is large in TD, mpdf automatically resizes the font size to very small. I need to split my text on two pages without changing the font size.

Advertisement

Answer

This is documented behaviour:

Note: mPDF will always resize tables if it is the only way to fit a row or whole table onto a full page.

Split large text to multiple rows if you need it to span between pages. Or don’t use tables.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement