List of usage examples for com.itextpdf.text Document getPageNumber
public int getPageNumber()
From source file:com.github.wolfposd.imsqti2pdf.PageCounter.java
License:Open Source License
@Override public void onCloseDocument(PdfWriter writer, Document document) { _numberPages = document.getPageNumber() - 1; }
From source file:comisionesafis.informes.CintaComisionesPie.java
@Override public void onEndPage(PdfWriter writer, Document document) { //Rectangle rect = writer.getBoxSize("art"); Font font = new Font(Font.FontFamily.COURIER, 10, Font.NORMAL); Phrase texto = new Phrase("Pgina " + Integer.toString(document.getPageNumber()), font); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, texto, 300, 30, 0); }
From source file:comisionesafis.informes.LiquidacionComisionesCabecera.java
@Override public void onStartPage(PdfWriter writer, Document document) { Font fontFecha = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase("11/04/2014", fontFecha), 500, 830, 0); Font fontPaginaNum = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase("Pgina " + document.getPageNumber(), fontPaginaNum), 500, 823, 0); Font fontLIQ03 = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase("LIQ03_0202", fontLIQ03), 500, 816, 0); Font fontTitulo = new Font(Font.FontFamily.COURIER, 12, Font.NORMAL); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("LIQUIDACIN DE COMISIONES: Marzo 2014", fontTitulo), 300, 800, 0); Font fontDireccion = new Font(Font.FontFamily.COURIER, 10, Font.NORMAL); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase("PELAYO MUTUA DE SEGUROS", fontDireccion), 400, 750, 0); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase("CL SANTA ENGRACIA, 67", fontDireccion), 400, 730, 0); }
From source file:de.domjos.schooltools.core.utils.fileUtils.PDFBuilder.java
License:Open Source License
public void onEndPage(PdfWriter writer, Document document) { try {/*from w ww. j a v a2s . c o m*/ Rectangle rect = writer.getBoxSize("art"); Image img = Image.getInstance(Converter.convertDrawableToByteArray(this.context, R.drawable.icon)); Phrase phrase = new Phrase(); phrase.add(new Chunk(img, 0, 0)); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, phrase, rect.getLeft(), rect.getBottom(), 0); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(String .valueOf(this.context.getString(R.string.api_page) + " " + document.getPageNumber())), rect.getRight(), rect.getBottom(), 0); } catch (Exception ex) { Helper.printException(context, ex); } }
From source file:helpers.PDFHeaderFooter.java
@Override public void onStartPage(PdfWriter writer, Document document) { Rectangle rect = writer.getBoxSize("art"); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(""), rect.getLeft(), rect.getTop(), 0);/*from w ww . j av a2 s . com*/ ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase("Page " + document.getPageNumber(), FontFactory.getFont(FontFactory.TIMES_ITALIC, 5, Font.ITALIC, BaseColor.BLACK)), rect.getRight(), rect.getTop(), 0); }
From source file:org.fossa.rolp.util.LebPageHelper.java
License:Open Source License
@Override public void onEndPage(PdfWriter writer, Document document) { PdfPTable table = new PdfPTable(2); table.setTotalWidth(527);//from w w w .j a va2 s .c o m table.setWidthPercentage(100); table.setLockedWidth(true); table.getDefaultCell().setFixedHeight(105f); table.getDefaultCell().setBorderWidth(0); table.addCell(""); table.addCell(csmLogoImage); table.writeSelectedRows(0, -1, 100, 840, writer.getDirectContent()); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, new Phrase( lebData.getSchuelername() + " " + lebData.getSchuljahr() + " " + lebData.getSchulhalbjahr().getId() + " Seite " + document.getPageNumber(), fusszeilenFont), 100, 75, 0); }
From source file:pdf.FooterHeader.java
License:Open Source License
@Override public void onEndPage(PdfWriter writer, Document document) { PdfPTable table = new PdfPTable(3); try {/* ww w .j ava 2 s . com*/ if (document.getPageNumber() > 1) { table.setWidths(new int[] { 24, 24, 2 }); table.setTotalWidth(527); table.setLockedWidth(true); table.getDefaultCell().setFixedHeight(20); table.getDefaultCell().setBorder(Rectangle.BOTTOM); table.addCell(header); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(String.format("Seite %d von", writer.getPageNumber())); PdfPCell cell = new PdfPCell(Image.getInstance(total)); cell.setBorder(Rectangle.BOTTOM); table.addCell(cell); table.writeSelectedRows(0, -1, 34, 803, writer.getDirectContent()); } } catch (DocumentException de) { throw new ExceptionConverter(de); } PdfContentByte cb = writer.getDirectContent(); if (document.getPageNumber() > 1) { footer = new Phrase(document.getPageNumber() - 2); ColumnText.showTextAligned(cb, Element.ALIGN_CENTER, footer, (document.right() - document.left() - 30) / 2 + document.leftMargin(), document.bottom() + 10, 0); } }