code: @Override
     public void onCloseDocument(PdfWriter writer, Document document) {
        super.onCloseDocument(writer, document);
        if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) {
           try {
              printTotalPages(template, document.right(), footerBottom);
           } catch (VectorPrintException | InstantiationException | IllegalAccessException ex) {
              throw new VectorPrintRuntimeException(ex);
           }
        }
        if (failuresHereAfter) {
           printFailureHeader(template, 10, document.top() - 10);
        }
     }
docs: calls {@link #printTotalPages(com.itextpdf.text.pdf.PdfTemplate, float, float)  }
  with {@link #PAGEFOOTERSTYLE a font from setup}, document.right() and the calculated bottom of the footertable.
  Clears the layermanager. When applicable calls {@link #printFailureHeader(com.itextpdf.text.pdf.PdfTemplate, float, float)
  }
  
  @param writer
  @param document