List of usage examples for com.lowagie.text.pdf PdfContentByte add
public void add(PdfContentByte other)
PdfContent
-object to this object. From source file:is.idega.idegaweb.egov.printing.business.DocumentBusinessBean.java
License:Open Source License
public void createCommuneFooter(PdfWriter writer) throws Exception { PdfContentByte cb = writer.getDirectContent(); Font nameFont = getDefaultParagraphFont(); nameFont.setSize(9);// ww w . j a va2 s .c o m Font textFont = getDefaultTextFont(); textFont.setSize(9); PdfPTable table = new PdfPTable(4); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); table.getDefaultCell().setNoWrap(true); IWBundle iwb = getIWApplicationContext().getIWMainApplication() .getBundle(is.idega.idegaweb.egov.message.business.MessageConstants.IW_BUNDLE_IDENTIFIER); table.addCell(new Phrase(iwb.getProperty("commune.name_mailaddr", "Mailaddress"), nameFont)); table.addCell(new Phrase(iwb.getProperty("commune.name_visitaddr", "Visitaddress"), nameFont)); table.addCell(new Phrase(iwb.getProperty("commune.name_contact", "Contact"), nameFont)); table.addCell(new Phrase(iwb.getProperty("commune.name_org_nr", "Organizationsnr"), nameFont)); table.addCell(new Phrase(iwb.getProperty("commune.mail_name", "Mail name"), getTextFont())); table.addCell(new Phrase(iwb.getProperty("commune.visit_name", "Visit name"), textFont)); table.addCell(new Phrase(iwb.getProperty("commune.website", "www.some-place.com"), textFont)); table.addCell(new Phrase(iwb.getProperty("commune.org_number", "XXXXXX-XXXX"), textFont)); table.addCell(new Phrase(iwb.getProperty("commune.mail_zip", "Zip code"), textFont)); table.addCell(new Phrase(iwb.getProperty("commune.visit_streetaddr", "Street and number,"), textFont)); table.addCell(new Phrase(iwb.getProperty("commune.support_email", "email@someplace.com"), textFont)); table.addCell(new Phrase(" ", textFont)); table.addCell(new Phrase(" ", textFont)); table.addCell(new Phrase(iwb.getProperty("commune.visit_zip", "Visit zip"), textFont)); table.addCell(new Phrase(iwb.getProperty("commune.office_phone", "office phone"), textFont)); table.addCell(new Phrase(" ", textFont)); int distFromBottomMM = 30; int[] widths = { 20, 20, 30, 20 }; table.setWidths(widths); table.setTotalWidth(getPointsFromMM(210 - 25 - 20)); table.writeSelectedRows(0, -1, getPointsFromMM(25), getPointsFromMM(distFromBottomMM), cb); PdfContentByte linebyte = new PdfContentByte(writer); // we add some crosses to visualize the destinations linebyte.moveTo(getPointsFromMM(25), getPointsFromMM(distFromBottomMM + 2)); linebyte.lineTo(getPointsFromMM(210 - 25), getPointsFromMM(distFromBottomMM + 2)); linebyte.stroke(); // we add the template on different positions cb.add(linebyte); }