Example usage for com.lowagie.text.pdf PdfPCell PdfPCell

List of usage examples for com.lowagie.text.pdf PdfPCell PdfPCell

Introduction

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

Prototype

public PdfPCell(PdfPCell cell) 

Source Link

Document

Constructs a deep copy of a PdfPCell.

Usage

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setBarra(int colSpan, float color) {
    PdfPCell celda = new PdfPCell(new Paragraph(" ", new Font(Font.HELVETICA, 1, Font.NORMAL)));
    celda.setGrayFill(color);// www  .  jav a 2s  . com
    celda.setBorderWidth(0);
    celda.setPadding(0);
    celda.setColspan(colSpan);
    return celda;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setLogo(String logo, int ancho, int alto) {
    PdfPCell celdaImg = null;//from w w  w  . j  a v a2  s  .c o  m
    try {
        Image imagelogo = Image.getInstance(logo);
        imagelogo.scaleAbsolute(ancho, alto);
        celdaImg = new PdfPCell(imagelogo);
        celdaImg.setBorderWidth(0);
        celdaImg.setPadding(0);
    } catch (Exception e) {
        celdaImg = null;
    }
    return celdaImg;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setLogo(String logo, int ancho, int alto, int alineacion) {
    PdfPCell celdaImg = null;/*from  ww  w .  j av a2s . c om*/
    try {
        Image imagelogo = Image.getInstance(logo);
        imagelogo.scaleAbsolute(ancho, alto);
        celdaImg = new PdfPCell(imagelogo);
        celdaImg.setBorderWidth(0);
        celdaImg.setHorizontalAlignment(alineacion);
        celdaImg.setPadding(0);
    } catch (Exception e) {
        celdaImg = null;
    }
    return celdaImg;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setBarCode(Image logo) {
    PdfPCell celdaImg = null;//from w w w .  j  a  v  a2  s  .  c  o  m
    try {
        Image imagelogo = Image.getInstance(logo);
        celdaImg = new PdfPCell(imagelogo);
        celdaImg.setBorderWidth(0);
        celdaImg.setPadding(5);
        celdaImg.setHorizontalAlignment(Element.ALIGN_CENTER);
    } catch (Exception e) {
        celdaImg = null;
    }
    return celdaImg;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPCell setLogoCarnet(String logo, int ancho, int alto) {
    PdfPCell celdaImg = null;//  ww  w . j  av a 2 s .co m
    try {
        Image imagelogo = Image.getInstance(logo);
        imagelogo.scaleAbsolute(ancho, alto);
        celdaImg = new PdfPCell(imagelogo);
        celdaImg.setBorderWidth(0);
        celdaImg.setPadding(0);
        celdaImg.setPaddingLeft(50);
    } catch (Exception e) {
        celdaImg = null;
    }
    return celdaImg;
}

From source file:jm.web.Addons.java

License:GNU General Public License

public static PdfPTable setCabecera(String logo, String titulo, String ruc, String subtitulo, String direccion,
        String sucursal) {/*from   w  ww.  j ava2s  .co m*/
    PdfPTable encabezado = new PdfPTable(new float[] { 80f, 400f });
    PdfPTable tbl_encab = new PdfPTable(1);
    Image imagelogo = null;
    try {
        imagelogo = Image.getInstance(logo);
        imagelogo.scaleAbsolute(150, 70);
        PdfPCell celdaImg = new PdfPCell(imagelogo);
        celdaImg.setBorderWidth(0);
        celdaImg.setPadding(0);
        encabezado.addCell(celdaImg);
    } catch (Exception e) {
        encabezado.addCell("");
    }
    tbl_encab.addCell(Addons.setCeldaPDF(titulo, Font.HELVETICA, 13, Font.BOLD, Element.ALIGN_CENTER, 0));
    tbl_encab.addCell(Addons.setCeldaPDF(direccion, Font.HELVETICA, 11, Font.NORMAL, Element.ALIGN_CENTER, 0));
    if (ruc.compareTo("") != 0) {
        tbl_encab.addCell(
                Addons.setCeldaPDF("RUC: " + ruc, Font.HELVETICA, 11, Font.NORMAL, Element.ALIGN_CENTER, 0));
    }
    tbl_encab.addCell(Addons.setCeldaPDF(subtitulo, Font.HELVETICA, 10, Font.NORMAL, Element.ALIGN_CENTER, 0));

    encabezado.addCell(Addons.setCeldaPDF(tbl_encab, Element.ALIGN_CENTER, 0));

    encabezado.addCell(Addons.setFilaBlanco(2, 6));

    if (sucursal.compareTo("") != 0) {
        encabezado.addCell(Addons.setCeldaPDF("Sucursal: " + sucursal, Font.HELVETICA, 10, Font.NORMAL,
                Element.ALIGN_LEFT, 0, 0, 2));
    }

    encabezado.addCell(Addons.setCeldaPDF("Fecha de impresin: " + Fecha.getFecha("SQL"), Font.HELVETICA, 10,
            Font.NORMAL, Element.ALIGN_LEFT, 0, 0, 2));

    encabezado.addCell(Addons.setFilaBlanco(2, 4));

    return encabezado;
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeClientInfo(Document doc) throws Exception {
    PdfPTable tb = new PdfPTable(2);
    tb.setWidthPercentage(100.0f);/*from  w  ww .j a v a 2  s.  co  m*/
    tb.setSpacingAfter(20.0f);

    PdfPCell cl = new PdfPCell(
            new Phrase(this.client.getName() + "\n" + this.client.getAdress(), new Font(baseArial, 10)));
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase(this.we.getName() + "\n" + this.we.getAdress(), new Font(baseArial, 10)));
    tb.addCell(cl);

    doc.add(tb);

}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeTicketInfo(Document doc) throws Exception {
    Paragraph pg = new Paragraph("#" + tt.getUniqueId(), new Font(baseArial, 12, Font.BOLD));
    doc.add(pg);// w w  w .j  a va 2s  . com

    PdfPTable tb = new PdfPTable(1);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(5.0f);

    PdfPCell cl = new PdfPCell(new Phrase(tt.getName(), new Font(baseArial, 10, Font.BOLD)));

    tb.addCell(cl);

    if (clientPerson != null) {
        cl = new PdfPCell(new Phrase(
                "Prane: " + clientPerson.getName() + " (Telefono Nr: " + clientPerson.getPhoneNo() + ")",
                new Font(baseArial, 10)));
        tb.addCell(cl);
    }

    cl = new PdfPCell(new Phrase("Uduoties informacija: ", new Font(baseArial, 10)));
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase(tt.getDescription(), new Font(baseArial, 10)));

    tb.addCell(cl);

    doc.add(tb);
}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeWorkerInfo(Document doc) throws Exception {

    PdfPTable tb = new PdfPTable(2);
    tb.setWidthPercentage(100.0f);/*from w  w  w.  j a va  2 s.com*/
    tb.setSpacingBefore(8.0f);
    tb.setSpacingAfter(8.0f);

    PdfPCell cl;

    cl = new PdfPCell(new Phrase("Atsakingas asmuo: " + me.getName(), new Font(baseArial, 10)));
    cl.setColspan(2);
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase("vykdymo data: " + timeFormat(tt.getDateClosed()), new Font(baseArial, 10)));
    tb.addCell(cl);

    if (tt.getWorktime() != null) {
        cl = new PdfPCell(new Phrase("Darbo valandos:" + tt.getWorktime(), new Font(baseArial, 10)));
        tb.addCell(cl);
    } else {
        cl = new PdfPCell(new Phrase("Darbo valandos: ", new Font(baseArial, 10)));
        tb.addCell(cl);
    }

    doc.add(tb);

    tb = new PdfPTable(2);

    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(50.0f);

    cl = new PdfPCell(new Phrase("Kliento paraas\n\n\n\n", new Font(baseArial, 10)));
    cl.setBorder(0);
    tb.addCell(cl);

    cl = new PdfPCell(new Phrase("Uduot atliks darbuotojas\n\n\n\n", new Font(baseArial, 10)));
    cl.setBorder(0);
    tb.addCell(cl);
    doc.add(tb);

}

From source file:lt.bsprendimai.ddesk.pdf.PDFTicket.java

License:Apache License

private void writeJobInfo(Document doc) throws Exception {

    Paragraph pg = new Paragraph("\nUDUOTIES ATLIKIMO INFORMACIJA", new Font(baseArial, 10, Font.BOLD));
    doc.add(pg);/*from   w  w  w .j a v a  2s  .  c  o m*/

    PdfPTable tb = new PdfPTable(3);
    tb.setWidthPercentage(100.0f);
    tb.setSpacingBefore(5.0f);
    tb.setSpacingAfter(12.0f);
    tb.setWidths(new float[] { 6.0f, 84.0f, 10.0f });

    PdfPCell cl;

    doc.add(new Phrase("\nAtlikti darbai", new Font(baseArial, 12, Font.BOLD)));

    cl = new PdfPCell(new Phrase("Eil.nr", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);
    cl = new PdfPCell(new Phrase("Uduoties pavadinimas", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);
    cl = new PdfPCell(new Phrase("Valandos", new Font(baseArial, 10, Font.BOLD)));
    tb.addCell(cl);

    doc.add(tb);

}