List of usage examples for com.itextpdf.text.pdf PdfPCell setBorderColorTop
public void setBorderColorTop(final BaseColor borderColorTop)
From source file:bussiness.ReportHandler.java
private void BuildBodyPrescription(List<Medicine> medicines, Document veterinaryPrescription, Double totalCost, PdfPTable table) throws DocumentException { Font font2 = new Font(); font2.setSize(20);/*from w w w . j av a 2 s . c o m*/ for (Medicine medicine : medicines) { table.addCell(new Phrase(medicine.getName(), font2)); table.addCell(new Phrase(medicine.getDose(), font2)); table.addCell(new Phrase(medicine.getAdministration(), font2)); } PdfPCell celdaFinal = new PdfPCell(new Paragraph("Total: " + totalCost)); celdaFinal.setBorderWidthRight(0); celdaFinal.setBorderWidthLeft(0); celdaFinal.setBorderColorTop(BaseColor.DARK_GRAY); celdaFinal.setBorderColorBottom(BaseColor.DARK_GRAY); celdaFinal.setPaddingLeft(50); // Indicamos cuantas columnas ocupa la celda celdaFinal.setColspan(3); celdaFinal.setPaddingLeft(235); table.addCell(celdaFinal); veterinaryPrescription.add(table); }
From source file:bussiness.ReportHandler.java
private void BuildBodySaleReport(PdfPTable table, double totalCost, Document documento) throws DocumentException { List<Medicine> purchases = SalesViewHelper.getInstance().getPurchasesInformation(); for (Medicine product : purchases) { table.addCell(product.getName()); table.addCell(Double.toString(product.getCost())); }//w ww. j a va 2 s. c o m PdfPCell celdaFinal = new PdfPCell(new Paragraph("Total: " + String.valueOf(totalCost))); celdaFinal.setBorderWidthRight(0); celdaFinal.setBorderWidthLeft(0); celdaFinal.setBorderColorTop(BaseColor.DARK_GRAY); celdaFinal.setBorderColorBottom(BaseColor.DARK_GRAY); celdaFinal.setPaddingLeft(50); // Indicamos cuantas columnas ocupa la celda celdaFinal.setColspan(2); celdaFinal.setPaddingLeft(235); table.addCell(celdaFinal); documento.add(table); }
From source file:com.devox.GUI.PDF.CrearReporteApto.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(8); //new float[]{2.4f, 3f, 1.25f, 1.2f, 1f, 1.15f, 1.1f, 1.55f} PdfPCell cell; cell = new PdfPCell(new Phrase("CDIGO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO);//from www . j a va 2 s . c om cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("DESCRIPCIN", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("LOTE", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("FECHA DE CADUCIDAD", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("DICTAMEN", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("OBSERVACIONES", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 2.4f, 3f, 1.25f, 1.2f, 1f, 1.15f, 1.1f, 1.55f }); table.setWidthPercentage(100); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.CrearReporteDestruccion.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(6); PdfPCell cell; cell = new PdfPCell(new Phrase("DESCRIPCIN", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO);/*from www. j av a 2 s . c om*/ cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("LOTE", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO UNITARIO", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("SUBTOTAL", FUENTE_CABECERA_TABLA_CHICA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 5f, 2f, 3f, 1.2f, 1.4f, 1.5f }); table.setWidthPercentage(98); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.CrearReportePorEstado.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(2); PdfPCell cell; cell = new PdfPCell(new Phrase("FOLIO DHL", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO);//from w w w . j a va 2 s .c o m cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("DESTINO", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); return table; }
From source file:com.devox.GUI.PDF.CrearReporteTarimas.java
@Override public PdfPTable crearTabla() { PdfPTable table = new PdfPTable(4); PdfPCell cell; cell = new PdfPCell(new Phrase("FOLIO DHL", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO);//w ww.ja v a 2 s . c o m cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("PRODUCTO (Descripcin)", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO INTERNO", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", FUENTE_CABECERA_TABLA_MEDIANA)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 1f, 1.5f, 2.5f, 1f }); table.setWidthPercentage(100); } catch (DocumentException ex) { Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private static PdfPTable createTable() { PdfPTable table = new PdfPTable(6); PdfPCell cell; cell = new PdfPCell(new Phrase("DESCRIPCIN", font_headertable1)); cell.setBackgroundColor(AMARILLO);/*w ww . j av a2s.c om*/ cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("LOTE", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO UNITARIO", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("SUBTOTAL", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(AMARILLO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 5f, 2f, 3f, 1.2f, 1.4f, 1.5f }); table.setWidthPercentage(98); } catch (DocumentException ex) { Log.print(ex); Log.print(ex); } return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private static PdfPTable createSigningTable() { PdfPTable table = new PdfPTable(4); PdfPCell cell; cell = new PdfPCell(new Phrase("RMA", font_headertable2)); cell.setBackgroundColor(AMARILLO);// w w w . j a v a2s . co m cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(25f); table.addCell(cell); cell = new PdfPCell(new Phrase("ORDEN", font_headertable2)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("ELABOR", font_headertable2)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("DICTAMIN QA", font_headertable2)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setFixedHeight(50f); for (int i = 0; i < 4; i++) { table.addCell(cell); } cell = new PdfPCell(new Phrase(" ")); cell.setFixedHeight(25f); cell.setBackgroundColor(GRIS_CLARO); for (int i = 0; i < 2; i++) { table.addCell(cell); } cell = new PdfPCell(new Phrase("NOMBRE Y FIRMA", font_table)); cell.setFixedHeight(25f); cell.setBackgroundColor(GRIS_CLARO); for (int i = 0; i < 2; i++) { table.addCell(cell); } table.setTotalWidth(500); return table; }
From source file:com.devox.GUI.PDF.ExportarAPDF.java
private PdfPTable createTableTarimas() { PdfPTable table = new PdfPTable(4); PdfPCell cell; cell = new PdfPCell(new Phrase("FOLIO DHL", font_headertable1)); cell.setBackgroundColor(AMARILLO);//w ww . j a va 2 s. co m cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorRight(GRIS_CLARO); cell.setFixedHeight(20f); table.addCell(cell); cell = new PdfPCell(new Phrase("PRODUCTO (Descripcin)", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CDIGO INTERNO", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); cell = new PdfPCell(new Phrase("CANTIDAD", font_headertable1)); cell.setBackgroundColor(AMARILLO); cell.setBorderColorBottom(BaseColor.BLACK); cell.setBorderColorLeft(GRIS_CLARO); cell.setBorderColorRight(GRIS_CLARO); cell.setBorderColorTop(AMARILLO); table.addCell(cell); try { table.setWidths(new float[] { 1f, 1.5f, 2.5f, 1f }); table.setWidthPercentage(100); } catch (DocumentException ex) { Log.print(ex); Log.print(ex); } return table; }
From source file:jdbreport.model.io.pdf.itext5.PdfWriter.java
License:Apache License
private void assignBorders(CellStyle style, PdfPCell pdfCell) { pdfCell.setBorderWidth(0);// w w w . jav a 2 s. co m Border border = style.getBorders(Border.LINE_LEFT); if (border != null) { pdfCell.setBorderWidthLeft(border.getLineWidth()); pdfCell.setBorderColorLeft(new BaseColor(border.getColor().getRGB())); } border = style.getBorders(Border.LINE_RIGHT); if (border != null) { pdfCell.setBorderWidthRight(border.getLineWidth()); pdfCell.setBorderColorRight(new BaseColor(border.getColor().getRGB())); } border = style.getBorders(Border.LINE_TOP); if (border != null) { pdfCell.setBorderWidthTop(border.getLineWidth()); pdfCell.setBorderColorTop(new BaseColor(border.getColor().getRGB())); } border = style.getBorders(Border.LINE_BOTTOM); if (border != null) { pdfCell.setBorderWidthBottom(border.getLineWidth()); pdfCell.setBorderColorBottom(new BaseColor(border.getColor().getRGB())); } }