I am creating a large HTML table and I have problem with page breaks as you can see in the following image:
Is there a method settle down the problem automatically? Or what is the way to do it?
Make sure all parent elements are display: block . Also consider overriding table , tr , td 's display styles with CSS grid for the print layout if you keep having issues with the table.
When you insert a manual page break (Ctrl+Enter) in a table, you split the table, and the empty paragraph is the result. To create a page break without splitting the table (which also allows your heading row(s) to repeat), apply the "Page break before" property to the row you want to appear on a new page.
Use $tcpdf->AddPage() to break page manually in your code. When you set SetAutoPageBreak(TRUE, 10); that means: when the height of document reach to (bottom - 10) then move the cursor to new page. So if you want to have more space, just reduce the number into 0.
What you actually want to do is to change the top margin of the main "container". Look in TCPDF config file for: define ('PDF_MARGIN_TOP', 19); Changing the value should solve the problem.
Try adding this to your <tr>
tags: nobr="true"
.
So a quick example would be:
<table> <tr nobr="true"> <td>Test</td> <td>Test 2</td> </tr> </table>
The nobr="true"
prevents the table rows from ever breaking apart. You can also put this on <td>
and <th>
tags.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With