This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Prevent row from split between pages

ofirindig wrote on 2011-12-07:
I'm trying to create pdf that contains paragraphs and tables, however sometimes the table row is splitted between the pages. how can i prevent this from happend ?

support wrote on 2011-12-08:
Hello,

one option is to use javascript. The idea is outlined here: https://pdfcrowd.com/forum/archive/read/?3,592,595#msg-595

The javascript function described there is able to prevent a page break inside a table row. Please, try the function out and let us know if it works for your document.


Please see the update below:
ofirindig wrote on 2011-12-08:
still splits table in some cases
support wrote on 2011-12-08:
Could you post a link to your html document (or send it to info@pdfcrowd.com)? We will look into it.
ofirindig wrote on 2011-12-11:
The problem solved. (the pdfcrowd.js script changes)
thanks !
torgormack wrote on 2012-02-25:
I have just encountered this same problem. I have a very long table which spans two pages and when it is converted to a pdf the rows do not break cleanly.

I have tried using the javascript solution posted here but I am still getting an ugly row split.

I have attached the file i am calling to do the PDF conversion.

The URL that produces the page that I want to convert is
http://31-222-168-242.static.cloud-ips.co.uk/teamarmy/reports/sponsor-statement-account?contract=292&period=

Any help or pointers gratefully received.
support wrote on 2012-02-27:
Please post the HTML with the long table and we will take a look at why it does not work with pdfcrowd.js
torgormack wrote on 2012-02-27:
HTML attached as requested
support wrote on 2012-02-29:
Hello, there are several issues that prevent splitting your tables correctly. One of them is that pdfcrowd.splitTable() does not support tables containing the <thead> element at the moment. We will take a look at it to see what can be done about it.
support wrote on 2012-05-20:
Update: We added support for "page-break-inside:avoid", the javascript workaround is not needed anymore. Try to add the following to your stylesheet:
td,th { page-break-inside: avoid; }