itext liczba wszystkich stron

0

Witam,

Generuje plik PDF przy użyciu bibliotek itext.
Stopka generowana jest poprzez zdarzenie PdfPageEventHelper.
Chciałbym się dowiedzieć w jaki sposób mogę wstawić całkowitą ilość stron do komórki,
tak aby tekst był w postaci numer strony/wszystkie strony.

//**
 * {@inheritDoc}
 */
@Override
public final void onEndPage(final PdfWriter writer, 
final Document doc) {
        final PdfPTable tableFooter = new PdfPTable(2);
        tableFooter.setWidthPercentage(100f);
        tableFooter.getDefaultCell().setBorder(0);
        // ustawiam szerokość tabeli - marginesy
        tableFooter.setTotalWidth(doc.getPageSize().getWidth() - 72f);
        // tworze komórki
        ...
        final PdfPCell pageCountCell = new PdfPCell(new Phrase(
            "numer strony: " + doc.getPageNumber() +"/ ", this.font));
        pageCountCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        pageCountCell.setBorder(0);
        pageCountCell.setBorderWidthTop(1f);
        // dodaje komórki
        tableFooter.addCell(cell);
        tableFooter.addCell(pageCountCell);
        tableFooter.setComplete(true);
        final PdfContentByte cb = writer.getDirectContent();
        // wstawiam tabele
        tableFooter.writeSelectedRows(0, 1, (doc.right() - doc.left() 
            - tableFooter.getTotalWidth()) / 2 + doc.leftMargin(), 
            doc.bottom() - 10, cb);
    }
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1