Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions SimplePDF/SimplePDF.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,23 +303,21 @@ open class SimplePDF {

let height = (CGFloat(rowCount)*rowHeight)

let drawRect = CGRect(x: currentOffset.x, y: currentOffset.y, width: pageBounds.width - pageMarginLeft - pageMarginRight, height: height)

UIColor.black.setStroke()
UIColor.black.setFill()

let tableWidth = { () -> CGFloat in
if let cws = tableDefinition?.columnWidths {
return cws.reduce(0, { (result, current) -> CGFloat in
return result + current
})
return cws.reduce(0, +)
} else if let cw = columnWidth {
return CGFloat(columnCount) * cw
}

return 0 // default which should never be use, because either columnWidth, or columnsWidths is set
}()

let drawRect = CGRect(x: currentOffset.x, y: currentOffset.y, width: tableWidth, height: height)

UIColor.black.setStroke()
UIColor.black.setFill()

for i in 0...rowCount {
let newOrigin = drawRect.origin.y + rowHeight*CGFloat(i)

Expand Down