List of usage examples for com.itextpdf.text.pdf PdfPCell PdfPCell
public PdfPCell(PdfPCell cell)
PdfPCell
. From source file:be.mxs.common.util.pdf.general.oc.examinations.PDFDrivingLicenseDeclaration.java
private PdfPTable addQuestion(PdfPTable table, int id, String question, String answer) { // cel 1 : nr cell = new PdfPCell(new Phrase(id + "", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); cell.setColspan(1);//from w w w . j ava2s. co m cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); // cel 2-38 : question cell = new PdfPCell(new Phrase(question, FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); cell.setColspan(37); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); // cel 39 and 40 : answer cell = new PdfPCell(new Phrase(getTran(getItemValue(answer)), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); cell.setColspan(2); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); table.addCell(cell); return table; }
From source file:be.rheynaerde.poolsheets.AbstractPoolSheet.java
License:Open Source License
protected void buildTitle(Document document) throws DocumentException { //the title is placed in a one-column table of width 100% PdfPTable table = new PdfPTable(1); table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); table.setWidthPercentage(100f);/*w w w .jav a2s. com*/ //one row for the title PdfPCell cell = new PdfPCell(new Phrase(configuration.getTitle(), configuration.getTitleFont())); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingBottom(10f); table.addCell(cell); //one row for the subtitle cell = new PdfPCell(new Phrase(configuration.getSubtitle(), configuration.getSubtitleFont())); cell.setBorder(Rectangle.NO_BORDER); cell.setBorder(Rectangle.TOP); table.addCell(cell); //make sure that there is some spacing between the title and the scores //20f just seems to work allright, but maybe something more configurable //would be better. table.setSpacingAfter(20f); document.add(table); }
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 v a2s.c o m table.addCell(player2Name); table.addCell(player1Score); table.addCell(player2Score); table.setSpacingBefore(10); return table; }
From source file:be.rheynaerde.poolsheets.AbstractPoolSheet.java
License:Open Source License
protected PdfPCell getHeaderCell(String text) { PdfPCell headerCell = new PdfPCell(new Phrase(text, configuration.getHeaderFont())); headerCell.setHorizontalAlignment(Element.ALIGN_CENTER); headerCell.setVerticalAlignment(Element.ALIGN_MIDDLE); headerCell.setFixedHeight(configuration.getSquareCellSize()); return headerCell; }
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);//from ww w . jav a 2s . c o m cell.setColspan(colspan); cell.setRowspan(rowspan); return cell; }
From source file:be.rheynaerde.poolsheets.ClubPoolSheet.java
License:Open Source License
@Override protected void buildTable(Document document) throws DocumentException { int columnCount = configuration.getNrOfPlayers() + configuration.getSummaryColumnCount() + 3; int nameCellWidth = 5; PdfPTable table = new PdfPTable(columnCount); table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); table.setTotalWidth(//from www . j a v a 2 s . c o m (configuration.getNrOfPlayers() + 1 + nameCellWidth + 0.1f + configuration.getSummaryColumnCount()) * configuration.getSquareCellSize()); table.setLockedWidth(true); float[] widths = new float[columnCount]; widths[0] = 1f * nameCellWidth; for (int i = 1; i < widths.length; i++) { widths[i] = 1f; } widths[widths.length - 1 - configuration.getSummaryColumnCount()] = 0.1f; table.setWidths(widths); PdfPCell cell = new PdfPCell(new Paragraph(configuration.getTitle(), configuration.getTitleFont())); cell.setColspan(columnCount); cell.setPaddingBottom(configuration.getSquareCellSize() / 2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); { table.addCell(getHeaderCell(bundle.getString("name"))); table.addCell(getSolidCell()); for (int i = 0; i < configuration.getNrOfPlayers(); i++) { table.addCell(getHeaderCell(Integer.toString(i + 1))); } table.addCell(new PdfPCell()); //spacer column for (int i = 0; i < configuration.getSummaryColumnCount(); i++) { table.addCell(getHeaderCell(configuration.getSummaryColumnName(i))); } } for (int i = 0; i < configuration.getNrOfPlayers(); i++) { table.addCell(configuration.getNamePlayer(i + 1) == null ? "" : configuration.getNamePlayer(i + 1)); table.addCell(getHeaderCell(Integer.toString(i + 1))); for (int j = 0; j < i; j++) { String result = configuration.getResult(i + 1, j + 1); PdfPCell resultCell = new PdfPCell(new Phrase(result == null ? "" : result)); resultCell.setHorizontalAlignment(Element.ALIGN_CENTER); resultCell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(resultCell); } table.addCell(getSolidCell()); for (int j = i + 1; j < configuration.getNrOfPlayers(); j++) { String result = configuration.getResult(i + 1, j + 1); PdfPCell resultCell = new PdfPCell(new Phrase(result == null ? "" : result)); resultCell.setHorizontalAlignment(Element.ALIGN_CENTER); resultCell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(resultCell); } table.addCell(new PdfPCell()); //spacer column for (int j = 0; j < configuration.getSummaryColumnCount(); j++) { String result = configuration.getSummaryColumnValue(i + 1, j); PdfPCell summaryCell = new PdfPCell(new Phrase(result == null ? "" : result)); summaryCell.setHorizontalAlignment(Element.ALIGN_CENTER); summaryCell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(summaryCell); } } document.add(table); }
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);// w w w .j a va2 s. c o m cell.setPadding(5f); 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);// w w w . ja v a2 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; }