another fix for showHeaderOnEveryPage#264
Conversation
account for space.header and space.footer in page margins calculations
if table has a header that repeats on everypage, make sure the cells are shifted by headerHeight and adjust the position of the size wrt minOffset. also add table padding to the surrounding cells
| headerShift = false | ||
| } | ||
| //add table padding around cells | ||
| nextPageCells = shiftCellsBy(cells: nextPageCells, shiftValue: table.padding) |
There was a problem hiding this comment.
Line 342 adds additional spacing for me between the header and the first row on pages > 1. If I comment it out it works fine.
| } | ||
|
|
||
|
|
||
| internal typealias ShiftedCells = ([PDFTableCalculatedCell]) |
There was a problem hiding this comment.
| internal typealias ShiftedCells = ([PDFTableCalculatedCell]) | |
| internal typealias ShiftedCells = [PDFTableCalculatedCell] |
It is not necessary to wrap the array in parantheses and that might lead to side effects (it would be a single value tuple)
| let startPosition: CGPoint = cells.first?.frames.cell.origin ?? .zero | ||
| var nextPageCells: [PDFTableCalculatedCell] = cells | ||
| var pageEnd = CGPoint.null | ||
| var headerShift = true |
There was a problem hiding this comment.
should this be a hardcoded value or should it be connected to showHeaderOnEveryPage or shouldSplitCellsOnPageBreak?
fixed the spacing between the first row and the table header on rest of the pages (after firstpage)
fixed the PDFTableObject test
adjust the offset in TableObjectSpec test
code cleanup as per @philprime Co-Authored-By: Philip Niedertscheider <dev@philpri.me>
adjusted the expected value of the teableobkect test Co-Authored-By: Philip Niedertscheider <dev@philpri.me>
Codecov Report
@@ Coverage Diff @@
## develop #264 +/- ##
===========================================
+ Coverage 56.77% 57.48% +0.70%
===========================================
Files 122 122
Lines 4329 4311 -18
===========================================
+ Hits 2458 2478 +20
+ Misses 1871 1833 -38
Continue to review full report at Codecov.
|
merged with docs directory which i shouldn't :( so removing it from my fork
* Update PDFCalculations.swift account for space.header and space.footer in page margins calculations * Update PDFTableObject.swift - if table has a header that repeats on everypage, make sure the cells are shifted by headerHeight and adjust the position of the size wrt minOffset. also add table padding to the surrounding cells - fixed the spacing between the first row and the table header on rest of the pages (after firstpage) * Update PDFTableObjectSpec.swift Co-authored-by: Philip Niedertscheider <dev@philpri.me>
[sorry, originally submitted the PR against master not develop and didn't know how to undo this.. so resubmitting against develop]
looping back on the open issue #222 and some code changes i am proposing to address it (in line with #262 by David Moore). code is meant to fix some missing offset to line up headers and table spacing on every page. code can benefit from some refactoring but just tested it in 2.3.3 and looks good .