2

I have a html site that allows you to create PDF. When I generate a PDF in the site, tables with large content are breaking to the next page even when there is space on the page. For example, check the following image.

enter image description here

How do I control this behavior? Ideally I would like the table not to break to the next page.

I have the following CSS for tables. Looking only for CSS solution.

table td, table th {width: auto!important;}
table, th, td {border: .1px light gray;}
table {width: 100%!important; table-layout: fixed;}
table {display: table-header-group;}
thead {display: table-header-group;}
tfoot {display: table-header-group;}
table {-fs-table-paginate: paginate;}
tr {page-break-inside: avoid;}
Cœur
  • 37,241
  • 25
  • 195
  • 267
PMM
  • 155
  • 1
  • 1
  • 11
  • I'm pretty sure it depends on how you create the PDF file. It's not a single well-defined thing. – Sami Kuhmonen Oct 13 '16 at 06:42
  • There is a PDF section in the site that allows you to define the CSS for the way the pages will be displayed. For the tables, only the above mentioned CSS has been added. – PMM Oct 13 '16 at 06:52
  • Still doesn't say what produces the PDF. It doesn't magically appear, some library or tool must make it and that's the one making the decisions. – Sami Kuhmonen Oct 13 '16 at 06:53
  • Ohh sorry...The site uses Prince XML to generate the PDF. – PMM Oct 13 '16 at 06:54
  • mayby css property page-break-inside set to auto assigned to table will do work – Misiakw Oct 13 '16 at 08:01
  • @ Misiakw...i removed some of my previous settings and used this and it worked..thanks a lot. – PMM Oct 13 '16 at 09:50

1 Answers1

1

You can try with this:

table{ page-break-inside: auto }
Leaniman
  • 671
  • 6
  • 5