Tuesday, January 4, 2011

TCPDF multipage table page break in multiline cell problem

I had a problem when I was creating PDFs from HTML with TCPDF. Tables spanning multiple pages which contained cells with multiple lines ended up page breaking in the middle of the cells and causing havoc with the automatically generated table header on the next page.

You might have seen other people having this problem:
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468.
And http://www.onemoretake.com/2009/03/27/revisited-tcpdf-variable-height-table-rows-with-multicell/ created their own class to circumvent the problem.

The fix now is as nicolaasuni says in http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3874468?message=8669584, get the latest version of TCPDF.

Alternatively, if you can't upgrade, you can use the nobr attribute which tells TCPDF not to break in the middle of a cell or other HTML tag. Usage:
<tr nobr="true">
<td>your content here</td>
</tr>


Solution found (nicolaasuni again): http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/3457446?message=7762133

6 comments:

  1. Great read! I wish you could follow up to this topic

    Aromatherapy Training

    ReplyDelete
  2. Super-Duper site! I am loving it!! Will come back again – taking your RSS feeds also, Thanks.

    nolvadex

    ReplyDelete
  3. excellent, thanks for the info.

    ReplyDelete
  4. Thanks for share, its very great solution for me :D

    ReplyDelete