Example usage for com.itextpdf.text Phrase Phrase

List of usage examples for com.itextpdf.text Phrase Phrase

Introduction

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

Prototype

public Phrase(final float leading, final String string) 

Source Link

Document

Constructs a Phrase with a certain leading and a certain String.

Usage

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;/*from   w  ww .j av  a2  s .c  o  m*/
    cell = new PdfPCell(new Phrase("CDIGO", FUENTE_CABECERA_TABLA_CHICA));
    cell.setBackgroundColor(AMARILLO);
    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.CrearReporteApto.java

@Override
public void agregarProductos(PdfPTable table) {
    int rows = datos.length;
    Log.print("rows: " + rows);
    int total = 0;
    float precio = 0;
    for (int i = 0; i < rows; i++) {
        // Cdigo// w ww .  j av  a 2  s .c  om
        PdfPCell cell = new PdfPCell(new Phrase(datos[i][0].toString(), FUENTE_TABLA));
        cell.setFixedHeight(21f);
        table.addCell(cell);
        // Descripcin
        table.addCell(new Phrase(datos[i][1].toString(), FUENTE_TABLA));
        // Lote
        table.addCell(new Phrase(datos[i][2].toString(), FUENTE_TABLA));
        // Fecha de caducidad
        table.addCell(new Phrase("  "));
        // Cantidad
        int c = ((Integer) datos[i][3]);
        total += c;
        table.addCell(new Phrase(datos[i][3].toString(), FUENTE_TABLA));
        // Dictamen
        table.addCell(new Phrase("  "));
        // Precio
        float p = new Float(datos[i][4].toString());
        precio += (c * p);
        table.addCell(new Phrase(datos[i][4].toString(), FUENTE_TABLA));
        // Observaciones
        table.addCell(new Phrase("  "));

    }
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("SUMA ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("" + total, FUENTE_BASE_TABLA));
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("$ " + String.format("%.2f", precio), FUENTE_BASE_TABLA));
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
}

From source file:com.devox.GUI.PDF.CrearReporteDestruccion.java

@Override
public PdfPTable crearTabla() {
    PdfPTable table = new PdfPTable(6);
    PdfPCell cell;//from   w w  w. j a v a 2  s  .co m
    cell = new PdfPCell(new Phrase("DESCRIPCIN", FUENTE_CABECERA_TABLA_CHICA));
    cell.setBackgroundColor(AMARILLO);
    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.CrearReporteDestruccion.java

@Override
public void agregarProductos(PdfPTable table) {
    int rows = model.getRowCount();
    int total = 0;
    float monto = 0f;

    for (int i = 0; i < rows; i++) {
        PdfPCell cell = new PdfPCell();
        cell.addElement(new Phrase((String) model.getValueAt(i, 2), FUENTE_TABLA));

        table.addCell(cell);//from w w w . ja v a  2 s.  co  m
        if (ANI) {
            try {
                String lotereal = ((String) model.getValueAt(i, 3));
                System.out.println("Lote original: " + lotereal);
                String lotecorto = lotereal.substring(0, 7);
                System.out.println("Lote acortado: " + lotecorto);

                table.addCell(new Phrase(lotecorto, FUENTE_TABLA));
            } catch (Exception ex) {
                table.addCell(new Phrase((String) model.getValueAt(i, 3), FUENTE_TABLA));
            }
        } else {
            table.addCell(new Phrase((String) model.getValueAt(i, 3), FUENTE_TABLA));
        }
        table.addCell(new Phrase((String) model.getValueAt(i, 1), FUENTE_TABLA));
        int c = (Integer) model.getValueAt(i, 5);
        total += c;
        table.addCell(new Phrase(Integer.toString(c), FUENTE_TABLA));
        table.addCell(new Phrase("$ " + model.getValueAt(i, 4).toString(), FUENTE_TABLA));
        Float p = new Float(model.getValueAt(i, 6).toString());
        monto += p;
        table.addCell(new Phrase("$ " + String.format("%.2f", p), FUENTE_TABLA));
    }
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("Total ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("" + total, FUENTE_BASE_TABLA));
    table.addCell(new Phrase("  ", FUENTE_BASE_TABLA));
    table.addCell(new Phrase("$ " + String.format("%.2f", monto), FUENTE_BASE_TABLA));

}

From source file:com.devox.GUI.PDF.CrearReportePorEstado.java

@Override
public PdfPTable crearTabla() {
    PdfPTable table = new PdfPTable(2);
    PdfPCell cell;/*from  www  .  j a  v  a 2 s  .co  m*/
    cell = new PdfPCell(new Phrase("FOLIO DHL", FUENTE_CABECERA_TABLA_MEDIANA));
    cell.setBackgroundColor(AMARILLO);
    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;//ww w.j  av  a 2s.co m
    cell = new PdfPCell(new Phrase("FOLIO DHL", FUENTE_CABECERA_TABLA_MEDIANA));
    cell.setBackgroundColor(AMARILLO);
    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;/*  w  w  w .j  av  a 2s  .c om*/
    cell = new PdfPCell(new Phrase("DESCRIPCIN", font_headertable1));
    cell.setBackgroundColor(AMARILLO);
    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;//from w w  w.j ava  2  s.  c om
    cell = new PdfPCell(new Phrase("RMA", font_headertable2));
    cell.setBackgroundColor(AMARILLO);
    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;/*www  . ja  v  a  2 s . c  o m*/
    cell = new PdfPCell(new Phrase("FOLIO DHL", font_headertable1));
    cell.setBackgroundColor(AMARILLO);
    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:com.docdoku.server.extras.TitleBlockGenerator.java

License:Open Source License

protected void generateTable(Paragraph preface, ResourceBundle bundle) {
    // Author + date
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(TABLE_PERCENT_WIDTH);

    PdfPCell cell;/* w ww. j a va2  s .  co m*/

    cell = new PdfPCell(new Phrase(authorName, NORMAL_12));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(creationDate, NORMAL_12));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    table.addCell(cell);

    preface.add(table);

    addEmptyLine(preface, 1);

    preface.add(new Paragraph(bundle.getString("iteration"), BOLD_12));
    addEmptyLine(preface, 1);

    PdfPTable iterationTable = new PdfPTable(5);
    iterationTable.setWidthPercentage(TABLE_PERCENT_WIDTH);

    // Table header
    cell = new PdfPCell(new Phrase(bundle.getString("iteration.version"), BOLD_12));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(bundle.getString("iteration.iteration"), BOLD_12));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(bundle.getString("iteration.date"), BOLD_12));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(bundle.getString("iteration.author"), BOLD_12));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(bundle.getString("iteration.Notes"), BOLD_12));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    iterationTable.addCell(cell);

    // Table body
    cell = new PdfPCell(new Phrase(version, NORMAL_12));
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(currentIteration, NORMAL_12));
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(iterationDate, NORMAL_12));
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(authorName, NORMAL_12));
    iterationTable.addCell(cell);
    cell = new PdfPCell(new Phrase(revisionNote, NORMAL_12));
    iterationTable.addCell(cell);

    preface.add(iterationTable);
}