techprimate / TPPDF

TPPDF is a simple-to-use PDF builder for iOS and macOS written in Swift

Home Page:https://techprimate.github.io/TPPDF/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unable to add table to footer

nmorgol opened this issue · comments

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

What did you do?

ℹlayout.margin.bottom = 0(or other >0)
document.add(.footerCenter, table: footerTable) => get nothing

layout.margin.bottom = -10(or other <0)
document.add(.footerCenter, table: footerTable) => footerTable at the next page

What did you expect to happen?

ℹexpected to get a table at the bottom of the page

What happened instead?

ℹlayout.margin.bottom = 0(or other >0)
document.add(.footerCenter, table: footerTable) => get nothing

layout.margin.bottom = -10(or other <0)
document.add(.footerCenter, table: footerTable) => footerTable at the next page

TPPDF Environment

TPPDF version: ℹ2.4.0
Xcode version: ℹ14.2
Swift version: ℹ5

Demo Code / Project

ℹlet document = PDFDocument(layout: layout)
document.background.color = .white

    let footerTable = PDFTable(rows: 3, columns: 3)
    let lineStyleFooter = PDFLineStyle(type: .full, color: UIColor.red, width: 2)
    let cellStyleFooter = PDFTableCellStyle(colors: (fill: UIColor.blue, text: UIColor.black),
                                            borders: PDFTableCellBorders(left: lineStyleFooter, top: lineStyleFooter, right: lineStyleFooter, bottom: lineStyleFooter), font: .init(name: "Arial-BoldMT", size: 18.2) ?? Font.boldSystemFont(ofSize: 76) )
    
    for i in 0...2{
        for j in 0...2{
            footerTable[i,j].content = try? PDFTableContent(content: "123123123")
        }
    }
    
    document.add(.footerCenter, table: footerTable)

ℹ We need a fully compilingPDFDocument