I am dynamically pulling content into an HTML table that is used to build a PDF using TCPDF.
I need the page to auto-pagebreak when the content becomes too long for the page, but it seems to just keep appending to the first page even if it becomes longer than the actual page.
It is not simple row / column tabular data, so I cannot simply pagebreak after X rows, some fields can have very long "descriptions" that cause the row to go several lines (or even longer than a single page)
How can I force TCPDF to dynamically pagebreak when the content is longer than the page?
Found the solution. I had a TCPDF option misconfigured.
Setting this made everything work as intended:
$pdf->SetAutoPageBreak(true, 0);
One optimal solution would be:
//get the current page break margin:
$bMargin = $pdf->getBreakMargin();
//get current auto-page-break mode:
$auto_page_break = $pdf->getAutoPageBreak();
//enable auto page break:
$pdf->SetAutoPageBreak($auto_page_break, $bMargin);
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