Option to allow table cells to be split over pages, but move them to the next page if doing so would avoid the need to split them
ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.
Feature request should extend the framework. If you found a bug, please issue a Bug Report
I have reordered the below as they make more sense to me this way around.
What happened instead?
Currently, there is a shouldSplitCellsOnPageBreak property in a PDFTable instance.
When true, cells will be split wherever page breaks happen to land.
When false, cells will avoid page breaks by moving to the next page. If a cell is taller than a page, the PDF will fail to generate as a table cell is too big.
How should the feature work?
Replace the shouldSplitCellsOnPageBreak flag with a pageBreakMode enum allowing:
-
never- cells will avoid page breaks by moving to the next page. If a cell is taller than a page, the PDF will fail to generate as a table cell is too big (default). -
avoid- cells will avoid page breaks by moving to the next page. If a cell is taller than a page, they will be split by page breaks. -
allow- cells will be split wherever page breaks happen to land.
What should it look like?
avoid would work much like the HTML style page-break-inside: avoid.
TPPDF Environment
TPPDF version: 2.3.5 Xcode version: Version 12.5 (12E262) Swift version: 4
Demo Code / Project
None. I might be able to raise a PR for this change but I'm not familiar with Swift or this codebase.
I like this, seems table cell splitting really is a more complex task than I orginally expected it to be.
Could this also fix #234 ?
Closes as this is already merged. Thanks again!