List of usage examples for com.itextpdf.text.pdf PdfPCell setBorder
public void setBorder(final int border)
From source file:be.rheynaerde.poolsheets.AbstractPoolSheet.java
License:Open Source License
protected PdfPTable getBout(String player1, String player2) { PdfPTable table = new PdfPTable(2); table.setTotalWidth(configuration.getSquareCellSize() * 2); PdfPCell player1Name = new PdfPCell(new Phrase(player1)); player1Name.setBorder(Rectangle.BOTTOM); player1Name.setHorizontalAlignment(Element.ALIGN_CENTER); player1Name.setFixedHeight(configuration.getSquareCellSize()); PdfPCell player2Name = new PdfPCell(new Phrase(player2)); player2Name.setBorder(Rectangle.BOTTOM); player2Name.setHorizontalAlignment(Element.ALIGN_CENTER); player2Name.setFixedHeight(configuration.getSquareCellSize()); PdfPCell player1Score = new PdfPCell(new Phrase(" ")); player1Score.setBorder(Rectangle.RIGHT); player1Score.setFixedHeight(configuration.getSquareCellSize()); PdfPCell player2Score = new PdfPCell(new Phrase(" ")); player2Score.setBorder(Rectangle.LEFT); player2Score.setFixedHeight(configuration.getSquareCellSize()); table.addCell(player1Name);/*from w w w.j a va2 s. co m*/ table.addCell(player2Name); table.addCell(player1Score); table.addCell(player2Score); table.setSpacingBefore(10); return table; }
From source file:be.rheynaerde.poolsheets.AbstractPufPoolSheet.java
License:Open Source License
protected PdfPCell getCellWithBorder(PdfPCell prototype, int border, int rowspan, int colspan) { PdfPCell cell = new PdfPCell(prototype); cell.setBorder(border); cell.setColspan(colspan);/*from w ww. j a v a 2s . co m*/ cell.setRowspan(rowspan); return cell; }
From source file:be.rheynaerde.poolsheets.AbstractPufPoolSheet.java
License:Open Source License
protected PdfPCell getEmptyCell() { PdfPCell emptyCell = new PdfPCell(); emptyCell.setBorder(Rectangle.NO_BORDER); emptyCell.setFixedHeight(configuration.getSquareCellSize()); return emptyCell; }
From source file:be.rheynaerde.poolsheets.AbstractPufPoolSheet.java
License:Open Source License
protected PdfPCell getNameCell(String text) { PdfPCell nameCell = text == null ? new PdfPCell() : new PdfPCell(new Phrase(text)); nameCell.setBorder(Rectangle.BOTTOM); nameCell.setHorizontalAlignment(Element.ALIGN_CENTER); nameCell.setVerticalAlignment(Element.ALIGN_MIDDLE); nameCell.setFixedHeight(configuration.getSquareCellSize()); return nameCell; }
From source file:be.rheynaerde.poolsheets.StandardPoolSheet.java
License:Open Source License
@Override protected PdfPCell getBoutCell(BoutOrder mo, int boutNumber) { PdfPCell cell = new PdfPCell(); int firstPlayerOfBout = mo.getFirstPlayerOfBout(boutNumber); int secondPlayerOfBout = mo.getSecondPlayerOfBout(boutNumber); String player1 = configuration.getNamePlayer(firstPlayerOfBout); String player2 = configuration.getNamePlayer(secondPlayerOfBout); cell.addElement(getBout(player1 != null ? player1 : Integer.toString(firstPlayerOfBout), player2 != null ? player2 : Integer.toString(secondPlayerOfBout))); cell.setBorder(Rectangle.NO_BORDER); return cell;/*from w w w.j a va 2s .c om*/ }
From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java
License:Open Source License
private PdfPCell cell(Phrase p) { final PdfPCell cell = new PdfPCell(p); cell.setBorder(0); return cell; }
From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java
License:Open Source License
private PdfPCell cellD(Phrase p, boolean invert) { final PdfPCell cell = new PdfPCell(p); cell.setBorder(0); cell.setPadding(5f);/* w w w.j a v a 2s.com*/ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (invert) { cell.setBackgroundColor(iTextUtil.getSilver()); } return cell; }
From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java
License:Open Source License
private PdfPCell cellH(Phrase p) { final PdfPCell cell = new PdfPCell(p); cell.setBackgroundColor(iTextUtil.getPurple()); cell.setPadding(5f);//from w w w . j ava2 s .c o m cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); return cell; }
From source file:be.roots.taconic.pricingguide.service.PDFServiceImpl.java
License:Open Source License
private PdfPCell cell(PdfPTable p) { final PdfPCell cell = new PdfPCell(p); cell.setBorder(0); return cell; }
From source file:be.zenodotus.creatie.GeneratePDF.java
License:Open Source License
public String vakantieAfdruk(Context context, String name, int jaar) { this.context = context; PdfWriter w = null;/*from w w w. jav a 2 s . c o m*/ Document d = new Document(PageSize.A4.rotate(), 5, 5, 10, 10); d.setPageCount(3); String fileName = name; String file = name; GregorianCalendar datum = new GregorianCalendar(); datum.set(GregorianCalendar.YEAR, jaar); String[] maanden = { "Januari", "Februari", "Maart", "April", "Mei", "Juni", "Juli", "Augustus", "September", "Oktober", "November", "December" }; int[] dagen = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; VerlofDao dao = new VerlofDao(context); FeestdagDao feestdagDao = new FeestdagDao(context); WerkdagDao werkdagDao = new WerkdagDao(context); File folder = new File(context.getFilesDir(), "pdfs"); folder.mkdirs(); if (datum.isLeapYear(jaar)) { dagen[1] = 29; } File temp = null; temp = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "Jacqueline" + jaar + ".pdf"); fileName = temp.toString(); try { dao.open(); ArrayList<Verlof> verloflijst = dao.getAlleVerlovenPerJaar(jaar); w = PdfWriter.getInstance(d, new FileOutputStream(temp)); d.open(); d.addAuthor("Jacqueline Vandenbroecke"); d.addCreationDate(); d.addCreator("Verlofplanner"); d.addTitle("Vakantie " + jaar + " van Jacqueline Vandenbroecke"); Font standaard = FontFactory.getFont(FontFactory.HELVETICA, 8); Font standaardBold = FontFactory.getFont(FontFactory.HELVETICA, 8, Font.BOLD); Paragraph gegeven = new Paragraph("Jacqueline Vandenbroecke Verlof " + jaar + "\n", standaardBold); gegeven.setAlignment(Paragraph.ALIGN_CENTER); d.add(gegeven); for (int paginas = 0; paginas < 2; paginas++) { int aantal = 0; if (paginas == 1) { d.newPage(); aantal = 6; } PdfPTable table = new PdfPTable(6); for (int i = aantal; i < (aantal + 6); i++) { PdfPCell cell = new PdfPCell(new Paragraph(maanden[i], standaardBold)); cell.setBorder(1); table.addCell(cell); } int dag = 1; int k = aantal; for (int i = aantal; i < (aantal + 6); i++) { for (int j = 0; j < 32; j++) { if (k > ((aantal + 6) - 1)) { k = aantal; dag++; } if (dag > dagen[k]) { PdfPCell cell = new PdfPCell(new Paragraph("", standaard)); table.addCell(cell); k++; } else { SimpleDateFormat formatterDag = new SimpleDateFormat("dd"); SimpleDateFormat formatterWeek = new SimpleDateFormat("EEE"); datum.set(jaar, k, dag); PdfPTable dagTabel = new PdfPTable(4); PdfPCell cellDag = new PdfPCell( new Paragraph(formatterDag.format(datum.getTime()), standaard)); PdfPCell cellWeek = new PdfPCell( new Paragraph(formatterWeek.format(datum.getTime()), standaard)); ArrayList<Verlof> verlof = new ArrayList<Verlof>(); for (int z = 0; z < verloflijst.size(); z++) { if (((verloflijst.get(z).getDag() + 1) == dag) && (verloflijst.get(z).getMaand() == k)) { verlof.add(verloflijst.get(z)); } } feestdagDao.open(); Feestdag feestdag = feestdagDao.getFeestdag(jaar, datum.get(GregorianCalendar.MONTH), datum.get(GregorianCalendar.DATE)); feestdagDao.close(); werkdagDao.open(); java.util.List<Werkdag> weekend = werkdagDao.getWeekend(); werkdagDao.close(); String Verlof = ""; String uur = ""; if (verlof.size() > 0) { if (verlof.size() > 1) { Verlof = verlof.get(0).getVerlofsoort() + "\n" + verlof.get(1).getVerlofsoort(); uur = verlof.get(0).getUrental() + "\n" + verlof.get(1).getUrental(); } else { Verlof = verlof.get(0).getVerlofsoort(); uur = verlof.get(0).getUrental(); } } PdfPCell cellVerlof = new PdfPCell(new Paragraph(Verlof, standaard)); PdfPCell uren = new PdfPCell(new Paragraph(uur, standaard)); if (verlof.size() > 0) { BaseColor kleur = new BaseColor(Color.GRAY); cellVerlof.setBackgroundColor(kleur); uren.setBackgroundColor(kleur); cellDag.setBackgroundColor(kleur); cellWeek.setBackgroundColor(kleur); } for (int z = 0; z < weekend.size(); z++) { if ((formatterWeek.format(datum.getTime())).equals(weekend.get(z).getDag())) { BaseColor kleur = new BaseColor(Color.LTGRAY); cellVerlof.setBackgroundColor(kleur); uren.setBackgroundColor(kleur); cellDag.setBackgroundColor(kleur); cellWeek.setBackgroundColor(kleur); } } if (feestdag != null) { BaseColor kleur = new BaseColor(Color.GREEN); uren.setBackgroundColor(kleur); cellVerlof.setBackgroundColor(kleur); uren.setBackgroundColor(kleur); cellDag.setBackgroundColor(kleur); cellWeek.setBackgroundColor(kleur); } dagTabel.addCell(cellDag); dagTabel.addCell(cellWeek); dagTabel.addCell(cellVerlof); dagTabel.addCell(uren); table.addCell(dagTabel); k++; } } } d.add(table); dao.close(); } } catch (Exception ex) { ex.printStackTrace(); } finally { d.close(); w.close(); } return fileName; }