List of usage examples for com.itextpdf.text.pdf PdfPCell setBorderWidth
public void setBorderWidth(final float borderWidth)
From source file:com.softwaremagico.tm.pdf.complete.elements.BaseElement.java
License:Open Source License
protected PdfPCell getCell(String text, int border, int colspan, int align, BaseColor color, String font, int fontSize, int fontType) { if (text == null) { text = ""; }/*ww w . ja v a2s.co m*/ Paragraph p = new Paragraph(text, FontFactory.getFont(font, fontSize, fontType)); PdfPCell cell = new PdfPCell(p); cell.setColspan(colspan); cell.setBorderWidth(border); cell.setHorizontalAlignment(align); cell.setBackgroundColor(color); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.elements.CustomPdfTable.java
License:Open Source License
protected PdfPCell getCell(Paragraph paragraph, int border, int colspan, int align) { PdfPCell cell = new PdfPCell(paragraph); cell.setColspan(colspan);/*from w ww .j a va2 s. c o m*/ cell.setBorderWidth(border); cell.setHorizontalAlignment(align); return cell; }
From source file:com.softwaremagico.tm.pdf.complete.others.AnnotationsTable.java
License:Open Source License
public AnnotationsTable() { super(WIDTHS, false); PdfPCell cell = createLateralVerticalTitle(getTranslator().getTranslatedText("annotationsTable"), 2); cell.setBorderWidth(2); addCell(cell);//from w w w . ja v a2 s. c o m cell = createSubtitleLine(getTranslator().getTranslatedText("characterAnnotations")); cell.setBorderWidth(0); addCell(cell); cell = createSubtitleLine(getTranslator().getTranslatedText("historyAnnotations")); cell.setBorderWidth(2); addCell(cell); }
From source file:com.softwaremagico.tm.pdf.small.SmallCharacterSheet.java
License:Open Source License
protected PdfPTable createCharacterContent(CharacterPlayer characterPlayer) throws Exception { float[] widths = { 2.2f, 1f }; PdfPTable mainTable = new PdfPTable(widths); BaseElement.setTablePropierties(mainTable); mainTable.getDefaultCell().setPadding(0); PdfPTable infoTable = CharacterBasicsReducedTableFactory.getCharacterBasicsTable(characterPlayer); PdfPCell infoCell = new PdfPCell(infoTable); infoCell.setBorderWidthTop(0);/*w w w .ja v a 2s .co m*/ infoCell.setBorderWidthLeft(0); infoCell.setBorderWidthBottom(1); mainTable.addCell(infoCell); PdfPTable learnedSkillsTable = LearnedSkillsTable.getSkillsTable(characterPlayer, getLanguage()); PdfPCell learnedSkillsCell = new PdfPCell(learnedSkillsTable); learnedSkillsCell.setColspan(2); learnedSkillsCell.setRowspan(3); learnedSkillsCell.setBorderWidthTop(0); learnedSkillsCell.setBorderWidthRight(0); mainTable.addCell(learnedSkillsCell); PdfPTable basicTable = new PdfPTable(new float[] { 5f, 4f }); BaseElement.setTablePropierties(basicTable); basicTable.getDefaultCell().setBorder(0); PdfPTable characteristicsTable = CharacteristicsTableFactory.getCharacteristicsBasicsTable(characterPlayer); PdfPCell characteristicCell = new PdfPCell(characteristicsTable); characteristicCell.setBorderWidthLeft(0); basicTable.addCell(characteristicCell); PdfPTable naturalSkillsTable = NaturalSkillsTable.getSkillsTable(characterPlayer, getLanguage()); PdfPCell naturalSkillsCell = new PdfPCell(naturalSkillsTable); naturalSkillsCell.setBorderWidthRight(0); basicTable.addCell(naturalSkillsCell); PdfPCell basicComposedCell = new PdfPCell(basicTable); basicComposedCell.setBorder(0); mainTable.addCell(basicComposedCell); PdfPTable composedTable = new PdfPTable(new float[] { 5f, 2f }); PdfPTable blessingsTable = new BlessingTable(characterPlayer); PdfPCell blessingsCell = new PdfPCell(blessingsTable); blessingsCell.setBorderWidthLeft(0); blessingsCell.setBorderWidthBottom(1); composedTable.addCell(blessingsCell); PdfPTable beneficesTable = new BeneficesTable(characterPlayer); PdfPCell beneficesCell = new PdfPCell(beneficesTable); beneficesCell.setBorderWidthBottom(1); composedTable.addCell(beneficesCell); PdfPCell composedCell = new PdfPCell(composedTable); composedCell.setRowspan(2); composedCell.setBorder(0); mainTable.addCell(composedCell); PdfPTable armourTable = new ArmourTable(characterPlayer); PdfPCell armourCell = new PdfPCell(armourTable); armourCell.setBorderWidthRight(0); armourCell.setBorderWidthBottom(1); mainTable.addCell(armourCell); PdfPTable fightTable = new PdfPTable(new float[] { 3f, 5f, 1f }); if (characterPlayer != null && (characterPlayer.getSelectedPowers().isEmpty() && !characterPlayer.getCybernetics().isEmpty())) { PdfPTable cyberneticsTable = new CyberneticsTable(characterPlayer); PdfPCell cyberneticsCell = new PdfPCell(cyberneticsTable); cyberneticsCell.setBorderWidthLeft(0); fightTable.addCell(cyberneticsCell); } else { PdfPTable occultismTable = new OccultismTable(characterPlayer, getLanguage()); PdfPCell occultismCell = new PdfPCell(occultismTable); occultismCell.setBorderWidthLeft(0); fightTable.addCell(occultismCell); } PdfPTable weaponsTable = new WeaponsTable(characterPlayer); fightTable.addCell(weaponsTable); PdfPCell victoryPointsCell = new PdfPCell(new VerticalVictoryPointsTable()); victoryPointsCell.setPadding(0); victoryPointsCell.setRowspan(3); fightTable.addCell(victoryPointsCell); PdfPTable vitalityTable = new VitalityTable(characterPlayer); PdfPCell vitalityCell = new PdfPCell(vitalityTable); vitalityCell.setColspan(2); vitalityCell.setBorderWidth(1); fightTable.addCell(vitalityCell); PdfPTable wyrdTable = new WyrdTable(characterPlayer); PdfPCell wyrdCell = new PdfPCell(wyrdTable); wyrdCell.setBorderWidth(1); wyrdCell.setColspan(2); fightTable.addCell(wyrdCell); PdfPCell fightCell = new PdfPCell(fightTable); fightCell.setBorder(0); fightCell.setColspan(2); mainTable.addCell(fightCell); return mainTable; }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void createTable(Document doc, EnableRequerimentTypeFederalEnum type, EnableRequerimentSubjectFederalEnum subject, LicensePFEntity license, UserEntity user) throws DocumentException { // create PDF table with the given widths PdfPTable table = new PdfPTable(4); // set table width a percentage of the page width table.setWidthPercentage(100f);// w w w . j av a2 s . com // Alterao Cadastral this.createAlteracaoCadastral(table, type, subject); // Dados da Empresa this.createCompany(table, license); // Dados do Representante this.createRepresentant(table, user); // Deferimento this.createDeferiment(table, license.getCompany()); // Uso Oficial this.insertCellProtocol(table, license); // Table pai PdfPTable tableFather = new PdfPTable(1); tableFather.setWidthPercentage(100f); PdfPCell cellFather = new PdfPCell(table); cellFather.setBorderWidth(2); tableFather.addCell(cellFather); doc.add(this.createHeader()); doc.add(tableFather); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertCellAlteracao(PdfPTable table, String text) { if (text == null) { text = ""; }//from www . j a v a 2 s . c o m // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER)); // set the cell alignment // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorderWidth(2); cell.setPadding(3f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java
private void insertHeaderCell(PdfPTable table, String text, Integer colSpan) { if (text == null) { text = ""; }// w w w.ja va2s . co m // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER)); // set the cell alignment // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(colSpan); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorderWidth(2); cell.setPadding(3f); // add the call to the table table.addCell(cell); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java
private void createTable(Document doc, RequerimentFederalEnum type, LicensePFEntity license, List<ProductOfficialEntity> listProducts) throws DocumentException { // create PDF table with the given widths PdfPTable table = new PdfPTable(4); // set table width a percentage of the page width table.setWidthPercentage(100f);/*from w ww. java2s . c o m*/ this.createCompany(table, license); // Alterao Cadastral this.createAlteracaoCadastral(table, type); // Descrio this.insertHeaderCell(table, "3 - DESCREVER AS PRINCIPAIS ALTERAES OCORRIDAS", 4); this.insertCell(table, this.createProductsText(listProducts, type), 4); // Uso Oficial this.insertCellProtocol(table, license); // Footer this.createFooter(table); // Table pai PdfPTable tableFather = new PdfPTable(1); tableFather.setWidthPercentage(100f); PdfPCell cellFather = new PdfPCell(table); cellFather.setBorderWidth(2); tableFather.addCell(cellFather); doc.add(this.createHeader()); doc.add(tableFather); }
From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java
private void insertHeaderCell(PdfPTable table, String text, Integer colSpan) { if (text == null) { text = ""; }/* w ww. j av a 2 s. c o m*/ // create a new cell with the specified Text and Font PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER)); // set the cell alignment // in case there is no text and you wan to create an empty row if (text.trim().equalsIgnoreCase("")) { cell.setMinimumHeight(10f); } cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(colSpan); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setBorderWidth(2); cell.setPadding(3f); // add the call to the table table.addCell(cell); }
From source file:com.timesheet.export.PdfGenerator.java
@Override protected void buildPdfDocument(Map<String, Object> model, Document document, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception { /* Add header*/ Font fontHeader = FontFactory.getFont(FontFactory.TIMES_ROMAN, 22, Font.BOLD); Paragraph headerPara = new Paragraph("Time sheet report", fontHeader); headerPara.setSpacingAfter(20f);//from w w w .j a v a2 s.co m document.add(headerPara); /*Add user info*/ User userProfile = (User) model.get("userprofile"); Font fontUserInfo = FontFactory.getFont(FontFactory.TIMES_ROMAN, 16, Font.BOLD); document.add(new Paragraph("Name : " + userProfile.getName(), fontUserInfo)); document.add(new Paragraph("User no. : " + userProfile.getUserIdentifier(), fontUserInfo)); document.add(new Paragraph("Department : " + userProfile.getDepartment(), fontUserInfo)); document.add(new Paragraph("Email : " + userProfile.getEmail(), fontUserInfo)); Paragraph spacing = new Paragraph(""); spacing.setSpacingAfter(20f); document.add(spacing); PdfPTable table = new PdfPTable(5); table.setWidthPercentage(100.0f); table.setWidths(new float[] { 5.0f, 3.0f, 3.0f, 3.0f, 10.0f }); table.setSpacingBefore(10); // define font for table header row Font font = FontFactory.getFont(FontFactory.TIMES_ROMAN, 12, Font.BOLD); //font.setColor(BaseColor.WHITE); // define table header cell PdfPCell cell = new PdfPCell(); //cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPadding(5); cell.setBorderWidth(2.0f); cell.setBorder(Rectangle.BOTTOM); // get data model which is passed by the Spring container List<Booking> bookings = (List<Booking>) model.get("bookings"); // write table header cell.setPhrase(new Phrase("Project", font)); table.addCell(cell); // write table header cell.setPhrase(new Phrase("Option", font)); table.addCell(cell); // write table header cell.setPhrase(new Phrase("Date", font)); table.addCell(cell); // write table header cell.setPhrase(new Phrase("Duration", font)); table.addCell(cell); // write table header cell.setPhrase(new Phrase("Description", font)); table.addCell(cell); int sum = 0; Font fontData = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11); for (Booking booking : bookings) { PdfPCell cell1 = new PdfPCell(new Phrase( booking.getProject().getProjectId() + "-" + booking.getProject().getName(), fontData)); cell1.setBorder(Rectangle.BOTTOM); cell1.setPadding(5); table.addCell(cell1); PdfPCell cell2 = new PdfPCell(new Phrase(booking.getBookingOption().getOptionLabel(), fontData)); cell2.setBorder(Rectangle.BOTTOM); cell2.setPadding(5); table.addCell(cell2); PdfPCell cell3 = new PdfPCell(new Phrase(formatDate(booking.getBookingDate()), fontData)); cell3.setBorder(Rectangle.BOTTOM); cell3.setPadding(5); table.addCell(cell3); int hh = booking.getDuration() / 60; int mm = booking.getDuration() % 60; PdfPCell cell4 = new PdfPCell(new Phrase(hh + ":" + mm, fontData)); cell4.setBorder(Rectangle.BOTTOM); cell4.setPadding(5); table.addCell(cell4); PdfPCell cell5 = new PdfPCell( new Phrase(StringEscapeUtils.escapeHtml(booking.getDescription()), fontData)); cell5.setBorder(Rectangle.BOTTOM); cell5.setPadding(5); table.addCell(cell5); sum += booking.getDuration(); } document.add(table); int sumHH = sum / 60; int sumMM = sum % 60; document.add(new Paragraph("Sum : " + sumHH + ":" + sumMM, fontUserInfo)); //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }