List of usage examples for com.itextpdf.text.pdf PdfPCell setPaddingTop
public void setPaddingTop(float paddingTop)
From source file:com.softwaremagico.tm.pdf.complete.elements.BaseElement.java
License:Open Source License
public static PdfPCell createLogoCell() throws DocumentException, IOException { Image image = Image.getInstance( CharacterBasicsCompleteTableFactory.class.getResource("/" + FadingSunsTheme.LOGO_IMAGE)); PdfPCell cell = new PdfPCell(image, true); setCellProperties(cell);/*from ww w.j a v a 2 s.com*/ cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingTop(10); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.skills.CounterTable.java
License:Open Source License
protected PdfPCell createValue(String text, Font font, int alignment) { Phrase content = new Phrase(text, font); PdfPCell circleCell = new PdfPCell(content); // Not putting correctly the "o" at the center of the cell. // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment circleCell.setPaddingTop(-4f); circleCell.setHorizontalAlignment(Element.ALIGN_CENTER); circleCell.setVerticalAlignment(alignment); circleCell.setBorder(0);//from www.java2 s.c o m // Some position corrections. circleCell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / CIRCLES) + 1.3f); return circleCell; }
From source file:com.softwaremagico.tm.pdf.small.counters.CounterTable.java
License:Open Source License
protected PdfPCell createValue(String text, Font font, int alignment) { Phrase content = new Phrase(text, font); PdfPCell circleCell = new PdfPCell(content); // Not putting correctly the "o" at the center of the cell. // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment circleCell.setPaddingTop(paddingTop); circleCell.setHorizontalAlignment(Element.ALIGN_CENTER); circleCell.setVerticalAlignment(alignment); circleCell.setBorder(0);/*w w w . j av a2 s. c om*/ circleCell.setMinimumHeight(20); return circleCell; }
From source file:com.softwaremagico.tm.pdf.small.counters.VitalityTable.java
License:Open Source License
public VitalityTable(CharacterPlayer characterPlayer) { super(characterPlayer); getDefaultCell().setBorder(0);/*from www . j a v a2 s . c om*/ Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_VITALITY_TITLE_FONT_SIZE); Phrase content = new Phrase(getTranslator().getTranslatedText("vitality"), font); PdfPCell titleCell = new PdfPCell(content); titleCell.setBorder(0); titleCell.setPaddingRight(0); titleCell.setPaddingTop(paddingTop); titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); addCell(titleCell); addedCircle = 0; for (int i = 0; i < getNumberOfCircles(); i++) { addCell(getCircle()); addedCircle++; } }
From source file:com.softwaremagico.tm.pdf.small.counters.VitalityTable.java
License:Open Source License
@Override protected PdfPCell createCircle() { if (addedCircle >= 5) { return super.createCircle(); }//from ww w . j ava 2 s .c o m PdfPCell cell = createValue("-" + (10 - addedCircle * 2), new Font(FadingSunsTheme.getLineFontBold(), FadingSunsTheme.CHARACTER_VITALITY_PENALTIES_TITLE_FONT_SIZE), Element.ALIGN_MIDDLE); cell.setPaddingTop(0f); cell.setPaddingRight(-2f); return cell; }
From source file:com.softwaremagico.tm.pdf.small.counters.WyrdTable.java
License:Open Source License
public WyrdTable(CharacterPlayer characterPlayer) { super(characterPlayer); getDefaultCell().setBorder(0);/*from www .j a va 2 s .c om*/ Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_VITALITY_TITLE_FONT_SIZE); Phrase content = new Phrase(getTranslator().getTranslatedText("wyrd"), font); PdfPCell titleCell = new PdfPCell(content); titleCell.setBorder(0); titleCell.setPaddingTop(paddingTop); titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE); addCell(titleCell); addedCircle = 0; for (int i = 0; i < getNumberOfCircles(); i++) { addCell(getCircle()); addedCircle++; } }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellAlteracaoOption(PdfPTable table, String number, String text, Boolean selected) { String fullText = ""; if (selected) { fullText += number + " |X|" + " " + text; } else {// w ww.j av a 2s . c om fullText += number + " | |" + " " + text; } if (StringUtils.isBlank(number) && StringUtils.isBlank(text)) { fullText = ""; } // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(fullText.trim(), FONT_PARAGRAPH)); // set the cell alignment // in case there is no text and you wan to create an empty row if (fullText.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(Rectangle.RIGHT); cell.setPaddingTop(10f); cell.setPaddingBottom(10f); cell.setPaddingLeft(10f); cell.setPaddingRight(10f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java
private void insertCellAlteracaoOption(PdfPTable table, String number, String text, Boolean selected) { String fullText = ""; if (selected) { fullText += number + " |X|" + " " + text; } else {// w w w . java 2 s . com fullText += number + " | |" + " " + text; } if (StringUtils.isBlank(number) && StringUtils.isBlank(text)) { fullText = ""; } // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(fullText.trim(), FONT_PARAGRAPH)); // set the cell alignment // in case there is no text and you wan to create an empty row if (fullText.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setColspan(2); cell.setBorder(Rectangle.RIGHT); cell.setPaddingTop(10f); cell.setPaddingBottom(10f); cell.setPaddingLeft(25f); cell.setPaddingRight(25f); // add the call to the table table.addCell(cell); }
From source file:com.vectorprint.report.itext.style.stylers.Padding.java
License:Open Source License
public PdfPCell style(PdfPCell cell, Object data) { switch (getWhichPadding()) { case LEFT:/*from w w w .ja va2 s . com*/ case LB: case LBT: case LR: case LRB: case LRT: case LT: case TRBL: cell.setPaddingLeft(getPadding()); } switch (getWhichPadding()) { case LBT: case LRT: case LT: case TRBL: case RBT: case RT: case TOP: case BT: cell.setPaddingTop(getPadding()); } switch (getWhichPadding()) { case LB: case LBT: case LRB: case TRBL: case RB: case RBT: case BOTTOM: case BT: cell.setPaddingBottom(getPadding()); } switch (getWhichPadding()) { case LR: case LRB: case LRT: case TRBL: case RIGHT: case RB: case RBT: case RT: cell.setPaddingRight(getPadding()); } return cell; }
From source file:de.aidger.utils.pdf.ActivityReportConverter.java
License:Open Source License
/** * Creates the table of employments./*from w w w. j a va2s . c o m*/ */ private void createTable() { try { Font tableTitleFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 10); String[] tableTitles = { "Zeitraum", "Veranstaltung", "Umfang" }; PdfPTable contentTable = new PdfPTable(1); PdfPTable titleTable = new PdfPTable(new float[] { 0.2f, 0.6f, 0.2f }); /* * Create the titles of the table entries. */ for (int i = 0; i < tableTitles.length; i++) { PdfPCell cell = new PdfPCell(new Phrase(tableTitles[i], tableTitleFont)); titleTable.addCell(cell); } PdfPCell cell = new PdfPCell(titleTable); cell.setPaddingTop(10.0f); cell.setPaddingBottom(2.0f); cell.setBorder(0); contentTable.addCell(cell); cell = new PdfPCell(addRows()); cell.setBorder(0); contentTable.addCell(cell); float xPos = 60, yPos = 500, width = reader.getPageSize(1).getWidth() - 120f; if (form.getFieldPositions("TableField") != null) { FieldPosition position = form.getFieldPositions("TableField").get(0); xPos = position.position.getLeft(); yPos = position.position.getTop(); width = position.position.getWidth(); } contentTable.setTotalWidth(width); contentTable.writeSelectedRows(0, -1, xPos, yPos, contentByte); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }