List of usage examples for com.itextpdf.text.pdf PdfContentByte setFontAndSize
public void setFontAndSize(final BaseFont bf, final float size)
From source file:valstreamtools.ValStrSplitPage.java
private void createPageNo(String inputFileName, String outputFileName, float pageHeight) throws IOException, DocumentException { PdfReader pdfReader = new PdfReader(inputFileName); PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileOutputStream(outputFileName)); int pageCount = pdfReader.getNumberOfPages(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED); for (int i = 1; i <= pageCount; i++) { PdfContentByte content = pdfStamper.getOverContent(i); content.beginText();//from w w w . ja v a 2 s .c o m content.setFontAndSize(bf, 8); content.showTextAligned(PdfContentByte.ALIGN_LEFT, "Page " + i + "/" + pageCount, 5, pageHeight - 15, 0); content.endText(); } pdfStamper.close(); pdfReader.close(); }