I am trying to implement a footer in iText7
, the footer should be different on the last page of the document, I have added an event handler which is called when
I have not used itext before, but the javadoc for onCloseDocument in itext5 says:
Called when the document is closed. Note that this method is called with the page number equal to the last page plus one.
could it be that you simply have to change your loop from
for (int i = 1; i <= document.getPdfDocument().getNumberOfPages(); i++)
{
to
for (int i = 1; i < document.getPdfDocument().getNumberOfPages(); i++)
{
? (note the i < ... instead of i <= )