We're working on a shopping cart-like program in Java. One of the requirements is that the receipt sent to the users will be a pdf file, and it could be composed of multiple pages, so pagination is required. We're using iText to create the pdf, and HTML to create the layout of the receipt.
I know that I can add the footer using PageEvents and adding the footer HTML on the onEndPage()
method.
I was wondering if there is a way to add pagination to the footer html text of the receipt that our users will receive. (Page 1 of n, Page 2 of n, ... Page n of n).
Note though. Users can also edit the footer of the receipts they can receive, so they can rearrange the content of the end of the page.
For example:
Customer A's footer for his receipt may go:
<div class="left-footer companyLogo">...</div>
<div class="center-footer pagination">PAGINATION</div>
<div class="right-footer companyName">...</div>
While Customer B's footer may go:
<div class="left-footer Disclaimer">...</div>
<br/>
<div class="left-footer pagination">PAGINATION</div>
<div class="right-footer date-footer">$dateToday</div>
And then the $variableName would be parsed by a custom template parser