List of usage examples for com.itextpdf.kernel.pdf PdfDocument getPage
public PdfPage getPage(PdfDictionary pageDictionary)
From source file:org.nih.nci.App.java
protected void addPageNumbers(PdfDocument pdfDocument) { int numPages = pdfDocument.getNumberOfPages(); for (int i = 1; i <= numPages; i++) { PdfPage page = pdfDocument.getPage(i); page.put(new PdfName("Tabs"), PdfName.S); try {/*ww w.j av a2 s . c o m*/ new PdfCanvas(page).beginText() .setFontAndSize(PdfFontFactory.createFont(FontConstants.HELVETICA), 10) .beginMarkedContent(PdfName.Artifact).moveText(255, 25) .showText("Page " + i + " of " + numPages).endText().stroke().endMarkedContent(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }