List of usage examples for com.itextpdf.text Element ALIGN_MIDDLE
int ALIGN_MIDDLE
To view the source code for com.itextpdf.text Element ALIGN_MIDDLE.
Click Source Link
From source file:com.softwaremagico.tm.pdf.small.counters.CounterTable.java
License:Open Source License
protected PdfPCell createCircle() { PdfPCell cell = createValue("O", new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_COUNTER_POINT_SIZE), Element.ALIGN_MIDDLE); return cell;/*from w w w. j a v a 2s .c o m*/ }
From source file:com.softwaremagico.tm.pdf.small.counters.VitalityTable.java
License:Open Source License
public VitalityTable(CharacterPlayer characterPlayer) { super(characterPlayer); getDefaultCell().setBorder(0);// w w w.j a v a 2s .co m 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(); }// w w w . jav a 2s .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 w w w .j a v a 2s .c o m 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.softwaremagico.tm.pdf.small.fighting.ArmourTable.java
License:Open Source License
public ArmourTable(CharacterPlayer characterPlayer) { super(new float[] { 2.2f, 3 }); getDefaultCell().setBorder(0);/* w ww . ja v a 2 s . co m*/ // Armor Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_SMALL_ARMOR_TITLE_FONT_SIZE); Phrase content = new Phrase(getTranslator().getTranslatedText("armor"), font); PdfPCell titleCell = new PdfPCell(content); titleCell.setBorder(0); addCell(titleCell); PdfPCell nameCell; if (characterPlayer == null) { nameCell = CustomPdfTable.createEmptyElementLine(GAP, NAME_COLUMN_WIDTH); } else if (characterPlayer.getArmour() == null) { nameCell = createElementLine("", NAME_COLUMN_WIDTH); } else { nameCell = createElementLine(characterPlayer.getArmour().getName() + "(" + characterPlayer.getArmour().getProtection() + "d)", NAME_COLUMN_WIDTH, FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE - 1); } nameCell.setBorder(0); nameCell.setHorizontalAlignment(Element.ALIGN_LEFT); addCell(nameCell); // Shield addCell(getShieldRange(characterPlayer)); Paragraph paragraph = new Paragraph(); paragraph.add(new Paragraph(getTranslator().getTranslatedText("shieldHits") + ": ", new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE))); if (characterPlayer != null && characterPlayer.getShield() != null) { paragraph.add(new Paragraph(characterPlayer.getShield().getHits() + "-", new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.getHandWrittingFontSize(FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)))); } PdfPCell shieldCell = new PdfPCell(paragraph); shieldCell.setVerticalAlignment(Element.ALIGN_MIDDLE); shieldCell.setBorder(0); addCell(shieldCell); }
From source file:com.softwaremagico.tm.pdf.small.fighting.ArmourTable.java
License:Open Source License
private PdfPTable getShieldRange(CharacterPlayer characterPlayer) { float[] widths = { 1f, 3f, 1f, 3f, 1f }; PdfPTable table = new PdfPTable(widths); BaseElement.setTablePropierties(table); table.getDefaultCell().setBorder(0); table.getDefaultCell().setPadding(0); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(createEmptyElementLine("(")); if (characterPlayer == null || characterPlayer.getShield() == null) { table.addCell(createEmptyElementLine(" ", ARMOUR_VALUE_COLUMN_WIDTH)); } else {/*from ww w . j av a 2 s. co m*/ table.addCell( createElementLine(characterPlayer.getShield().getImpact() + "", ARMOUR_VALUE_COLUMN_WIDTH)); } table.addCell(createEmptyElementLine("/")); if (characterPlayer == null || characterPlayer.getShield() == null) { table.addCell(createEmptyElementLine(" ", ARMOUR_VALUE_COLUMN_WIDTH)); } else { table.addCell( createElementLine(characterPlayer.getShield().getForce() + "", ARMOUR_VALUE_COLUMN_WIDTH)); } table.addCell(createEmptyElementLine(")")); return table; }
From source file:com.softwaremagico.tm.pdf.small.victorytable.VerticalVictoryPointsTable.java
License:Open Source License
private static PdfPCell createLine(String text, BaseColor color) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFont(), FadingSunsTheme.VICTORY_SMALL_POINTS_FONT_SIZE); cell.setMinimumHeight(12);/*from ww w . ja v a 2 s.c o m*/ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell; }
From source file:com.softwaremagico.tm.pdf.small.victorytable.VerticalVictoryPointsTable.java
License:Open Source License
private static PdfPCell createSubTitle(String text, BaseColor color) { PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, color, FadingSunsTheme.getLineFontBold(), FadingSunsTheme.VICTORY_SMALL_POINTS_FONT_SIZE + 1); cell.setMinimumHeight(18);/* w w w . ja va 2 s. c om*/ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); return cell; }
From source file:com.tomasz.drag.triballocommanderro.controller.MakerPDF.java
public static void printToPDFBoss(ArrayList<Person> workers, EventGig event) throws IOException, DocumentException { String filename = event.getName() + " Boss" + ".pdf"; String path = event.getData() + " " + event.getName() + "//"; //Rectangle rect = new Rectangle(0, 595, 8, 0); Document document = new Document(PageSize.A4.rotate(), 0, 0, 0, 0); //Document document = new Document(rect); //document.setMargins(0, 0, 0, 0); BaseFont bf;//from w ww.j a v a2s .com //BaseFont bf2; // bf = BaseFont.createFont("arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); bf = BaseFont.createFont("src\\main\\resources\\font\\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); //bf2 = BaseFont.createFont("src\\main\\resources\\font\\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); com.itextpdf.text.Font ft = new com.itextpdf.text.Font(bf, 9); //com.itextpdf.text.Font ft2 = new com.itextpdf.text.Font(bf2,9); PdfWriter.getInstance(document, new FileOutputStream(path + filename)); document.open(); Paragraph p = new Paragraph(event.getName() + " " + event.getData(), ft); p.setAlignment(Element.ALIGN_CENTER); document.add(p); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(workers.size() + 1); table.setWidthPercentage(98); PdfPCell cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); for (Person tempPerson : workers) { cell = new PdfPCell(new Paragraph(tempPerson.getName(), ft)); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); } if (event.isZaladunekScenaDach()) { cell = new PdfPCell(new Paragraph("Za. Sc./Dach", ft)); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getZaladunekScenaDachWyplata() > 0) { cell = new PdfPCell( new Paragraph(String.format("%.2f", tempPerson.getZaladunekScenaDachWyplata()), ft)); cell.setVerticalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isZaladunekTechniki()) { cell = new PdfPCell(new Phrase("Za. Tech.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getZaladunekTechnikiWyplata() > 0) { cell = new PdfPCell( new Paragraph(String.format("%.2f", tempPerson.getZaladunekTechnikiWyplata()), ft)); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isRozladunekScenaDach()) { cell = new PdfPCell(new Phrase("Roz Sc/Dach", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getRozladunekScenaDachWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getRozladunekScenaDachWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isRozladunekTechniki()) { cell = new PdfPCell(new Phrase("Roz. Tech.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getRozladunekTechnikiWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getRozladunekTechnikiWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isMontazDachu()) { cell = new PdfPCell(new Phrase("Mon. Dach", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getMontazDachuWyplata() > 0) { cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getMontazDachuWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isMontazDzwieku()) { cell = new PdfPCell(new Phrase("Mon. Dw.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getMontazDzwiekuWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getMontazDzwiekuWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isMontazSceny()) { cell = new PdfPCell(new Phrase("Mon. Sc.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getMontazScenyWyplata() > 0) { cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getMontazScenyWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isMontazSwiatla()) { cell = new PdfPCell(new Phrase("Mon. w.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getMontazSwiatlaWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getMontazSwiatlaWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isMontazTechniki()) { cell = new PdfPCell(new Phrase("Mon. Tech.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getMontazTechnikiWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getMontazTechnikiWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isDemontazDachu()) { cell = new PdfPCell(new Phrase("Dem. Dach", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getDemontazDachuWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getDemontazDachuWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isDemontazDzwieku()) { cell = new PdfPCell(new Phrase("Dem. Dw.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getDemontazDzwiekuWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getDemontazDzwiekuWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isDemontazSceny()) { cell = new PdfPCell(new Phrase("Dem. Sc.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getDemontazScenyWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getDemontazScenyWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isDemontazSwiatla()) { cell = new PdfPCell(new Phrase("Dem. w.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getDemontazSwiatlaWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getDemontazSwiatlaWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isDemontazTechniki()) { cell = new PdfPCell(new Phrase("Dem. Tech.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getDemontazTechnikiWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getDemontazTechnikiWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isDyzur()) { cell = new PdfPCell(new Phrase("Dyur", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getDyzurWyplata() > 0) { cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getDyzurWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase("")); table.addCell(cell); } } } if (event.isTechnikSceny()) { cell = new PdfPCell(new Phrase("Technik Sc.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getTechnikScenyWyplata() > 0) { cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getTechnikScenyWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isRealizacjaFOH()) { cell = new PdfPCell(new Phrase("Real. FOH", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getRealizacjaFOHWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getRealizacjaFOHWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isRealizacjaMON()) { cell = new PdfPCell(new Phrase("Real. MON", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getRealizacjaMONWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getRealizacjaMONWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (event.isRealizacjaSwiatla()) { cell = new PdfPCell(new Phrase("Real. w.", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getRealizacjaSwiatlaWyplata() > 0) { cell = new PdfPCell( new Phrase(String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } if (true) { cell = new PdfPCell(new Phrase("Premia", ft)); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getPremia() > 0) { cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getPremia()), ft)); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } } Paragraph ph = new Paragraph("Razem", ft); //cell = new PdfPCell(new Phrase(ph)); cell.addElement(ph); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); for (Person tempPerson : workers) { if (tempPerson.getSumaWyplata() >= 0) { cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getSumaWyplata()) + " z", ft)); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell); } else { cell = new PdfPCell(new Phrase(" ")); table.addCell(cell); } } // for (Object obj : table.getChunks()) { // if (obj instanceof PdfPCell) { // System.out.println("jest PdfCell"); // PdfPCell tempCell = (PdfPCell) obj; // tempCell.setVerticalAlignment(Element.ALIGN_CENTER); // //tempCell.setVerticalAlignment(Element.ALIGN_MIDDLE); // } // // } table.setHorizontalAlignment(Element.ALIGN_CENTER); document.add(table); document.close(); }
From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java
License:Open Source License
protected void addDataHeaderCell(Object configbean, String value, int rowspan, int colspan, int align) { if (dataheadFont == null) { int dataheaderfontsize = 0; if (this.pdfbean != null) dataheaderfontsize = this.pdfbean.getDataheaderfontsize(); if (dataheaderfontsize <= 0) dataheaderfontsize = 6;// w w w . j a v a 2 s . c o m dataheadFont = new Font(PdfAssistant.getInstance().getBfChinese(), dataheaderfontsize, Font.BOLD);//?? } PdfPCell cell = new PdfPCell(new Paragraph(value, dataheadFont)); cell.setColspan(colspan); cell.setRowspan(rowspan); // cell.setImage(img); // cell.addElement(new Paragraph(value+"2222",dataheadFont)); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(align); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); if (pdfbean != null && pdfbean.getInterceptorObj() != null) { pdfbean.getInterceptorObj().displayPerColDataWithoutTemplate(this, configbean, -1, value, cell); } pdfDataTable.addCell(cell); }