List of usage examples for com.itextpdf.text Phrase Phrase
private Phrase(final boolean dummy)
From source file:com.atacadao.almoxarifado.model.GerandoPDF.java
public void pdfRelatorioSaida(ArrayList<Saida> saidas) { Document documento = new Document(PageSize.A4.rotate()); try {/*from ww w .j a v a 2 s. co m*/ PdfWriter pdf = PdfWriter.getInstance(documento, new FileOutputStream("relatorios.pdf")); Paragraph titulo = new Paragraph("Relatrio de Sada\n\n", new com.itextpdf.text.Font(com.itextpdf.text.Font.FontFamily.HELVETICA, 20, Font.BOLD)); titulo.setAlignment(Element.ALIGN_CENTER); documento.open(); documento.add(titulo); PdfPTable table = new PdfPTable(8); PdfPCell cSaida = new PdfPCell(new Phrase("N Sada")); cSaida.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cNome = new PdfPCell(new Phrase("Nome")); cNome.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cPatrimonio = new PdfPCell(new Phrase("Patrimonio")); cPatrimonio.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cValor = new PdfPCell(new Phrase("Valor")); cValor.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cSolic = new PdfPCell(new Phrase("Solicitante")); cSolic.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cAtut = new PdfPCell(new Phrase("Autorizado")); cAtut.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cCodigo = new PdfPCell(new Phrase("Codigo")); cCodigo.setBackgroundColor(BaseColor.DARK_GRAY); PdfPCell cDtSaida = new PdfPCell(new Phrase("Dt Sada")); cDtSaida.setBackgroundColor(BaseColor.DARK_GRAY); table.addCell(cSaida); table.addCell(cNome); table.addCell(cPatrimonio); table.addCell(cValor); table.addCell(cSolic); table.addCell(cAtut); table.addCell(cCodigo); table.addCell(cDtSaida); for (Saida saida : saidas) { PdfPCell sai = new PdfPCell(new Phrase(saida.getRegistro())); PdfPCell nomes = new PdfPCell(new Phrase(saida.getNome())); PdfPCell patrimonios = new PdfPCell(new Phrase(saida.getPatrimonio())); PdfPCell valores = new PdfPCell(new Phrase(String.valueOf(saida.getValor()))); PdfPCell solicitantes = new PdfPCell(new Phrase(saida.getSolicitador())); PdfPCell autorizados = new PdfPCell(new Phrase(saida.getAutorizador())); PdfPCell codigos = new PdfPCell(new Phrase(saida.getCodigo())); PdfPCell datas = new PdfPCell( new Phrase(FormatosDeData.formatarLongParaDatas(saida.getDatasaida().getTime()))); table.addCell(sai); table.addCell(nomes); table.addCell(patrimonios); table.addCell(valores); table.addCell(solicitantes); table.addCell(autorizados); table.addCell(codigos); table.addCell(datas); } documento.add(table); documento.close(); Desktop.getDesktop().open(new File("relatorios.pdf")); } catch (DocumentException | FileNotFoundException ex) { Logger.getLogger(GerandoPDF.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(GerandoPDF.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.automaster.autoview.server.servlet.TableHeader.java
/** * Fills out the total number of pages before the document is closed. * @see com.itextpdf.text.pdf.PdfPageEventHelper#onCloseDocument( * com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document) *//*from w w w. jav a 2 s. c o m*/ public void onCloseDocument(PdfWriter writer, Document document) { ColumnText.showTextAligned(total, Element.ALIGN_LEFT, new Phrase(String.valueOf(writer.getPageNumber() - 1)), 2, 2, 0); }
From source file:com.automated_attendence.servlets.PublishAttendance.java
public void createPdf(String filename, int loop, String course, String dept, String year_id, String semester_id, int totalClass) throws DocumentException, IOException { // step 1/* w w w .j a va2 s. co m*/ Document document = new Document(); // step 2 PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 document.open(); // step 4 //document.add(new Paragraph("Hello World!")); // step 5 document.addHeader("name", "yeamin"); document.addTitle("Attendence"); document.add(new Paragraph(String.format( " ResultSheet of Course id %s,Department %s,Year ID %s,Semester ID %s :", course, dept, year_id, semester_id))); document.add(new Paragraph( String.format("\n Total Class : %d ", totalClass))); document.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(2); PdfPCell c1; c1 = new PdfPCell(new Phrase("Reg no")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Attendence")); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); for (int i = 1; i <= loop; ++i) { //table.addCell(i+""); //table.addCell(i*i+""); table.addCell(student_reg_arrary[i]); // System.err.println(student_reg_arrary[i]); table.addCell(student_present_day[i]); // System.err.println(student_present_day[i]); } //document.addAuthor("me"); document.add(table); document.close(); }
From source file:com.bougsid.printers.PrintMission.java
public void printMission(Mission mission) { Document document = new Document(PageSize.A4); try {//from ww w. java 2 s .c o m File downloadDir = new File(msg.getMessage("application.mission.downloaddir")); if (!downloadDir.exists()) { downloadDir.mkdir(); } System.out.println("Dir =" + downloadDir.getPath()); PdfWriter.getInstance(document, new FileOutputStream(downloadDir.getPath() + "/" + mission.getUuid() + ".pdf")); document.open(); Paragraph p = new Paragraph(); p.setSpacingAfter(60); document.add(p); //header Paragraph paragraph = new Paragraph( msg.getMessage("mission.pdf.school") + " " + mission.getIdMission() + " ", DEFAULT_FONT); Phrase phrase = new Phrase(msg.getMessage("mission.pdf.city") + " " + LocalDate.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy"))); paragraph.add(phrase); paragraph.setSpacingAfter(50); document.add(paragraph); //title PdfPTable table = new PdfPTable(1); table.setWidthPercentage(40); PdfPCell cell = new PdfPCell(new Phrase(msg.getMessage("mission.pdf.title"), FontFactory.getFont(FontFactory.HELVETICA, 18))); cell.setBorderWidth(1); cell.setPadding(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.setHorizontalAlignment(Element.ALIGN_CENTER); table.setSpacingAfter(40); document.add(table); //content table = new PdfPTable(2); table.setWidthPercentage(100); //line 1 cell = new PdfPCell(new Paragraph(mission.getEmploye().getCivilite().getLabel(), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph(": " + mission.getEmploye().getFullName(), DEFAULT_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); //line 2 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.matricule"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph(": " + mission.getEmploye().getMatricule(), DEFAULT_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); //line 3 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.grade"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph(": " + mission.getEmploye().getFonction(), DEFAULT_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); if (mission.getEntreprise() != null) { //line 4 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.text_1"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.text_1_2"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); //line 5 cell = new PdfPCell(new Paragraph(" ", DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph(" - " + mission.getEntreprise().getNom(), DEFAULT_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); } //line 6 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.lieu"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); p = new Paragraph(); p.setFont(DEFAULT_FONT); for (Ville ville : mission.getVilles()) { p.add(ville.getNom() + "\n"); } cell = new PdfPCell(p); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); //line 7 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.startdate"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph( ": " + mission.getStartDate().format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + " Heure : " + mission.getStartDate().format(DateTimeFormatter.ofPattern("HH:mm")), DEFAULT_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); //line 8 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.enddate"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); cell = new PdfPCell(new Paragraph( ": " + mission.getEndDate().format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + " Heure : " + mission.getEndDate().format(DateTimeFormatter.ofPattern("HH:mm")), DEFAULT_FONT)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); //line 9 cell = new PdfPCell(new Paragraph(msg.getMessage("mission.pdf.transport"), DEFAULT_FONT_BOLD)); cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); switch (mission.getTransportType()) { case PERSONNEL: cell = new PdfPCell(new Paragraph(": " + msg.getMessage("mission.pdf.perso") + " " + mission.getEmploye().getVehicule().getMarque() + " " + msg.getMessage("mission.pdf.mat") + " " + mission.getEmploye().getVehicule().getMatricule() + " ", DEFAULT_FONT)); break; case Accompagnement: cell = new PdfPCell(new Paragraph(": " + msg.getMessage("mission.pdf.accomp") + " " + mission.getAccompEmploye().getCivilite() + " " + mission.getAccompEmploye().getFullName() + " " + msg.getMessage("mission.pdf.accomp.voitue") + " " + mission.getAccompEmploye().getVehicule().getMarque() + " " + msg.getMessage("mission.pdf.mat") + " " + mission.getAccompEmploye().getVehicule().getMatricule() + " ", DEFAULT_FONT)); break; case Service: cell = new PdfPCell(new Paragraph(": " + msg.getMessage("mission.pdf.service") + " " + mission.getEmploye().getVehicule().getMarque() + " " + msg.getMessage("mission.pdf.mat") + " " + mission.getEmploye().getVehicule().getMatricule() + " ", DEFAULT_FONT)); break; default: { cell = new PdfPCell(new Paragraph( ": " + mission.getTransportType().getLabel() + " " + msg.getMessage("mission.pdf.taxi"), DEFAULT_FONT)); } } cell.setBorder(Rectangle.NO_BORDER); cell.setPaddingTop(20); table.addCell(cell); table.setSpacingAfter(40); document.add(table); //note document.add(new Paragraph(msg.getMessage("mission.pdf.TEXT_2"), DEFAULT_FONT)); //signature if (mission.getEmploye().getGrade().getType() == GradeType.DG) { } else { Employe dir = employeService.getDG(); if (dir != null) paragraph = new Paragraph(dir.getFullName(), DEFAULT_FONT); paragraph.setAlignment(Element.ALIGN_RIGHT); paragraph.setSpacingBefore(40); document.add(paragraph); paragraph = new Paragraph(msg.getMessage("mission.pdf.DG"), DEFAULT_FONT); paragraph.setAlignment(Element.ALIGN_RIGHT); document.add(paragraph); } } catch (DocumentException ex) { ex.printStackTrace(); } catch (FileNotFoundException ex) { ex.printStackTrace(); } document.close(); // try { // Desktop.getDesktop().open(new File("./order.pdf")); // } catch (IOException ex) { // JOptionPane.showMessageDialog(null, "Fichier gner mais ne peut pas etre ouvert vrifier le dossier"); // } }
From source file:com.chaschev.itext.ColumnTextBuilder.java
License:Apache License
public ColumnTextBuilder clearContent() { return setText(new Phrase("")); }
From source file:com.chaschev.itext.ColumnTextBuilder.java
License:Apache License
public ColumnTextBuilder addTruncatedLine(Chunk chunk, boolean addEllipsis) { final float pixelsForEllipsis = 6; try {/*from w w w. ja v a2 s . c o m*/ ColumnText dup = ColumnText.duplicate(columnText); final Rectangle oneLineRectangle = new Rectangle(simpleColumnRectangle); oneLineRectangle.setTop(dup.getYLine()); final float fontHeight = calcApproximateFontHeight(chunk.getFont()) * 1.6f; oneLineRectangle.setBottom(dup.getYLine() - fontHeight); if (addEllipsis) { oneLineRectangle.setRight(oneLineRectangle.getRight() - pixelsForEllipsis); } dup.setSimpleColumn(oneLineRectangle); dup.addText(chunk); final int status = dup.go(); float yLine; if (addEllipsis && ColumnText.hasMoreText(status)) { oneLineRectangle.setLeft(dup.getLastX() + 2); oneLineRectangle.setRight(oneLineRectangle.getRight() + pixelsForEllipsis * 2); dup = ColumnText.duplicate(dup); dup.setSimpleColumn(oneLineRectangle); final Chunk ellipses = new Chunk("...\n", chunk.getFont()); dup.setText(new Phrase(ellipses)); dup.go(); yLine = dup.getYLine(); } else { yLine = dup.getYLine(); } setYLine(yLine); return this; } catch (DocumentException e) { throw Exceptions.runtime(e); } }
From source file:com.chaschev.itext.PhraseBuilder.java
License:Apache License
public PhraseBuilder withNew(String text, String cssStyleString) { element = new Phrase(text); return applyStyles(cssStyleString); }
From source file:com.debashubham.dumpy.ChainageCalcActivity.java
private void createTable(Section subCatPart) throws DocumentException { PdfPTable entry_table = new PdfPTable(10); entry_table.setWidthPercentage(100); // entry_table.setWidths(new float[]{0.25f,0.5f,0.5f,0.5f,0.5f,0.5f,0.5f,0.5f,0.5f,1.0f}); PdfPCell id = new PdfPCell(new Phrase("Station Point")); id.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell left_row = new PdfPCell(new Phrase("CH. Left(m)")); left_row.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell center_row = new PdfPCell(new Phrase("CH. Center(m)")); center_row.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell right_row = new PdfPCell(new Phrase("CH. Right(m)")); right_row.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell bs = new PdfPCell(new Phrase("BS(m)")); bs.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell is = new PdfPCell(new Phrase("IS(m)")); is.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell fs = new PdfPCell(new Phrase("FS(m)")); fs.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell hi = new PdfPCell(new Phrase("HI(m)")); hi.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell rl = new PdfPCell(new Phrase("RL(m)")); rl.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell remarks = new PdfPCell(new Phrase("REMARKS")); remarks.setHorizontalAlignment(Element.ALIGN_CENTER); entry_table.addCell(id);// ww w . ja v a 2 s . c o m entry_table.addCell(left_row); entry_table.addCell(center_row); entry_table.addCell(right_row); entry_table.addCell(bs); entry_table.addCell(is); entry_table.addCell(fs); entry_table.addCell(hi); entry_table.addCell(rl); entry_table.addCell(remarks); entry_table.setHeaderRows(1); int largest = rl_list.size(); Log.e("Total RL:", String.valueOf(largest)); double total_bs = 0, total_fs = 0, first_rl = 0, last_rl = 0; for (int i = 1; i <= largest; i++) { entry_table.addCell(String.valueOf(i)); if (i == 1) first_rl = rl_list.get(i); if (i == largest) last_rl = rl_list.get(i); if (left.containsKey(i)) { entry_table.addCell(String.valueOf(left.get(i))); entry_table.addCell(""); entry_table.addCell(""); } else if (center.containsKey(i)) { entry_table.addCell(""); entry_table.addCell(String.valueOf(center.get(i))); entry_table.addCell(""); } else if (right.containsKey(i)) { entry_table.addCell(""); entry_table.addCell(""); entry_table.addCell(String.valueOf(right.get(i))); } else { entry_table.addCell(""); entry_table.addCell(""); entry_table.addCell(""); } if (bs_list.containsKey(i)) { entry_table.addCell(String.valueOf(bs_list.get(i))); total_bs += bs_list.get(i); Log.e("TABLE:", "BS"); } else { entry_table.addCell(""); Log.e("TABLE:", "BS not entered"); } if (is_list.containsKey(i)) { entry_table.addCell(String.valueOf(is_list.get(i))); Log.e("TABLE:", "IS"); } else { entry_table.addCell(""); Log.e("TABLE:", "IS not entered"); } if (fs_list.containsKey(i)) { entry_table.addCell(String.valueOf(fs_list.get(i))); total_fs += fs_list.get(i); Log.e("TABLE:", "FS"); } else { entry_table.addCell(""); Log.e("TABLE:", "FS not entered"); } if (hi_list.containsKey(i)) { entry_table.addCell(String.valueOf(hi_list.get(i))); Log.e("TABLE:", "HI"); } else { entry_table.addCell(""); Log.e("TABLE:", "HI not entered"); } if (rl_list.containsKey(i)) { entry_table.addCell(String.valueOf(rl_list.get(i))); Log.e("TABLE:", "RL"); } else { entry_table.addCell(""); Log.e("TABLE:", "RL not entered"); } if (remarks_list.containsKey(i)) { entry_table.addCell(String.valueOf(remarks_list.get(i))); Log.e("TABLE:", "REMARKS"); } else { entry_table.addCell(""); Log.e("TABLE:", "REMARKS not entered"); } } subCatPart.add(entry_table); Log.e("Total BS:", String.valueOf(total_bs)); Log.e("Total FS:", String.valueOf(total_fs)); Log.e("First RL:", String.valueOf(first_rl)); Log.e("Last RL:", String.valueOf(last_rl)); Paragraph check_para = new Paragraph("Arithmetic Check:", subFont); addEmptyLine(check_para, 2); check_para.add("Summation(BS) - Summation(FS) = Last RL - First RL"); addEmptyLine(check_para, 1); double bsfs_diff = Math.round((total_bs - total_fs) * 1000.0) / 1000.0; double rl_diff = Math.round((last_rl - first_rl) * 1000.0) / 1000.0; boolean checktrue = (bsfs_diff) == (rl_diff) ? true : false; check_para.add(String.valueOf(bsfs_diff) + " = " + String.valueOf(rl_diff)); addEmptyLine(check_para, 1); if (checktrue) { check_para.setSpacingBefore(20); check_para.add("OK"); } else { check_para.setSpacingBefore(20); check_para.add("Check Fail!"); } addEmptyLine(check_para, 1); check_para.add("_______________________________________________________"); subCatPart.add(check_para); Paragraph legend_para = new Paragraph("LEGEND:", subFont); addEmptyLine(legend_para, 1); legend_para.add("BS : Back Sight"); addEmptyLine(legend_para, 1); legend_para.add("IS : Intermediate Sight"); addEmptyLine(legend_para, 1); legend_para.add("FS : Fore Sight"); addEmptyLine(legend_para, 1); legend_para.add("HI : Height of Instrument"); addEmptyLine(legend_para, 1); legend_para.add("RL : Reduced Level"); addEmptyLine(legend_para, 1); legend_para.add("CH. : Chainage"); subCatPart.add(legend_para); }
From source file:com.debashubham.dumpy.SimpleCalcActivity.java
private void createTable(Section subCatPart) throws BadElementException { PdfPTable entry_table = new PdfPTable(7); entry_table.setWidthPercentage(100); PdfPCell id = new PdfPCell(new Phrase("Station Point")); id.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell bs = new PdfPCell(new Phrase("BS")); bs.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell is = new PdfPCell(new Phrase("IS")); is.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell fs = new PdfPCell(new Phrase("FS")); fs.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell hi = new PdfPCell(new Phrase("HI")); hi.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell rl = new PdfPCell(new Phrase("RL")); rl.setHorizontalAlignment(Element.ALIGN_CENTER); PdfPCell remarks = new PdfPCell(new Phrase("REMARKS")); remarks.setHorizontalAlignment(Element.ALIGN_CENTER); entry_table.addCell(id);//w ww .j av a2s .c o m entry_table.addCell(bs); entry_table.addCell(is); entry_table.addCell(fs); entry_table.addCell(hi); entry_table.addCell(rl); entry_table.addCell(remarks); entry_table.setHeaderRows(1); int largest = rl_list.size(); Log.e("Total RL:", String.valueOf(largest)); double total_bs = 0, total_fs = 0, first_rl = 0, last_rl = 0; for (int i = 1; i <= largest; i++) { entry_table.addCell(String.valueOf(i)); if (i == 1) first_rl = rl_list.get(i); if (i == largest) last_rl = rl_list.get(i); if (bs_list.containsKey(i)) { entry_table.addCell(String.valueOf(bs_list.get(i))); total_bs += bs_list.get(i); Log.e("TABLE:", "BS"); } else { entry_table.addCell(""); Log.e("TABLE:", "BS not entered"); } if (is_list.containsKey(i)) { entry_table.addCell(String.valueOf(is_list.get(i))); Log.e("TABLE:", "IS"); } else { entry_table.addCell(""); Log.e("TABLE:", "IS not entered"); } if (fs_list.containsKey(i)) { entry_table.addCell(String.valueOf(fs_list.get(i))); total_fs += fs_list.get(i); Log.e("TABLE:", "FS"); } else { entry_table.addCell(""); Log.e("TABLE:", "FS not entered"); } if (hi_list.containsKey(i)) { entry_table.addCell(String.valueOf(hi_list.get(i))); Log.e("TABLE:", "HI"); } else { entry_table.addCell(""); Log.e("TABLE:", "HI not entered"); } if (rl_list.containsKey(i)) { entry_table.addCell(String.valueOf(rl_list.get(i))); Log.e("TABLE:", "RL"); } else { entry_table.addCell(""); Log.e("TABLE:", "RL not entered"); } if (remarks_list.containsKey(i)) { entry_table.addCell(String.valueOf(remarks_list.get(i))); Log.e("TABLE:", "REMARKS"); } else { entry_table.addCell(""); Log.e("TABLE:", "REMARKS not entered"); } } subCatPart.add(entry_table); Log.e("Total BS:", String.valueOf(total_bs)); Log.e("Total FS:", String.valueOf(total_fs)); Log.e("First RL:", String.valueOf(first_rl)); Log.e("Last RL:", String.valueOf(last_rl)); Paragraph check_para = new Paragraph("Arithmetic Check:", subFont); addEmptyLine(check_para, 2); check_para.add("Summation(BS) - Summation(FS) = Last RL - First RL"); addEmptyLine(check_para, 1); double bsfs_diff = Math.round((total_bs - total_fs) * 1000.0) / 1000.0; double rl_diff = Math.round((last_rl - first_rl) * 1000.0) / 1000.0; boolean checktrue = (bsfs_diff) == (rl_diff) ? true : false; check_para.add(String.valueOf(bsfs_diff) + " = " + String.valueOf(rl_diff)); addEmptyLine(check_para, 1); if (checktrue) { check_para.setSpacingBefore(20); check_para.add("OK"); } else { check_para.setSpacingBefore(20); check_para.add("Check Fail!"); } addEmptyLine(check_para, 1); check_para.add("_______________________________________________________"); subCatPart.add(check_para); Paragraph legend_para = new Paragraph("LEGEND:", subFont); addEmptyLine(legend_para, 2); legend_para.add("BS : Back Sight"); addEmptyLine(legend_para, 1); legend_para.add("IS : Intermediate Sight"); addEmptyLine(legend_para, 1); legend_para.add("FS : Fore Sight"); addEmptyLine(legend_para, 1); legend_para.add("HI : Height of Instrument"); addEmptyLine(legend_para, 1); legend_para.add("RL : Reduced Level"); subCatPart.add(legend_para); }
From source file:com.devox.GUI.PDF.CrearReportePorEstado.java
@Override public void agregarProductos(PdfPTable table) { int rows = data.length; for (int i = 0; i < rows; i++) { table.addCell(new Phrase(data[i][0].toString())); table.addCell(new Phrase(data[i][1].toString())); }/*from w ww .j av a 2 s. c o m*/ }