LibrePDF / OpenPDF

OpenPDF is a free Java library for creating and editing PDF files, with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
Other
3.6k stars 596 forks source link

Print large text cells that exceed the remaining height of one page of paper starting from the second page rather than from the remaining height of the first page #1188

Open JUNE-Colin opened 4 months ago

JUNE-Colin commented 4 months ago

The version I am using for OPNNPDF is 1.3.34 Create three rows of cells, with the first and second rows being regular text strings and the third row being large text strings. The length of the text in the third row exceeds the remaining height of one page of paper. When printing the large text in the third row, it will start from the second page of paper instead of the remaining height of the first page. Is there a solution to this problem?

Code samples: code_samples

Example of incorrect output: Example_of_incorrect_output

StevenStreasick commented 3 months ago

I was able to fix my version of this 'bug' by calling table.setSplitLate(false);. As long as you do not set setSplitRows to false, this should fix your problem. The documentation for splitLate is as following:

If true the row will only split if it's the first one in an empty page. It's true by default. It's only meaningful if setSplitRows(true).