0

I have looked around but not able to get an answer... I am using Itext7 to create a PDF from the data read from a DB and each row/cell can be longer than one line. However, I need to stop when the contents of the table reach the available space and create a new page. I tried table.getHeight() that is returning null and nothing I found on SOF so far works.

Any help would be highly appreciated

Alwaysa Learner
  • 496
  • 3
  • 11
  • Why don't you simply let iText distribute the table over multiple pages? `table.getHeight()` is not defined before the table is added to something because the available width of the page or canvas obviously influences how high the table becomes. – mkl Nov 20 '20 at 17:29
  • Other contents on the page change based on what page it is... Is there a way I could take care of the other contents independent of writing the table to document? – Alwaysa Learner Nov 20 '20 at 17:32
  • I found the desired answer in this link... https://stackoverflow.com/questions/41739082/in-itext7-is-there-a-way-like-itext5s-calculateheights-method – Alwaysa Learner Nov 20 '20 at 18:16
  • *"Is there a way I could take care of the other contents independent of writing the table to document?"* - You have to write it somewhere. Or at least trigger layout'ing to some defined area as Alexey's answer to the duplicated question does. – mkl Nov 20 '20 at 18:28

0 Answers0