-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -450,7 +461,22 @@ internal class PDFTableObject: PDFRenderObject { | |||
} | |||
return result | |||
} | |||
|
|||
|
|||
internal typealias ShiftedCells = ([PDFTableCalculatedCell]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
@@ -284,6 +284,7 @@ internal class PDFTableObject: PDFRenderObject { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 .