Automatic Pagebreak in Dynamically generated TCPDF HTML page

Bryan Zwicker picture Bryan Zwicker · May 4, 2015 · Viewed 11.3k times · Source

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?

Answer

Bryan Zwicker picture Bryan Zwicker · May 4, 2015

Found the solution. I had a TCPDF option misconfigured.

Setting this made everything work as intended:

$pdf->SetAutoPageBreak(true, 0);