List of usage examples for com.itextpdf.text.pdf PdfPTable setTotalWidth
public void setTotalWidth(final float columnWidth[]) throws DocumentException
From source file:dbms_prj.Status.java
public void create_pdf() throws Exception { Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(S1 + ".pdf")); Image image = Image.getInstance("src/Travel partners.png"); image.scaleAbsolute(500f, 200f);/*from w w w. j av a2s . c o m*/ Image ima = Image.getInstance("src/images.jpg"); ima.scaleAbsolute(100f, 100f); ima.setAlignment(Element.ALIGN_CENTER); PdfPTable table = new PdfPTable(9); PdfPCell cell = new PdfPCell(new Paragraph("Ticket")); cell.setColspan(9); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPadding(10.0f); table.setTotalWidth(300.0f); cell.setBackgroundColor(new BaseColor(140, 221, 8)); table.addCell(cell); table.addCell("PNR"); table.addCell("BOOK_ID"); table.addCell("FLIGHT_NO"); table.addCell("NAME"); table.addCell("SOURCE"); table.addCell("DESTINATION"); table.addCell("STATUS"); table.addCell("FARE"); table.addCell("Date"); table.addCell(S1); table.addCell(S11); table.addCell(S4); table.addCell(S6 + S7); table.addCell(S8); table.addCell(S9); table.addCell(S5); table.addCell(S10); table.addCell(S2); table.setSpacingBefore(50.0f); // Space Before table starts, like margin-top in CSS table.setSpacingAfter(50.0f); doc.open(); //doc.add(new Paragraph("Hello!! Yo this is my first pdf!")); doc.add(image); //doc.add(new Paragraph("Ticket created on " + new Date().toString())); doc.add(table); //doc.add(list); doc.add(ima); doc.close(); }
From source file:de.aidger.utils.pdf.ActivityReportConverter.java
License:Open Source License
/** * Writes the logos and the address of the institute. *//*from w w w . jav a2 s .c o m*/ private void writeLogo() { try { Font generatedByFont = new Font( BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 8); Image aidger = Image.getInstance(getClass().getResource("/de/aidger/res/pdf/AidgerLogo.png")); aidger.scaleAbsolute(80.0f, 20.0f); PdfPTable table = new PdfPTable(2); table.setTotalWidth(reader.getPageSize(1).getRight()); PdfPCell cell = new PdfPCell(new Phrase(_("Generated by: "), generatedByFont)); cell.setBorder(0); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell); cell = new PdfPCell(Image.getInstance(aidger)); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setBorder(0); table.addCell(cell); table.writeSelectedRows(0, -1, 0, 25, contentByte); } catch (BadElementException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:de.aidger.utils.pdf.ActivityReportConverter.java
License:Open Source License
/** * Creates the table of employments./*from w w w . j a va2 s. 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(); } }
From source file:de.beimax.talenttree.PageGeneratorSimple.java
License:Open Source License
/** * get celled talent text//w w w . j ava 2 s . c o m * @param key * @param talentBoxWidth * @param fontSize * @return * @throws Exception */ protected PdfPTable getTalentCell(String key, float talentBoxWidth, float fontSize) throws Exception { // get phrase Phrase phrase = parseTextProperty(key, fontSize, true); // table text PdfPTable table = new PdfPTable(1); table.setTotalWidth(talentBoxWidth - PDFGenerator.talentBoxStroke * 3); table.setLockedWidth(true); PdfPCell cell = new PdfPCell(phrase); cell.setBorder(0); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); table.completeRow(); return table; }
From source file:domain.Pdfmaker.java
public void makePdf() { Document doc = new Document(); doc.setPageSize(PageSize.A4);/*w w w .jav a2s . c om*/ try { PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(test.getTitle() + ".pdf")); writer.setPdfVersion(PdfWriter.VERSION_1_7); doc.open(); Font f = new Font(Font.FontFamily.TIMES_ROMAN, 15, Font.BOLD, new BaseColor(0, 0, 0)); Paragraph title = new Paragraph("TEST TITLE", f); title.setAlignment(Element.ALIGN_CENTER); doc.addCreator("Arne De Bremme"); //make table PdfPTable table = new PdfPTable(4); table.setTotalWidth(550f); table.setLockedWidth(true); table.setHeaderRows(1); Paragraph p = new Paragraph(test.getTitle()); p.setAlignment(Element.ALIGN_CENTER); PdfPCell cell = new PdfPCell(p); cell.setGrayFill(0.7f); cell.setColspan(4); table.addCell(cell); table.addCell(test.getClassGroup().getGroupName()); PdfPCell cell2 = new PdfPCell(new Paragraph(test.getDescription())); cell2.setColspan(2); cell2.setRowspan(2); table.addCell(cell2); PdfPCell cell3 = new PdfPCell(new Paragraph("DD " + test.getStartDate().getDay() + "/" + test.getStartDate().getMonth() + "/" + test.getStartDate().getYear())); cell3.setRowspan(2); table.addCell(cell3); table.addCell(new Paragraph("Test " + test.getTestId())); doc.add(table); doc.add(Chunk.NEWLINE); for (Exercise e : ex) { Paragraph par = new Paragraph(); par.add("Vraag " + counter); par.add(Chunk.TABBING); par.add(Chunk.TABBING); par.add(Chunk.TABBING); par.add(Chunk.TABBING); par.add(e.getPunten() + "/"); doc.add(par); doc.add(new Paragraph("Klimatogram " + e.getClimateChart().getLocation() + " " + e.getPunten())); Robot r = new Robot(); Desktop.getDesktop().browse(new URI( "http://climatechart.azurewebsites.net/ClimateChart/ShowExercises?selectedYear=1&continentId=" + e.getClimateChart().getCountry().getContinent().getId() + "&countryId=" + e.getClimateChart().getCountry().getContinent().getId() + "&climateId=" + e.getClimateChart().getId())); TimeUnit.SECONDS.sleep(6); BufferedImage bi = r.createScreenCapture( new Rectangle(Toolkit.getDefaultToolkit().getScreenSize().width * 7 / 10, Toolkit.getDefaultToolkit().getScreenSize().width * 8 / 14)); File file = new File("screenCapture" + counter + ".jpg"); ImageIO.write(bi, "jpg", file); Image img = Image.getInstance("screenCapture.jpg"); img.scaleAbsolute(400, 300); doc.add(img); doc.add(Chunk.NEWLINE); doc.add(new Paragraph(e.getNaam())); doc.add(Chunk.NEXTPAGE); counter++; } doc.close(); File filz = new File(test.getTitle() + ".pdf"); Desktop.getDesktop().open(filz); } catch (Exception e) { } }
From source file:edu.harvard.mcz.precapture.encoder.LabelEncoder.java
License:Open Source License
public static PdfPTable setupTable(int paperWidthPoints, int marginsPoints, int labelWidthPoints, int columns, int subCellColumnCount, float relWidthTextCell, float relWidthBarcodeCell) throws DocumentException { PdfPTable table = new PdfPTable(subCellColumnCount); table.setLockedWidth(true); // force use of totalWidth in points, rather than percentWidth. float percentWidth = ((((float) paperWidthPoints) - (2f * ((float) marginsPoints))) / ((float) paperWidthPoints)) * 100f; //percentWidth = 100f; log.debug("Table Width Percent = " + percentWidth); table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); float[] cellWidthsRatio = new float[subCellColumnCount]; int cellNumber = 0; for (int c = 0; c < columns; c++) { cellWidthsRatio[cellNumber] = relWidthTextCell; // width of text cell cellNumber++;//from w ww. jav a 2s. co m if (subCellColumnCount > 1) { cellWidthsRatio[cellNumber] = relWidthBarcodeCell; // width of barcode cell cellNumber++; } } table.setTotalWidth(paperWidthPoints - 2 * marginsPoints); // must set total width before setting relative cell widths. table.setWidths(cellWidthsRatio); log.debug("Width:" + table.getTotalWidth()); return table; }
From source file:es.clinica.veterinaria.albaranes.AlbaranPdf.java
public PdfPTable createTable() throws DocumentException { // a table with three columns int iva = 0, iva2 = 0; DecimalFormat df = new DecimalFormat("0.00"); PdfPTable table = new PdfPTable(5); table.setTotalWidth(new float[] { 55, 150, 200, 70, 70 }); table.setLockedWidth(true);/*from w w w .j a v a2 s. c om*/ // the cell object // we add a cell with colspan 3 PdfPCell cell = new PdfPCell(new Phrase("CANT.")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("CONCEPTO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("DESCRIPCIN")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("IMPORTE")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); HashSet<VentaLinea> listVenta = getVenta().getVenta_lineas(); for (VentaLinea vlinea : listVenta) { if (vlinea.getTipo() == 1) { if (vlinea.getProducto().getIva() != null) { iva2 = vlinea.getProducto().getIva().getValor(); // System.out.println("IVA: " +iva2); } } else if (vlinea.getTipo() == 2) { if (vlinea.getServicio().getIva() != null) { iva2 = vlinea.getServicio().getIva().getValor(); // System.out.println("IVA: " +iva2); } } //Para hacer el calculo nos vamos a quedar con el IVA mayor if (iva < iva2) { iva = iva2; } cell = new PdfPCell(new Phrase(vlinea.getCantidad() + "", small)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small))); String descripcion = vlinea.getDescripcion(); if (descripcion == null || "null".equals(descripcion)) { table.addCell(new PdfPCell(new Phrase(" ", small))); // System.out.println("null:" + descripcion); } else { table.addCell(new PdfPCell(new Phrase(descripcion, small))); // System.out.println("!null:" + descripcion); } cell = new PdfPCell(new Phrase(df.format(vlinea.getPvp()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(vlinea.getPreciototalNoIVA()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); } cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("SUMA")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(venta.getCostesinIva()) + " ")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* IVA */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); // float costetotal = (float) (venta.getCoste() * (1+(iva*0.01))); cell = new PdfPCell(new Phrase("IVA " + iva + "%")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(venta.getIvas()) + " ")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* COSTE TOTAL */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("TOTAL")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(venta.getCoste()) + " ")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); return table; }
From source file:es.clinica.veterinaria.facturas.FacturaPdf.java
public PdfPTable createTable() throws DocumentException { // a table with three columns int iva = 0, iva2 = 0; DecimalFormat df = new DecimalFormat("0.00"); PdfPTable table = new PdfPTable(6); table.setTotalWidth(new float[] { 50, 65, 150, 150, 65, 70 }); table.setLockedWidth(true);//from w w w. jav a 2 s . co m // the cell object // we add a cell with colspan 3 PdfPCell cell = new PdfPCell(new Phrase("CANT.")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("FECHA")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("CONCEPTO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("DESCRIPCIN")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("IMPORTE")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); HashSet<Venta> ventas = this.getFactura().getVentas(); for (Venta venta : ventas) { HashSet<VentaLinea> listVenta = venta.getVenta_lineas(); for (VentaLinea vlinea : listVenta) { if (vlinea.getTipo() == 1) { if (vlinea.getProducto().getIva() != null) { iva2 = vlinea.getProducto().getIva().getValor(); // System.out.println("IVA: " +iva2); } } else if (vlinea.getTipo() == 2) { if (vlinea.getServicio().getIva() != null) { iva2 = vlinea.getServicio().getIva().getValor(); // System.out.println("IVA: " +iva2); } } //Para hacer el calculo nos vamos a quedar con el IVA mayor if (iva < iva2) { iva = iva2; } cell = new PdfPCell(new Phrase(vlinea.getCantidad() + "", small)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell( new Phrase(new SimpleDateFormat("dd-MM-yyyy").format(vlinea.getFecha()), small)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(5); table.addCell(cell); if (vlinea.getTipo() == 2) { //Servicio table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small))); String descripcion = vlinea.getDescripcion(); if (descripcion == null || "null".equals(descripcion)) { table.addCell(new PdfPCell(new Phrase(" ", small))); // System.out.println("null:" + descripcion); } else { table.addCell(new PdfPCell(new Phrase(descripcion, small))); // System.out.println("!null:" + descripcion); } } else if (vlinea.getTipo() == 1) { //Producto //Si el producto es Tratamiento if (vlinea.getProducto().getFamilia().isTratamiento()) { table.addCell(new PdfPCell(new Phrase("Tratamiento", small))); table.addCell(new PdfPCell(new Phrase("", small))); } else { table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small))); String descripcion = vlinea.getDescripcion(); if (descripcion == null || "null".equals(descripcion)) { table.addCell(new PdfPCell(new Phrase(" ", small))); // System.out.println("null:" + descripcion); } else { table.addCell(new PdfPCell(new Phrase(descripcion, small))); // System.out.println("!null:" + descripcion); } } } cell = new PdfPCell(new Phrase(df.format(vlinea.getPvp()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(vlinea.getPreciototalNoIVA()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); } } cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("SUMA")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(factura.getCoste()) + " ", smallBold)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* IVA */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); table.addCell(cell); float costetotal = (float) (factura.getCostetotal()); cell = new PdfPCell(new Phrase("IVA " + iva + "%")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(factura.getIvas()) + " ", smallBold)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* COSTE TOTAL */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("TOTAL")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(costetotal) + " ", smallBold)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); return table; }
From source file:eu.trentorise.smartcampus.citizenportal.service.PdfCreator.java
private static void createTable(Section subCatPart) throws BadElementException { PdfPTable table = new PdfPTable(5); try {/*from ww w . ja va 2 s . c o m*/ table.setTotalWidth(new float[] { 70, 85, 250, 60, 60 }); table.setLockedWidth(true); } catch (DocumentException e) { e.printStackTrace(); } // t.setBorderColor(BaseColor.GRAY); // t.setPadding(4); // t.setSpacing(4); // t.setBorderWidth(1); PdfPCell c1 = new PdfPCell(new Phrase("Posizione", smallBold)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Id Domanda", smallBold)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Richiedente", smallBold)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Comp.", smallBold)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("Punti", smallBold)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); if (listClass != null) { for (int i = 0; i < listClass.size(); i++) { // Cell for position table.addCell(String.valueOf(listClass.get(i).getPosition())); // Cell for practice id PdfPCell cId = new PdfPCell(new Phrase(listClass.get(i).getPracticeId())); cId.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cId); // Cell for ric_name table.addCell(listClass.get(i).getRicName()); // Cell for fam_components PdfPCell cComps = new PdfPCell(new Phrase(String.valueOf(listClass.get(i).getFamComponents()))); cComps.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cComps); // Cell for score PdfPCell cScore = new PdfPCell(new Phrase(listClass.get(i).getScore())); cScore.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cScore); } } else { for (int i = 0; i < listClassFinal.size(); i++) { // Cell for position table.addCell(String.valueOf(listClassFinal.get(i).getPosition())); // Cell for practice id PdfPCell cId = new PdfPCell(new Phrase(listClassFinal.get(i).getPracticeId())); cId.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cId); // Cell for ric_name table.addCell(listClassFinal.get(i).getRicName()); // Cell for fam_components PdfPCell cComps = new PdfPCell( new Phrase(String.valueOf(listClassFinal.get(i).getFamComponents()))); cComps.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cComps); // Cell for score PdfPCell cScore = new PdfPCell(new Phrase(listClassFinal.get(i).getScore())); cScore.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cScore); } } subCatPart.add(table); }
From source file:Export.DocOfReCoSeguro.java
public static void docSeguros(String nomeSeguro, String user, String arquivo, String numDebito, String tileDoc, int idReseguro, boolean isReseguroOfNICON) { String reString;// ww w .jav a 2 s.c om try { Font fontCabecalhoN = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.2f); Font fontLinha = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 0.000000358f); Font fontCabecalhoS = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.2f); Font fontCorpo = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontCorpoS = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f, Font.UNDERLINE); Font fontCorpoN = FontFactory.getFont(ConfigDoc.Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f); Font fontNull = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 4f); Font fontMenor = FontFactory.getFont(ConfigDoc.Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 3f); DataResseguro reS = DataReseguro.getDadosReseguro(idReseguro); PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 80, 20 }); pTableEmpresaPricipal.setWidthPercentage(90); PdfPTable pTableEmpresaInforImpres1 = new PdfPTable(1); PdfPTable pTableEmpresaInforImpres2 = new PdfPTable(1); PdfPTable pTableEmpresaInforImpres4 = new PdfPTable(1); PdfPTable pTableEmpresaInforImpres5 = new PdfPTable(1); PdfPTable pTableFatura = new PdfPTable(new float[] { 80, 20 }); PdfPCell pCellNomeEmpresa = new PdfPCell(new Phrase(ConfigDoc.Empresa.NOME, fontCabecalhoN)); pCellNomeEmpresa.setBorder(0); PdfPCell pCellNomeEndereco = new PdfPCell(new Phrase(ConfigDoc.Empresa.ENDERECO, fontCabecalhoN)); pCellNomeEndereco.setBorder(0); PdfPCell pCellCaixaPostal = new PdfPCell(new Phrase(ConfigDoc.Empresa.CAIXAPOSTAL, fontCabecalhoN)); pCellCaixaPostal.setBorder(0); PdfPCell pCellTeleFax = new PdfPCell( new Phrase(ConfigDoc.Empresa.TELEFAX + " " + ConfigDoc.Empresa.EMAIL, fontCabecalhoN)); pCellTeleFax.setBorder(0); PdfPCell pCellSociedade = new PdfPCell(new Phrase(ConfigDoc.Empresa.SOCIEDADE, fontCabecalhoN)); pCellSociedade.setBorder(0); PdfPCell pCellCapital = new PdfPCell(new Phrase(ConfigDoc.Empresa.CAPITALSOCIAL, fontCabecalhoN)); pCellCapital.setBorder(0); PdfPCell pCellPolice = new PdfPCell( new Phrase(ConfigDoc.Empresa.APOLICE + reS.getAPOLICE(), fontCabecalhoN)); pCellPolice.setBorder(0); Image imageEmpresa = Image.getInstance("logo.png"); imageEmpresa.scaleToFit(120f, 100f); pTableEmpresaInforImpres1.addCell(pCellNomeEmpresa); pTableEmpresaInforImpres1.addCell(pCellNomeEndereco); pTableEmpresaInforImpres1.addCell(pCellCaixaPostal); pTableEmpresaInforImpres1.addCell(pCellTeleFax); pTableEmpresaInforImpres1.addCell(pCellSociedade); pTableEmpresaInforImpres2.addCell(pCellCapital); pTableEmpresaInforImpres2.addCell(pCellPolice); PdfPCell cellTabela1 = new PdfPCell(pTableEmpresaInforImpres2); cellTabela1.setBorder(0); pTableEmpresaInforImpres4.addCell(cellTabela1); PdfPCell cellTabela3 = new PdfPCell(pTableEmpresaInforImpres1); cellTabela3.setBorder(0); pTableEmpresaInforImpres5.addCell(cellTabela3); PdfPCell cellTabela4 = new PdfPCell(pTableEmpresaInforImpres4); cellTabela4.setBorder(0); pTableEmpresaInforImpres5.addCell(cellTabela4); PdfPCell cellTabela5 = new PdfPCell(pTableEmpresaInforImpres5); cellTabela5.setBorder(0); pTableEmpresaPricipal.addCell(cellTabela5); PdfPCell cellTabela6 = new PdfPCell(imageEmpresa); cellTabela6.setBorder(0); cellTabela6.setHorizontalAlignment(Element.ALIGN_RIGHT); pTableEmpresaPricipal.addCell(cellTabela6); PdfPTable pTableLinha = new PdfPTable(1); pTableLinha.setWidthPercentage(90); PdfPCell linha = new PdfPCell(new Phrase(" ", fontLinha)); linha.setBorderWidthTop(0.5f); linha.setBorderWidthBottom(0); linha.setBorderWidthLeft(0); linha.setBorderWidthRight(0); pTableLinha.addCell(linha); /** * Tile Doc start */ /* PdfPTable pTableTileDoc = new PdfPTable(new float[]{50, 50}); PdfPCell cellTileDoc = new PdfPCell(new Phrase(tileDoc, fontCabecalhoS)); cellTileDoc.setColspan(2); cellTileDoc.setPaddingTop(10f); cellTileDoc.setPaddingBottom(20f); cellTileDoc.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellTileDoc.setBorder(PdfPCell.NO_BORDER); pTableTileDoc.addCell(cellTileDoc); Paragraph pTile = new Paragraph(); pTile.add(new Phrase("DEBIT: ", fontCorpoN)); pTile.add(new Phrase("NiCON Seguros STP", fontCorpoN)); PdfPCell cellDebit = new PdfPCell(pTile); cellDebit.setBorder(PdfPCell.NO_BORDER); pTableTileDoc.addCell(cellDebit); Paragraph pNotaNum = new Paragraph(); pNotaNum.add(new Phrase("DEBIT NOTE NO: ", fontCorpoN)); pNotaNum.add(new Phrase("05525", fontCorpo)); cellDebit = new PdfPCell(pNotaNum); cellDebit.setPaddingLeft(20f); cellDebit.setBorder(PdfPCell.NO_BORDER); pTableTileDoc.addCell(cellDebit); cellDebit = new PdfPCell(new Phrase(" Avenida Marginal 12 de Junlho, 977", fontCorpo)); cellDebit.setBorder(PdfPCell.NO_BORDER); pTableTileDoc.addCell(cellDebit); Paragraph pDate = new Paragraph(); pDate.add(new Phrase("Date: ", fontCorpoN)); SimpleDateFormat format = new SimpleDateFormat("dd MMMM',' yyyy",new Locale("pt", "BR")); pDate.add(new Phrase(format.format(new Date()), fontCorpo)); cellDebit = new PdfPCell(pDate); cellDebit.setBorder(PdfPCell.NO_BORDER); cellDebit.setPaddingLeft(20f); pTableTileDoc.addCell(cellDebit); cellDebit = new PdfPCell(new Phrase(" Cx Postal 556-So Tom", fontCorpo)); cellDebit.setBorder(PdfPCell.NO_BORDER); pTableTileDoc.addCell(cellDebit); cellDebit = new PdfPCell(new Phrase(" ")); cellDebit.setBorder(PdfPCell.NO_BORDER); pTableTileDoc.addCell(cellDebit); */ /** * Tile Doc end */ ArrayList<DataEmpresa> listaDataEmpresas = DataReseguro.getDadosEmpresa(idReseguro); /** * Data Parte 1 Start */ PdfPTable pTableDataPart1 = new PdfPTable(new float[] { 18f, 82f }); pTableDataPart1.setWidthPercentage(90); PdfPCell cellDataPart1 = new PdfPCell(new Phrase("EMPRESA LIDER:", fontCorpoN)); cellDataPart1.setBorder(PdfPCell.NO_BORDER); cellDataPart1.setPaddingTop(10f); cellDataPart1.setPaddingBottom(5f); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell( new Phrase(((!isReseguroOfNICON) ? listaDataEmpresas.get(0).getEMPRESA().toUpperCase() : ConfigDoc.Empresa.NOME), fontCorpo)); cellDataPart1.setPaddingTop(10f); cellDataPart1.setPaddingBottom(5f); cellDataPart1.setBorder(PdfPCell.NO_BORDER); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase("CONTRATO N:", fontCorpoN)); cellDataPart1.setBorder(PdfPCell.NO_BORDER); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase(reS.getAPOLICE(), fontCorpo)); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); cellDataPart1.setBorder(PdfPCell.NO_BORDER); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase("DESCRIO:", fontCorpoN)); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); cellDataPart1.setBorder(PdfPCell.NO_BORDER); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase(reS.getDESCRICAO(), fontCorpo)); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); cellDataPart1.setBorder(PdfPCell.NO_BORDER); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase("PERIODO:", fontCorpoN)); cellDataPart1.setBorder(PdfPCell.NO_BORDER); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase(reS.getINICIO() + " - " + reS.getFIM(), fontCorpo)); cellDataPart1.setBorder(PdfPCell.NO_BORDER); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase("LIMITE:", fontCorpoN)); cellDataPart1.setBorder(PdfPCell.NO_BORDER); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase((covertDouble(reS.getLIMITE()) == null) ? reS.getLIMITE() : Moeda.format(covertDouble(reS.getLIMITE())), fontCorpo)); cellDataPart1.setBorder(PdfPCell.NO_BORDER); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(5f); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase("MOEDA:", fontCorpoN)); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(10f); cellDataPart1.setBorder(PdfPCell.NO_BORDER); pTableDataPart1.addCell(cellDataPart1); cellDataPart1 = new PdfPCell(new Phrase(reS.getMOEDA(), fontCorpo)); cellDataPart1.setPaddingTop(5f); cellDataPart1.setPaddingBottom(10f); cellDataPart1.setBorder(PdfPCell.NO_BORDER); pTableDataPart1.addCell(cellDataPart1); /** * Data Part 1 end */ /** * Data Part 2 start */ PdfPTable pTableDataPart2 = new PdfPTable(new float[] { 33.333333333f, 33.333333333f, 33.333333333f }); pTableDataPart2.setWidthPercentage(90); PdfPCell cellDataPart2 = new PdfPCell(new Phrase("PREMIO GROSSO:", fontCorpoN)); cellDataPart2.setColspan(2); cellDataPart2.setBorder(PdfPCell.NO_BORDER); cellDataPart2.setPaddingTop(10f); cellDataPart2.setPaddingBottom(5f); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase( Moeda.format(Double.valueOf(reS.getPREMIOGROSSO().replace(',', '.'))) + " " + reS.getMOEDA(), fontCorpo)); cellDataPart2.setPaddingTop(10f); cellDataPart2.setPaddingBottom(5f); cellDataPart2.setBorder(PdfPCell.NO_BORDER); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase("DEDUO:", fontCorpoN)); cellDataPart2.setBorder(PdfPCell.NO_BORDER); cellDataPart2.setColspan(2); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(5f); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase(reS.getDEDUCAO() + "%", fontCorpo)); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(5f); cellDataPart2.setBorder(PdfPCell.NO_BORDER); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase("LIQUIDO:", fontCorpoN)); cellDataPart2.setBorder(PdfPCell.NO_BORDER); cellDataPart2.setColspan(2); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(5f); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase( Moeda.format(Double.valueOf(reS.getPREMIOGROSSO().replace(',', '.'))) + " " + reS.getMOEDA(), fontCorpo)); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(5f); cellDataPart2.setBorder(PdfPCell.NO_BORDER); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase("TOTAL:", fontCorpoN)); cellDataPart2.setBorder(PdfPCell.NO_BORDER); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(10f); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase("100%", fontCorpo)); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(10f); cellDataPart2.setBorder(PdfPCell.NO_BORDER); pTableDataPart2.addCell(cellDataPart2); cellDataPart2 = new PdfPCell(new Phrase( Moeda.format(Double.valueOf(reS.getTOTAL().replace(',', '.'))) + " " + reS.getMOEDA(), fontCorpo)); cellDataPart2.setPaddingTop(5f); cellDataPart2.setPaddingBottom(10f); cellDataPart2.setBorder(PdfPCell.NO_BORDER); pTableDataPart2.addCell(cellDataPart2); // cellDataPart2 = new PdfPCell(new Phrase("Your faithfully", fontCorpo)); // cellDataPart2.setColspan(3); // cellDataPart2.setPaddingTop(5f); // cellDataPart2.setPaddingBottom(0.7f); // cellDataPart2.setBorder(PdfPCell.NO_BORDER); // pTableDataPart2.addCell(cellDataPart2); // cellDataPart2 = new PdfPCell(new Phrase("THE UNITED AFRICAN INSURANCE BROKERS LTD", fontCorpo)); // cellDataPart2.setColspan(3); // cellDataPart2.setPaddingTop(0.7f); // cellDataPart2.setPaddingBottom(10F); // cellDataPart2.setBorder(PdfPCell.NO_BORDER); // pTableDataPart2.addCell(cellDataPart2); /** * Data Part 2 end */ PdfPTable pTableSecureter = new PdfPTable(new float[] { 30f, 30f, 40f }); PdfPCell cellSecureterNull = new PdfPCell(new Phrase(" ", fontCorpoN)); cellSecureterNull.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellSecureterNull.setPaddingTop(2f); cellSecureterNull.setPaddingBottom(2f); cellSecureterNull.setColspan(3); cellSecureterNull.setBorder(PdfPCell.NO_BORDER); pTableSecureter.addCell(cellSecureterNull); cellSecureterNull.setColspan(0); if (isReseguroOfNICON) { PdfPCell cellSecureter = new PdfPCell(new Phrase("RESSEGURADORA USADA", fontCorpoN)); cellSecureter.setColspan(2); cellSecureter.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellSecureter.setPaddingTop(8f); cellSecureter.setPaddingBottom(8f); cellSecureter.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableSecureter.addCell(cellSecureter); pTableSecureter.addCell(cellSecureterNull); cellSecureter = new PdfPCell(new Phrase("RESSEGURA", fontCorpoN)); cellSecureter.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellSecureter.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellSecureter.setPaddingTop(5f); cellSecureter.setPaddingBottom(5); pTableSecureter.addCell(cellSecureter); cellSecureter = new PdfPCell(new Phrase("%PERCENTAGEM", fontCorpoN)); cellSecureter.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); cellSecureter.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellSecureter.setPaddingTop(5f); cellSecureter.setPaddingBottom(5); pTableSecureter.addCell(cellSecureter); pTableSecureter.addCell(cellSecureterNull); int total = listaDataEmpresas.size(); for (int i = 0; (i < total); i++) { cellSecureter = new PdfPCell(new Phrase(listaDataEmpresas.get(i).getEMPRESA(), fontCorpo)); cellSecureter.setPaddingTop(5f); cellSecureter.setPaddingBottom(5); cellSecureter.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); pTableSecureter.addCell(cellSecureter); cellSecureter = new PdfPCell(new Phrase( listaDataEmpresas.get(i).getPERCENTAGEM() + "% -- " + Moeda.format(((covertDouble(listaDataEmpresas.get(i).getPERCENTAGEM()) / 100) * covertDouble(reS.getPREMIOGROSSO()))) + " " + reS.getMOEDA(), fontCorpo)); cellSecureter.setPaddingTop(5f); cellSecureter.setPaddingBottom(5); cellSecureter.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cellSecureter.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); pTableSecureter.addCell(cellSecureter); pTableSecureter.addCell(cellSecureterNull); } } PdfPTable pTablePocessed = new PdfPTable(new float[] { 100 }); PdfPCell cellPocessed = new PdfPCell(new Phrase("_____________________________", fontCorpoN)); cellPocessed.setBorder(PdfPCell.NO_BORDER); cellPocessed.setVerticalAlignment(PdfPCell.ALIGN_BOTTOM); cellPocessed.setPaddingTop(50f); cellPocessed.setPaddingBottom(1f); pTablePocessed.addCell(cellPocessed); cellPocessed = new PdfPCell(new Phrase("PROCESSED BY", fontCorpoN)); cellPocessed.setPaddingTop(1f); cellPocessed.setVerticalAlignment(PdfPCell.ALIGN_TOP); cellPocessed.setBorder(PdfPCell.NO_BORDER); pTablePocessed.addCell(cellPocessed); SimpleDateFormat sdf1 = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss"); Document documento = new Document(); documento.setPageSize(PageSize.A4); documento.setMargins(20f, 20f, 70f, 5f); String f1 = (arquivo + "/" + user + "/Seguro " + nomeSeguro + "/"); File f = new File(f1); String Ddata = sdf1.format(new Date()); f.mkdirs(); f = new File(f.getAbsoluteFile() + "/" + "Doc Nota CO-ReSSEGURO " + Ddata + ".pdf"); reString = "../Documentos/" + user + "/Seguro " + nomeSeguro + "/" + "Doc Nota CO-ReSSEGURO " + Ddata + ".pdf"; OutputStream outputStraem = new FileOutputStream(f); PdfWriter writer = PdfWriter.getInstance(documento, outputStraem); documento.open(); documento.add(pTableEmpresaPricipal); documento.add(pTableLinha); documento.add(pTableLinha); /* documento.add(pTableTileDoc); documento.add(pTableLinha); */ documento.add(pTableDataPart1); documento.add(pTableLinha); documento.add(pTableDataPart2); documento.add(pTableLinha); documento.add(pTableLinha); documento.add(pTableSecureter); // documento.add(pTablePocessed); pTablePocessed.setTotalWidth(200); pTablePocessed.writeSelectedRows(-1, 100, 100f, 175f, writer.getDirectContent()); documento.close(); RequestContext.getCurrentInstance().execute("openAllDocument('" + reString + "')"); } catch (FileNotFoundException | DocumentException e) { } catch (IOException ex) { Logger.getLogger(DocNotaCredito.class.getName()).log(Level.SEVERE, null, ex); } }