techprimate / TPPDF

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

Feature: Pagination/Footer addition #402

Open SammyDerksen opened 1 week ago

SammyDerksen commented 1 week ago

How should the feature work?

In my footer I have LineSeparator on the whole width of the document and the page numbers should be above it, but they are currently rendered before the footer.

Insert page numbers above the footer elements. I would also like to add padding or margin or support for indentation.

What should it look like?

In Source/API/PDFGenerator+Generation.swift, pagination can be added after headerFooter in the addHeaderFooterObjects() method:

Bildschirmfoto 2024-11-21 um 16 24 32

I entered this manually in the footer, but the page numbers don't work with it. I have set the indent before and then reset it again so that my lineSeparator is on the whole width.

Bildschirmfoto 2024-11-21 um 16 28 26
SammyDerksen commented 1 week ago

I have now solved the problem with the indent by setting it to 0 before I set the footer and afterwards to 50, so that I have an ident for the page numbers but not for the footer. However, the pagination still has to be set after the footer. Perhaps it should be possible to set this in pagination.