Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #279

Closed
jameswilddev opened this issue Jun 15, 2021 · 2 comments

Comments

@jameswilddev
Copy link

ℹ 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.

@philprime
Copy link
Member

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 ?

@philprime
Copy link
Member

Closes as this is already merged.
Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants