techprimate / TPPDF

TPPDF is a simple-to-use PDF builder for iOS and macOS written in Swift
https://techprimate.github.io/TPPDF/
MIT License
746 stars 126 forks source link

Custom style table header with page wrap does not work #383

Open schiwekM opened 5 months ago

schiwekM commented 5 months ago

How should the feature work?

Thanks for the amazing package for generating PDFs. While using it in a project I noticed, that the table wrap across pages does not work when the header has custom styles. Second page will be empty in this case.

The logic currently checks for header rows which have the type header / header row (https://github.com/techprimate/TPPDF/blob/main/Source/Internal/Table/PDFTableObject.swift#L108), however with a custom style the type is custom (https://github.com/techprimate/TPPDF/blob/main/Source/Internal/Table/PDFTableObject.swift#L561). This leads to no header row being detected causing an empty page where the second part of a table should be, if the table has to many rows for the page. When the header cells do not have a custom style the page wrap properly works.

What should it look like?

Ideally it should be possible to specify custom styles for headers with the header still being detected. For solving this either the condition for checking the type of header cells should be removed or it should be possible to specify a custom style also as header and add this as an additional condition.

I guess there might also be a bug with the wrap across pages without a header row as I would have assumed it defaults to this behaviour instead of showing an empty page.

TPPDF Environment

TPPDF version: 2.4.1 Xcode version: 15.4 Swift version: 17.4

Thanks for considering. I'll also happily contribute it, just would like to know which variant would be preferred.

BR, Marten