Example usage for com.itextpdf.text.pdf PdfPCell setPaddingLeft

List of usage examples for com.itextpdf.text.pdf PdfPCell setPaddingLeft

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPCell setPaddingLeft.

Prototype

public void setPaddingLeft(float paddingLeft) 

Source Link

Document

Setter for property paddingLeft.

Usage

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);/*  w w  w . jav a 2 s . c  om*/
    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  w  w.  j a  va2 s.  co 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.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * /*  w  ww  . j a v a  2s  .co  m*/
 *  box 
 *
 * @param section box  section ?
 * @param e box   element
 * @throws Exception
 */
public static void setBox(Section section, Element e) throws Exception {

    PdfPTable t = new PdfPTable(1);
    t.setSpacingBefore(1);
    t.setSpacingAfter(12);

    if (e.getAttributeValue("width") != null)
        t.setTotalWidth(Float.parseFloat(e.getAttributeValue("width")));

    PdfPCell cell = new PdfPCell();
    if (e.getAttributeValue("option") != null) {

        ColumnText col = new ColumnText(null);
        for (Element e1 : e.getChildren()) {
            if (e1.getAttributeValue("type").equals("red"))
                col.addText(new Phrase(e1.getText(), fnBoxRed));
            else
                col.addText(new Phrase(e1.getText(), fnBox));
        }
        cell.setColumn(col);

    } else {
        cell.setPhrase(new Phrase(e.getText(), fnBox));
    }

    cell.setPaddingLeft(10);
    cell.setLeading(0.0F, 1.8F);
    cell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(new BaseColor(238, 236, 225));

    t.addCell(cell);

    section.add(t);

}

From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * //from www.ja  va2  s . c om
 * box (Backgroud : Black)
 *
 * @param section box  section ?
 * @param e box   element
 * @throws Exception
 */
public static void setBoxB(Section section, Element e) throws Exception {

    PdfPTable t = new PdfPTable(1);
    t.setSpacingBefore(1);
    t.setSpacingAfter(12);

    if (e.getAttributeValue("width") != null)
        t.setTotalWidth(Float.parseFloat(e.getAttributeValue("width")));

    PdfPCell cell = new PdfPCell();
    if (e.getAttributeValue("option") != null) {

        ColumnText col = new ColumnText(null);
        for (Element e1 : e.getChildren()) {
            if (e1.getAttributeValue("type").equals("red"))
                col.addText(new Phrase(e1.getText(), fnBoxRed));
            else
                col.addText(new Phrase(e1.getText(), fnBoxWhite));
        }
        cell.setColumn(col);

    } else {
        cell.setPhrase(new Phrase(e.getText(), fnBoxWhite));
    }

    cell.setPaddingLeft(10);
    cell.setLeading(0.0F, 1.8F);
    cell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(new BaseColor(0, 0, 0));

    t.addCell(cell);

    section.add(t);

}

From source file:com.athena.chameleon.engine.utils.PDFWriterUtil.java

License:Apache License

/**
 * /*from   www.  ja  v  a2 s. com*/
 * box (Backgroud : White)
 *
 * @param section box  section ?
 * @param e box   element
 * @throws Exception
 */
public static void setBoxW(Section section, Element e) throws Exception {

    PdfPTable t = new PdfPTable(1);
    t.setSpacingBefore(1);
    t.setSpacingAfter(12);

    if (e.getAttributeValue("width") != null)
        t.setTotalWidth(Float.parseFloat(e.getAttributeValue("width")));

    PdfPCell cell = new PdfPCell();
    if (e.getAttributeValue("option") != null) {

        ColumnText col = new ColumnText(null);
        for (Element e1 : e.getChildren()) {
            if (e1.getAttributeValue("type").equals("red"))
                col.addText(new Phrase(e1.getText(), fnBoxRed));
            else
                col.addText(new Phrase(e1.getText(), fnBoxBlack));
        }
        cell.setColumn(col);

    } else {
        cell.setPhrase(new Phrase(e.getText(), fnBoxBlack));
    }

    cell.setPaddingLeft(10);
    cell.setLeading(0.0F, 1.8F);
    cell.setVerticalAlignment(com.itextpdf.text.Element.ALIGN_MIDDLE);
    cell.setBackgroundColor(new BaseColor(255, 255, 255));

    t.addCell(cell);

    section.add(t);

}

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

@Override
public PdfPTable configurarInformacion() {
    PdfPTable table = new PdfPTable(2);
    try {/*from   w ww.  java 2 s.com*/
        PdfPCell cell;
        Phrase folio = new Phrase();
        folio.add(new Chunk("FOLIO DHL ", FUENTE_FOLIO_CHICA));
        folio.add(new Chunk(contenido.getFolioDHL(), FUENTE_FOLIO_CHICA_ROJA));
        cell = new PdfPCell(folio);
        cell.setRowspan(8);
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Cliente ", contenido.getNombreCliente()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Nmero de cliente ", contenido.getClaveCliente()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Folio del cliente ", contenido.getFolioCliente()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Folio Abbott ", contenido.getFolioAbbott()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Motivo de devolucin ",
                contenido.getMotivo().getCodigo() + " - " + contenido.getMotivo().getDescripcion()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Factura ", contenido.getFactura()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Almacn ", contenido.getAlmacen()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(
                getPhraseFromChunks("Fecha de captura ", Funciones.getOtherDate(contenido.getFechaCaptura())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);

        table.setWidthPercentage(100);
        table.setWidths(new int[] { 1, 3 });

    } catch (DocumentException ex) {
        Log.print(ex);
    }
    return table;
}

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

@Override
public PdfPTable configurarInformacion() {
    PdfPTable table = new PdfPTable(2);
    PdfPCell cell;

    cell = new PdfPCell(getPhraseFromChunks("DEL ", fechaInicio));
    cell.setBorder(PdfPCell.NO_BORDER);/*from  www  .  ja  v a2 s .com*/
    cell.setPaddingLeft(40);
    table.addCell(cell);
    cell = new PdfPCell(getPhraseFromChunks("AL ", fechaFin));
    cell.setBorder(PdfPCell.NO_BORDER);
    cell.setPaddingLeft(40);
    table.addCell(cell);
    table.setWidthPercentage(100);
    return table;
}

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

@Override
public PdfPTable configurarInformacion() {
    PdfPTable table = new PdfPTable(2);
    try {/*  w w  w  . ja  v  a 2  s. c o m*/
        PdfPCell cell;
        Phrase tarima = new Phrase();
        tarima.add(new Chunk("TARIMA\n", FUENTE_TARIMA_NEGRO));
        tarima.add(new Chunk(datosTarima.getNombreTarima(), FUENTE_TARIMA_ROJO));
        cell = new PdfPCell(tarima);
        cell.setRowspan(5);
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        cell.setFixedHeight(200f);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("DIVISIN ", datosTarima.getDivision()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("ALMACN ", datosTarima.getAlmacen()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("FECHA DE APERTURA ",
                Funciones.getOtherDate(datosTarima.getFecha_Apertura())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("FECHA DE CIERRE ",
                (datosTarima.getFecha_Cierra() == null ? "TARIMA ABIERTA"
                        : Funciones.getOtherDate(datosTarima.getFecha_Cierra()))));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("DESTRUCCIN FISCAL ",
                Integer.toString(datosTarima.getDestruccionFiscal())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);

        table.setWidthPercentage(100);
        table.setWidths(new int[] { 2, 1 });
    } catch (DocumentException de) {
        Log.print(de);
    }
    return table;
}

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

private static PdfPTable setUpInformation() {
    PdfPTable table = new PdfPTable(2);
    try {/*  www.ja  v  a 2 s  .  c  o  m*/
        PdfPCell cell;
        Phrase folio = new Phrase();
        folio.add(new Chunk("FOLIO DHL ", font_foliodhl));
        folio.add(new Chunk(contenido.getFolioDHL(), font_folionum));
        cell = new PdfPCell(folio);
        cell.setRowspan(8);
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Cliente ", contenido.getNombreCliente()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Nmero de cliente ", contenido.getClaveCliente()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Folio del cliente ", contenido.getFolioCliente()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Folio Abbott ", contenido.getFolioAbbott()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Motivo de devolucin ",
                contenido.getMotivo().getCodigo() + " - " + contenido.getMotivo().getDescripcion()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Factura ", contenido.getFactura()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("Almacn ", contenido.getAlmacen()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(
                getPhraseFromChunks("Fecha de captura ", Funciones.getOtherDate(contenido.getFechaCaptura())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);

        table.setWidthPercentage(100);
        table.setWidths(new int[] { 1, 3 });

    } catch (DocumentException ex) {
        Log.print(ex);
        Log.print(ex);
    }
    return table;
}

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

private PdfPTable setUpInformationTarimas() {
    PdfPTable table = new PdfPTable(2);
    try {//  ww w.  ja va  2  s. c  o  m
        PdfPCell cell;
        Phrase tarima = new Phrase();
        tarima.add(new Chunk("TARIMA\n", font_tarimota));
        tarima.add(new Chunk(datosTarima.getNombreTarima(), font_tarimota_gris));
        cell = new PdfPCell(tarima);
        cell.setRowspan(5);
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        cell.setFixedHeight(200f);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("DIVISIN ", datosTarima.getDivision()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("ALMACN ", datosTarima.getAlmacen()));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("FECHA DE APERTURA ",
                Funciones.getOtherDate(datosTarima.getFecha_Apertura())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(
                getPhraseFromChunks("FECHA DE CIERRE ", Funciones.getOtherDate(datosTarima.getFecha_Cierra())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);
        cell = new PdfPCell(getPhraseFromChunks("DESTRUCCIN FISCAL ",
                Integer.toString(datosTarima.getDestruccionFiscal())));
        cell.setBorder(PdfPCell.NO_BORDER);
        cell.setPaddingLeft(40);
        table.addCell(cell);

        table.setWidthPercentage(100);
        table.setWidths(new int[] { 2, 1 });
    } catch (DocumentException de) {
        Log.print(de);
    }
    return table;
}