4

I'm using Apache freemarker to construct PDF document reports. I have a situation when half of my page is full of text and I need to add a table below it. Table size is dynamic and sometime it fits in the same page with the text and sometimes not, if it does not fit then I get some of the table content on the next page. I want to measure if the table will fit on the same page and if it won't i want to print it on a separate page. Is there any way to achieve that?

In my case it's important to print the table on the same page if it fits.

Tomas
  • 962
  • 3
  • 11
  • 25
  • FreeMarker doesn't do pagination (or really anything but generating text). You should tell what exactly are you generating with the template. Like, XSL FO? (Then see how pagination works in FO.) – ddekany Aug 02 '16 at 21:24

1 Answers1

3

Actually the solution was easy - to my table I had to add page-break-inside:avoid; This css property prevents breaking an element if it would fit on a separate page.

Tomas
  • 962
  • 3
  • 11
  • 25