Example usage for com.itextpdf.text BaseColor GRAY

List of usage examples for com.itextpdf.text BaseColor GRAY

Introduction

In this page you can find the example usage for com.itextpdf.text BaseColor GRAY.

Prototype

BaseColor GRAY

To view the source code for com.itextpdf.text BaseColor GRAY.

Click Source Link

Usage

From source file:pdf.PDFDesign.java

private PdfPTable createStyle6_4x7Table(List<Item> list) throws DocumentException, IOException {
    PdfPTable table = new PdfPTable(nColumns);
    table.setWidthPercentage(100.0f);// ww w.ja v a  2 s. c  o  m

    for (int i = 0; i < list.size(); i++) {
        Item item = list.get(i);
        PdfPTable innerTable = new PdfPTable(1);
        Paragraph p1 = new Paragraph();
        p1.setFont(titleLineFont);
        String t = item.getTitle();
        String[] split = t.split("//");
        for (String split1 : split) {
            p1.add(split1 + "\n");
        }
        PdfPCell innercCell1 = new PdfPCell(p1);
        innercCell1.setBorder(0);
        if (t.contains("//")) {
            innercCell1.setFixedHeight(titleLineFixedHeight);
        } else {
            innercCell1.setFixedHeight(15.0f + textFontInc);
        }
        innercCell1.setHorizontalAlignment(Element.ALIGN_CENTER);

        Paragraph p2 = new Paragraph();
        p2.setFont(amountAndPriceLabelLineFont);
        p2.add("Mnostv: " + item.getAmount() + item.getUnit() + "\n");
        PdfPCell innercCell2 = new PdfPCell(p2);
        innercCell2.setLeading(5f, 0f);
        innercCell2.setBorder(0);
        innercCell2.setFixedHeight(12.0f);
        innercCell2.setHorizontalAlignment(Element.ALIGN_CENTER);

        PdfPCell innercCell3 = new PdfPCell(createLine3Table(item, 0, 0, 0));
        innercCell3.setBorder(0);
        innercCell3.setLeading(2.0f, 0f);
        innercCell3.setFixedHeight(67.0f);
        innercCell3.setHorizontalAlignment(Element.ALIGN_CENTER);

        Paragraph p4 = new Paragraph();
        p4.setFont(unitPriceLineFont);
        p4.add("Cena za 1" + item.getXUnit() + ": " + item.getUnitPrice() + " " + item.getCurrency());
        PdfPCell innercCell4 = new PdfPCell(p4);
        innercCell4.setBorder(0);
        innercCell4.setLeading(1f, 0f);
        innercCell4.setHorizontalAlignment(Element.ALIGN_CENTER);

        innerTable.addCell(innercCell1);
        innerTable.addCell(innercCell2);
        innerTable.addCell(innercCell3);
        innerTable.addCell(innercCell4);

        PdfPCell cell = new PdfPCell(innerTable);
        cell.setFixedHeight(cellHeight);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBorderColor(BaseColor.GRAY);
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(cell);
    }

    int remainder = list.size() % nColumns;
    if (remainder != 0) {
        remainder = nColumns - remainder;
    }
    for (int i = 0; i < remainder; i++) {
        PdfPCell c = new PdfPCell(new Phrase(" "));
        c.setBorderColor(BaseColor.GRAY);
        table.addCell(c);
    }
    return table;
}

From source file:pdf.PDFDesign.java

private PdfPCell createEuroCell(Item item) throws DocumentException, IOException {
    Font descFont = new Font(droidsans, 12, Font.NORMAL, color);
    Font unitPriceFont = new Font(droidsans, 10, Font.NORMAL, color);

    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);/*w  ww. ja  v  a  2s.  c  o m*/
    PdfPCell cell;
    Paragraph p;

    cell = new PdfPCell();
    p = new Paragraph();
    p.setFont(descFont);
    p.add(item.getTitle());
    cell.setFixedHeight(28f);
    cell.setPhrase(p);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    p = new Paragraph();
    p.setFont(descFont);
    p.add(item.getAmount() + item.getUnit());
    cell.setFixedHeight(16f);
    cell.setPhrase(p);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorder(0);
    table.addCell(cell);

    table.addCell(createEuroInnerPrice(item));

    cell = new PdfPCell();
    p = new Paragraph();
    p.setFont(unitPriceFont);
    p.add("Cena za 1" + item.getXUnit() + ": " + item.getUnitPrice() + item.getCurrency() + "/"
            + item.getSecondUnitPrice() + item.getSecondCurrency());
    cell.setPhrase(p);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorder(0);
    cell.setLeading(2f, 0f);
    table.addCell(cell);

    PdfPCell finalCell = new PdfPCell(table);
    finalCell.setFixedHeight(117.4f);
    finalCell.setBorderColor(BaseColor.GRAY);
    return finalCell;
}

From source file:pdf.PDFDesign.java

private PdfPTable createEuro_6_Table(List<Item> list) throws DocumentException {
    //int nColumns = 4;
    PdfPTable table = new PdfPTable(nColumns);
    table.setWidthPercentage(100.0f);/*from  w  w  w  .java 2s .  co  m*/

    for (int i = 0; i < list.size(); i++) {
        table.addCell(createEuro_6_Cell(list.get(i)));
    }
    int remainder = list.size() % nColumns;
    if (remainder != 0) {
        remainder = nColumns - remainder;
    }
    for (int i = 0; i < remainder; i++) {
        PdfPCell c = new PdfPCell(new Phrase(" "));
        c.setBorderColor(BaseColor.GRAY);
        table.addCell(c);
    }
    return table;
}

From source file:pdf.PDFDesign.java

private PdfPCell createEuro_6_Cell(Item item) throws DocumentException {
    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);/*from   ww w .j  a  v a 2 s .co m*/

    PdfPCell cell;
    Paragraph p;

    cell = new PdfPCell();
    p = new Paragraph();
    p.setFont(new Font(droidsans, 13, Font.NORMAL, color));
    String t = item.getTitle();
    String[] split = t.split("//");
    for (String split1 : split) {
        p.add(split1 + "\n");
    }
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setPhrase(p);
    cell.setColspan(2);
    cell.setFixedHeight(30f);
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell();
    p = new Paragraph();
    p.setFont(new Font(droidsans, 11, Font.NORMAL, color));
    p.add(item.getAmount() + "" + item.getUnit());
    cell.setPhrase(p);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setBorder(0);
    table.addCell(cell);

    table.addCell(createEuro_6_InnerPrice(item));

    cell = new PdfPCell();
    p = new Paragraph();
    p.setFont(new Font(droidsans, 11, Font.NORMAL, color));
    p.add("Cena za 1" + item.getXUnit() + ": " + item.getUnitPrice() + item.getCurrency() + "/"
            + item.getSecondUnitPrice() + item.getSecondCurrency());
    cell.setPhrase(p);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorder(0);
    table.addCell(cell);

    PdfPCell finalCell = new PdfPCell(table);
    finalCell.setFixedHeight(cellHeight);//175f
    finalCell.setBorderColor(BaseColor.GRAY);
    return finalCell;
}

From source file:Reporte.PdfChance.java

private void generarFilaTotales() throws DocumentException {

    PdfPCell celdaFinal = new PdfPCell(new Paragraph("Totales"));
    celdaFinal.setBackgroundColor(BaseColor.GRAY);
    celdaFinal.setColspan(1);/*from ww  w  .j a  v a2  s  .c  o m*/

    NumberFormat formatoNumero = NumberFormat.getNumberInstance();
    tabla.addCell(celdaFinal);
    PdfPCell parrafo1 = new PdfPCell(new Paragraph(formatoNumero.format(this.totalPremio)));
    parrafo1.setHorizontalAlignment(Element.ALIGN_RIGHT);
    tabla.addCell(parrafo1);

    documento.add(tabla);

    documento.add(new Paragraph("Cantidad de registros: " + this.totalRegistros));
}

From source file:Reporte.PdfChance.java

/**
 * da forrmato a las columnas//from ww w  .j  av a  2s  .  co  m
 *
 * @param tabla
 * @return
 */
private PdfPTable formatoColumna(PdfPTable tabla) {
    PdfPCell columna[] = new PdfPCell[2];
    Font fuente = new Font();
    fuente.setSize(10);
    columna[0] = new PdfPCell(new Paragraph("Vendedor", fuente));
    columna[0].setBackgroundColor(BaseColor.GRAY);

    columna[1] = new PdfPCell(new Paragraph("Venta", fuente));
    columna[1].setBackgroundColor(BaseColor.GRAY);

    tabla.addCell(columna[0]);
    tabla.addCell(columna[1]);

    return tabla;
}

From source file:Reporte.PdfInformeGeneral.java

/**
 * da forrmato a las columnas/*from  ww  w . j av  a 2s  .  co  m*/
 *
 * @param tabla
 * @return
 */
private PdfPTable formatoColumna(PdfPTable tabla) {
    PdfPCell columna[] = new PdfPCell[5];
    Font fuente = new Font();
    fuente.setSize(10);
    columna[0] = new PdfPCell(new Paragraph("Tipo", fuente));
    columna[0].setBackgroundColor(BaseColor.GRAY);

    columna[1] = new PdfPCell(new Paragraph("Ventas", fuente));
    columna[1].setBackgroundColor(BaseColor.GRAY);

    columna[2] = new PdfPCell(new Paragraph("Comision", fuente));
    columna[2].setBackgroundColor(BaseColor.GRAY);

    columna[3] = new PdfPCell(new Paragraph("Premio", fuente));
    columna[3].setBackgroundColor(BaseColor.GRAY);

    columna[4] = new PdfPCell(new Paragraph("Utilidad", fuente));
    columna[4].setBackgroundColor(BaseColor.GRAY);

    tabla.addCell(columna[0]);
    tabla.addCell(columna[1]);
    tabla.addCell(columna[2]);
    tabla.addCell(columna[3]);
    tabla.addCell(columna[4]);

    return tabla;

}

From source file:Reporte.PdfInformePrestamos.java

private void generarFilaTotalesPrestamo() throws DocumentException {
    Font fuente = new Font();
    fuente.setSize(10);/*from  w  w w  .  j  av a  2  s.  com*/

    PdfPCell celdaFinal = new PdfPCell(new Paragraph("Total"));
    celdaFinal.setBackgroundColor(BaseColor.GRAY);
    NumberFormat formatoNumero = NumberFormat.getNumberInstance();
    celdaFinal.setColspan(1);
    tabla.addCell(celdaFinal);

    PdfPCell parrafo1 = new PdfPCell(new Paragraph(formatoNumero.format(this.totalP), fuente));
    parrafo1.setHorizontalAlignment(Element.ALIGN_RIGHT);
    tabla.addCell(parrafo1);

    documento.add(tabla);

}

From source file:Reporte.PdfInformePrestamos.java

private void generarFilaTotalesPago() throws DocumentException {
    Font fuente = new Font();
    fuente.setSize(10);/*from  w w  w . j a  v  a  2 s . co  m*/

    PdfPCell celdaFinal = new PdfPCell(new Paragraph("Total"));
    celdaFinal.setBackgroundColor(BaseColor.GRAY);
    NumberFormat formatoNumero = NumberFormat.getNumberInstance();
    celdaFinal.setColspan(1);
    tabla.addCell(celdaFinal);

    PdfPCell parrafo1 = new PdfPCell(new Paragraph(formatoNumero.format(this.totalPa), fuente));
    parrafo1.setHorizontalAlignment(Element.ALIGN_RIGHT);
    tabla.addCell(parrafo1);

    documento.add(tabla);

}

From source file:Reporte.PdfInformePrestamos.java

/**
 * da forrmato a las columnas//from w  w w.ja v  a2  s .  co m
 *
 * @param tabla
 * @return
 */
private PdfPTable formatoColumna(PdfPTable tabla) {
    PdfPCell columna[] = new PdfPCell[2];
    Font fuente = new Font();
    fuente.setSize(10);
    columna[0] = new PdfPCell(new Paragraph("Fecha", fuente));
    columna[0].setBackgroundColor(BaseColor.GRAY);

    columna[1] = new PdfPCell(new Paragraph("Valor", fuente));
    columna[1].setBackgroundColor(BaseColor.GRAY);

    tabla.addCell(columna[0]);
    tabla.addCell(columna[1]);
    return tabla;

}