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

private Phrase(final boolean dummy) 

Source Link

Document

Constructs a Phrase that can be used in the static getInstance() method.

Usage

From source file:com.pdg.ticket.utils.FirstPdf.java

private static void createTable(Section subCatPart) throws BadElementException {
    PdfPTable table = new PdfPTable(3);

    // t.setBorderColor(BaseColor.GRAY);
    // t.setPadding(4);
    // t.setSpacing(4);
    // t.setBorderWidth(1);

    PdfPCell c1 = new PdfPCell(new Phrase("Table Header 1"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setBackgroundColor(BaseColor.RED);
    table.addCell(c1);/* w w w .j a v a2  s.c  o  m*/

    c1 = new PdfPCell(new Phrase("Table Header 2"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);

    c1 = new PdfPCell(new Phrase("Table Header 3"));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(c1);
    table.setHeaderRows(1);

    table.addCell("1.0");
    table.addCell("1.1");
    table.addCell("1.2");
    table.addCell("2.1");
    table.addCell("2.2");
    table.addCell("2.3");

    subCatPart.add(table);

}

From source file:com.planfeed.others.HeaderFooter.java

License:Apache License

public void onOpenDocument(PdfWriter writer, Document document) {

    header = new Phrase(date.toString());
}

From source file:com.planfeed.others.HeaderFooter.java

License:Apache License

public void onEndPage(PdfWriter writer, Document document) {
    Rectangle rect = writer.getBoxSize("art");

    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, header, rect.getRight(),
            rect.getTop(), 0);/* w w w .  j  a  v  a 2 s .co  m*/

    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER,
            new Phrase(String.format("page %d", pagenumber)), (rect.getLeft() + rect.getRight()) / 2,
            rect.getBottom() - 18, 0);
}

From source file:com.prjhuellvotweb.controlador.PDF.java

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    //Preguntar por la sesion del usuario admin
    HttpSession sessionOk = request.getSession(true);
    if (sessionOk.getAttribute("admin") != null) {
        //cambiar a tipo application/pdf
        response.setContentType("application/pdf;charset=UTF-8");
        //flujo de salida
        OutputStream out = response.getOutputStream();
        String texto = request.getParameter("report");
        //texto = "Reporte de los proyectos Sena CTGI (Centro tecnologico de gestion industrial) donde se dan a conocer"
        //                   + " los nombres de los proyectos y cantidad de votos obtenidos para cada proyecto.";
        try {/*from   w ww. ja v  a  2 s  .  c  o m*/
            Connection con = Conexion.conectar("mysql");
            DAOVoto dao = new DAOVoto();
            List<List> lista = dao.estadisticaNumeroVotos();
            Voto t = dao.contarVotos();
            int to = t.getIdUsuario();
            if (!lista.isEmpty() && lista.size() > 0) {
                try {
                    //programar pdf
                    Document documento = new Document();
                    //asosciar documento con la salida
                    PdfWriter.getInstance(documento, out);// salida del cocumento en pdf
                    //abrir documento
                    documento.open();
                    Paragraph par2 = new Paragraph();
                    Paragraph par4 = new Paragraph();
                    //agregar una imagen logo sena al pdf
                    Image imagenes = Image
                            .getInstance(getServletContext().getRealPath("") + "/Multimedia/reportes.png");
                    //Centrar la imagen
                    imagenes.setAlignment(Element.ALIGN_CENTER);
                    //tamao de la imagen
                    imagenes.scaleToFit(530, 520);
                    //agg imagen al documento F:\\Documentos\\yo\\huellvot 2 17-06-2016\\PrjHuellVotWeb\\web\\iCO.png
                    //documento.add(imghuellvot);
                    documento.add(imagenes);
                    //Agg salto de linea
                    par2.add(new Phrase(Chunk.NEWLINE));
                    par2.add(new Phrase(Chunk.NEWLINE));

                    //fuente del pdf, tipo de fuente famimilia tamao de letra
                    //Importar ttf que contiene el tipo de letra
                    FontFactory.register(
                            "C:\\Users\\pc\\Desktop\\PrjHuellVotWeb\\web\\fonts\\roboto\\Roboto-Bold.ttf",
                            "Roboto");
                    //Font fondescripcion = FontFactory.getFont("Roboto");
                    Font fondescripcion = new Font(Font.getFamily("Roboto"), 16, Font.NORMAL, BaseColor.BLACK);
                    //texto de la descripcion
                    par2.add(new Phrase(texto, fondescripcion));
                    //justificar descripcion
                    par2.setAlignment(Element.ALIGN_JUSTIFIED);
                    //Agg salto de linea
                    par2.add(new Phrase(Chunk.NEWLINE));
                    par2.add(new Phrase(Chunk.NEWLINE));
                    //agregar descripcion al documento
                    documento.add(par2);//agregar todas las propiedades de la descripcin
                    //crear una tabla
                    PdfPTable tabla = new PdfPTable(5);//( Numero de columnas de la tabla)
                    //columnas de la tabla, cabezera y agg un estilo
                    PdfPCell celda = new PdfPCell(
                            new Paragraph("Nmero", FontFactory.getFont("Roboto", 14, Font.BOLD)));
                    PdfPCell celda1 = new PdfPCell(
                            new Paragraph("Nombre", FontFactory.getFont("Roboto", 14, Font.BOLD)));
                    celda1.setColspan(3);
                    PdfPCell celda2 = new PdfPCell(
                            new Paragraph("Votos", FontFactory.getFont("Roboto", 14, Font.BOLD)));
                    //Color de fondo
                    celda.setBackgroundColor(new BaseColor(252, 115, 35));
                    celda1.setBackgroundColor(new BaseColor(252, 115, 35));
                    celda2.setBackgroundColor(new BaseColor(252, 115, 35));
                    //Centrar
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda2.setHorizontalAlignment(Element.ALIGN_CENTER);
                    //padding
                    celda.setPadding(8.0f);
                    celda1.setPadding(8.0f);
                    celda2.setPadding(8.0f);
                    //agg columna ala tabla
                    tabla.addCell(celda);
                    tabla.addCell(celda1);
                    tabla.addCell(celda2);

                    for (int i = 0; i < lista.size(); i++) {
                        List l = lista.get(i);
                        //Convertir el entero a string
                        String num = String.valueOf(l.get(0));
                        String nom = String.valueOf(l.get(1));
                        String tot = String.valueOf(l.get(2));
                        //Agregar valores a las celdas
                        PdfPCell c = new PdfPCell(
                                new Paragraph(num, FontFactory.getFont("Roboto", 12, Font.BOLD)));
                        PdfPCell c1 = new PdfPCell(
                                new Paragraph(nom, FontFactory.getFont("Roboto", 12, Font.BOLD)));
                        c1.setColspan(3);
                        PdfPCell c2 = new PdfPCell(
                                new Paragraph(tot, FontFactory.getFont("Roboto", 12, Font.BOLD)));
                        //Padding para las celdas
                        c.setPadding(4.0f);
                        c1.setPadding(4.0f);
                        c2.setPadding(4.0f);
                        //Centrar contenido de celda
                        c.setHorizontalAlignment(Element.ALIGN_CENTER);
                        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
                        //mostrar los resultados de cada columna los agrega a la tabla
                        tabla.addCell(c);
                        tabla.addCell(c1);
                        tabla.addCell(c2);

                    }
                    PdfPCell c1 = new PdfPCell(new Paragraph("Total Votos: ", fondescripcion));
                    c1.setColspan(4);
                    PdfPCell c2 = new PdfPCell(new Paragraph("" + to, fondescripcion));

                    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
                    c2.setHorizontalAlignment(Element.ALIGN_CENTER);

                    c1.setPadding(4.0f);
                    c2.setPadding(4.0f);

                    tabla.addCell(c1);
                    tabla.addCell(c2);

                    //Agrega la tabla a el documento
                    documento.add(tabla);
                    //agregar fecha
                    Font fonfecha = new Font(Font.getFamily("Roboto"), 12, Font.NORMAL, BaseColor.LIGHT_GRAY);

                    par4.add(new Phrase("Expedido por HuellVot", fonfecha));
                    DateFormat formato = DateFormat.getDateInstance(DateFormat.FULL);
                    par4.add(new Paragraph(formato.format(new Date())));

                    documento.add(par4);

                    //cerrar el documento
                    documento.close();
                } catch (DocumentException | IOException e) {
                    e.getMessage();
                    System.out.println("Error al generar el reporte PDF" + e);
                }

            } else {
                try {
                    Document documento = new Document();
                    PdfWriter.getInstance(documento, out);// salida del cocumento en pdf
                    //abrir documento
                    documento.open();
                    System.out.println("no hat datos");
                    //agregar una imagen logo sena al pdf
                    Image imagenes = Image.getInstance(
                            "C:\\Users\\pc\\Desktop\\PrjHuellVotWeb\\web\\Multimedia\\reportes.png");
                    //Centrar la imagen
                    imagenes.setAlignment(Element.ALIGN_CENTER);
                    //tamao de la imagen
                    imagenes.scaleToFit(530, 520);
                    //agg imagen al documento F:\\Documentos\\yo\\huellvot 2 17-06-2016\\PrjHuellVotWeb\\web\\iCO.png
                    //documento.add(imghuellvot);
                    documento.add(imagenes);
                    Paragraph par1 = new Paragraph();
                    Paragraph par2 = new Paragraph();
                    //Agg salto de linea
                    par1.add(new Phrase(Chunk.NEWLINE));
                    par1.add(new Phrase(Chunk.NEWLINE));

                    //fuente del pdf, tipo de fuente famimilia tamao de letra
                    //Importar ttf que contiene el tipo de letra
                    FontFactory.register(
                            "C:\\Users\\pc\\Desktop\\PrjHuellVotWeb\\web\\fonts\\roboto\\Roboto-Bold.ttf",
                            "Roboto");
                    //Font fondescripcion = FontFactory.getFont("Roboto");
                    Font fondescripcion = new Font(Font.getFamily("Roboto"), 16, Font.NORMAL, BaseColor.BLACK);
                    //texto de la descripcion
                    par1.add(new Phrase("lo sentimos pero no hay datos para mostrar.!", fondescripcion));
                    //justificar descripcion
                    par1.setAlignment(Element.ALIGN_CENTER);
                    //Agg salto de linea
                    par1.add(new Phrase(Chunk.NEWLINE));
                    par1.add(new Phrase(Chunk.NEWLINE));
                    //agregar descripcion al documento
                    documento.add(par1);//agregar todas las propiedades de la descripcin
                    //agregar fecha
                    Font fonfecha = new Font(Font.getFamily("Roboto"), 12, Font.NORMAL, BaseColor.LIGHT_GRAY);

                    par2.add(new Phrase("Expedido por HuellVot", fonfecha));
                    DateFormat formato = DateFormat.getDateInstance(DateFormat.FULL);
                    par2.add(new Paragraph(formato.format(new Date())));
                    documento.add(par2);
                    //cerrar el documento
                    documento.close();
                } catch (DocumentException ex) {
                    ex.getMessage();
                    System.out.println("Error al generar el reporte PDF sin datos registrados" + ex);
                }

            }

        } finally {
            out.close();
        }
    } else {
        sessionOk.invalidate();
        response.sendRedirect("index.jsp");
    }
}

From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java

License:Open Source License

private static Document ESingnature(Document document, PdfWriter writer, AddressBook addressbook) {
    // TODO Auto-generated method stub
    log.log(Level.INFO, "ApplicationFormPDFMaintenance --> ESingnature ");
    try {/*from w  w  w .  j av  a  2  s  .  com*/

        document.newPage();

        PdfPTable table = new PdfPTable(2);
        table.setSpacingBefore(10);
        table.setWidthPercentage(100f);

        PdfPCell c1 = new PdfPCell(new Phrase("E-singnature "));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        c1.setColspan(4);
        c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP);
        c1.setFixedHeight(30f);
        c1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        c1.setBorder(Rectangle.BOX);
        c1.setFixedHeight(25f);
        table.addCell(c1);
        table.setHeaderRows(1);

        for (int i = 0; i < 2; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }

        Iterator itr = null;
        CandidateESignature esignature = new CandidateESignature();
        if (addressbook.getCandidateESignatures().size() > 0) {
            itr = addressbook.getCandidateESignatures().iterator();
            esignature = (CandidateESignature) itr.next();
        }

        c1 = new PdfPCell(new Phrase("Branch : " + esignature.getBranch(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Servicing Department : " + esignature.getServiceDepartment(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int i = 0; i < 2; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }

        c1 = new PdfPCell(new Phrase("City : " + esignature.getCity(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Agent Code : " + esignature.getAgentId(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int i = 0; i < 4; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }

        document.add(table);

        table = new PdfPTable(2);
        table.setSpacingBefore(10);
        table.setWidthPercentage(100f);
        table.setWidths(new int[] { 80, 20 });

        c1 = new PdfPCell(new Phrase("Presently attached with another insurance Company ?  ", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t  No", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        for (int i = 0; i < 2; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(
                new Phrase("Presently in contact with any other AIA'S servicing Department ?   ", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t  No", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        for (int i = 0; i < 2; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(
                new Phrase("Taken LOMBRA occupational test or PSP test in the past ?  If Yes, ", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Yes \t\t\t\t\t\t\t\t  No", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        for (int i = 0; i < 2; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Please provide the result.  ", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        for (int i = 0; i < 5; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }
        document.add(table);

        Paragraph para1 = new Paragraph();
        para1.add(new Chunk("Applicant's Declaration ", font));
        para1.setAlignment(Element.ALIGN_LEFT);
        para1.setSpacingAfter(5f);
        document.add(para1);

        table = new PdfPTable(2);
        table.setSpacingBefore(10);
        table.setWidthPercentage(100f);

        for (int i = 0; i < 4; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }

        c1 = new PdfPCell(new Phrase("Application Date", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Applicant/Candidate Name  :", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        if (esignature.getApplicationDate() != null) {
            c1 = new PdfPCell(new Phrase(format.format(esignature.getApplicationDate()), font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        } else {
            c1 = new PdfPCell(new Phrase("", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }

        c1 = new PdfPCell(new Phrase(esignature.getCandidateName(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        for (int i = 0; i < 4; i++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);
        }
        document.add(table);

        para1 = new Paragraph();
        para1.add(new Chunk("E-Signature  : ", font));
        para1.setAlignment(Element.ALIGN_LEFT);
        para1.setSpacingAfter(5f);
        document.add(para1);

        c1 = new PdfPCell(new Phrase(" ", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        if (esignature.geteSignaturePhoto() != null) {
            Image image = Image.getInstance(esignature.geteSignaturePhoto());
            para1 = new Paragraph();
            para1.add(image);
            para1.setAlignment(Element.ALIGN_LEFT);
            para1.setSpacingAfter(5f);
            document.add(para1);
        } else {
            para1 = new Paragraph();
            para1.add("");
            para1.setAlignment(Element.ALIGN_LEFT);
            para1.setSpacingAfter(5f);
            document.add(para1);
        }

    } catch (Exception e) {
        // TODO Auto-generated catch block
        log.log(Level.INFO, "ApplicationFormPDFMaintenance --> ESingnature " + e.getMessage());
        e.printStackTrace();
        e.printStackTrace();
        LogsMaintenance logsMain = new LogsMaintenance();
        StringWriter errors = new StringWriter();
        e.printStackTrace(new PrintWriter(errors));
        logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString());
    }

    return document;
}

From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java

License:Open Source License

private static Document personalInformation(Document document, PdfWriter writer, AddressBook addressbook,
        Font normalFontCH) {//from  w w w . j  av a 2  s.  co m
    // TODO Auto-generated method stub
    log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalInformation ");
    try {

        PdfPTable table = new PdfPTable(2);
        table.setSpacingBefore(10);
        table.setWidthPercentage(100f);

        PdfPCell c1 = new PdfPCell(new Phrase("PERSONAL INFORMATION"));
        c1.setHorizontalAlignment(Element.ALIGN_LEFT);
        c1.setColspan(4);
        c1.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP);
        c1.setFixedHeight(30f);
        c1.setBackgroundColor(BaseColor.LIGHT_GRAY);
        c1.setBorder(Rectangle.BOX);
        c1.setFixedHeight(25f);
        table.addCell(c1);
        table.setHeaderRows(1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Candidate's Name: " + addressbook.getName(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("NRIC: " + addressbook.getNric(), font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("??*  ", normalFontCH));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("???(*) ", normalFontCH));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Date of Birth: " + format.format(addressbook.getBirthDate()), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Gender: " + addressbook.getGender(), font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("*", normalFontCH));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("*", normalFontCH));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Age: " + addressbook.getAge(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Place of Birth: " + addressbook.getBirthPlace(), font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("(*)", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Education: " + addressbook.getEducation(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Maritial Status: " + addressbook.getMarritalStatus(), font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("*", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("*", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Annual Income: " + addressbook.getYearlyIncome(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Work Experience:  " + addressbook.getWorkingYearExperience(), font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("*", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("*", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase(
                "Address : " + addressbook.getResidentialAddress1() + " ,"
                        + addressbook.getResidentialAddress2() + " , " + addressbook.getResidentialAddress3(),
                font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase(" ", font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("??*", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase(" ", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Postal Code: " + addressbook.getResidentialPostalCode(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.NO_BORDER);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("Mobile Number: " + addressbook.getMobilePhoneNo(), font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase("??*", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase(" ", normalFontCH));
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        for (int j = 0; j < 2; j++) {
            c1 = new PdfPCell(new Phrase(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            table.addCell(c1);

        }

        c1 = new PdfPCell(new Phrase("Email Address: " + addressbook.geteMailId(), font));
        c1.setBorder(Rectangle.NO_BORDER);
        c1.setLeading(4f, 0f);
        c1.setFixedHeight(15f);
        //c1.setPaddingLeft(30f);
        c1.setBorder(Rectangle.BOTTOM);
        table.addCell(c1);

        c1 = new PdfPCell(new Phrase(" ", font));
        c1.setFixedHeight(15f);
        c1.setBorder(Rectangle.BOTTOM);
        c1.setLeading(4f, 0f);
        table.addCell(c1);

        document.add(table);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalInformation " + e.getMessage());
        e.printStackTrace();
        e.printStackTrace();
        LogsMaintenance logsMain = new LogsMaintenance();
        StringWriter errors = new StringWriter();
        e.printStackTrace(new PrintWriter(errors));
        logsMain.insertLogs("ApplicationFormPDFMaintenance", Level.SEVERE + "", errors.toString());
    }
    return document;
}

From source file:com.quix.aia.cn.imo.mapper.ApplicationFormPDFMaintenance.java

License:Open Source License

private static void addTitle(Document document, PdfWriter writer, String fieldName, String headerText)
        throws Exception, IOException, BadElementException {
    log.log(Level.INFO, "ApplicationFormPDFMaintenance --> addTitle ");
    PdfPTable table = new PdfPTable(2);
    PdfPCell c1 = new PdfPCell(new Phrase(headerText));
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setVerticalAlignment(Element.ALIGN_CENTER);
    //c1.setBackgroundColor(BaseColor.RED);
    c1.setBorder(Rectangle.BOX);//from  w w w .  j  ava  2s.c o  m
    c1.setFixedHeight(25f);
    c1.setColspan(2);
    table.addCell(c1);
    table.setWidthPercentage(100f);

    document.add(table);
}

From source file:com.systemevent.jsfclass.util.FormatoPDF.java

/**
 * Constructor de la clase, inicializa la imagen que se utilizara en el membrete
 */// ww w.j  a v a  2 s  . co m
public FormatoPDF(String nombre) {
    try {
        PdfPCell celda1 = new PdfPCell(new Phrase("Nombre Cliente"));
        PdfPCell celda2 = new PdfPCell(new Phrase(nombre));

        imagen = Image.getInstance(
                "C:\\Users\\Jose_Gascon\\Documents\\ProyectoSystemEvent\\sysevent\\src\\main\\webapp\\resources\\imagenes\\logoconstruccion.jpg");
        imagen.setAbsolutePosition(30, 720f);
        imagen.scaleAbsolute(100, 100);
        celda1.setBorder(Rectangle.BOTTOM);
        celda2.setBorder(Rectangle.BOTTOM);
        celda2.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);

        table.addCell(celda1);
        table.addCell(celda2);

        table.setTotalWidth(350f);

    } catch (Exception r) {
        System.err.println("Error al leer la imagen");
    }
}

From source file:com.thomasmore.service.PdfCreateServiceImpl.java

public void readPdf() {
    try {/*from  ww w.j  av  a2  s  .c  om*/
        OutputStream file = new FileOutputStream(new File("D:\\SamplePDFje.pdf"));

        Document document = new Document();
        PdfWriter.getInstance(document, file);

        document.open();
        document.add(new Paragraph("First iText PDF"));
        document.add(new Paragraph(new Date().toString()));

        document.addAuthor("Krishna Sfsfsfsn");
        document.addCreationDate();
        document.addCreator("JavaBeat");
        document.addTitle("Sample PDF");

        //Create Paragraph
        Paragraph paragraph = new Paragraph("Title 1", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD));

        //New line
        paragraph.add(new Paragraph(" "));
        paragraph.add("Test Paragraph");
        paragraph.add(new Paragraph(" "));
        document.add(paragraph);

        //Create a table in PDF
        PdfPTable pdfTable = new PdfPTable(3);
        PdfPCell cell1 = new PdfPCell(new Phrase("Table Header 1"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfTable.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Table Header 2"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfTable.addCell(cell1);

        cell1 = new PdfPCell(new Phrase("Table Header 3"));
        cell1.setHorizontalAlignment(Element.ALIGN_CENTER);
        pdfTable.addCell(cell1);
        pdfTable.setHeaderRows(1);

        pdfTable.addCell("Row 1 Col 1");
        pdfTable.addCell("Row 1 Col 2");
        pdfTable.addCell("Row 1 Col 3");

        pdfTable.addCell("Row 2 Col 1");
        pdfTable.addCell("Row 2 Col 2");
        pdfTable.addCell("Row 2 Col 3");

        document.add(pdfTable);

        document.close();
        file.close();

    } catch (Exception e) {

        e.printStackTrace();
    }
}

From source file:com.tomasz.drag.triballocommanderro.controller.MakerPDF.java

public static void printToPDFBoss(ArrayList<Person> workers, EventGig event)
        throws IOException, DocumentException {
    String filename = event.getName() + " Boss" + ".pdf";
    String path = event.getData() + " " + event.getName() + "//";
    //Rectangle rect = new Rectangle(0, 595, 8, 0);
    Document document = new Document(PageSize.A4.rotate(), 0, 0, 0, 0);
    //Document document = new Document(rect);
    //document.setMargins(0, 0, 0, 0);
    BaseFont bf;// www .ja  v  a2s.  co  m
    //BaseFont bf2;
    // bf = BaseFont.createFont("arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    bf = BaseFont.createFont("src\\main\\resources\\font\\arialuni.ttf", BaseFont.IDENTITY_H,
            BaseFont.EMBEDDED);
    //bf2 = BaseFont.createFont("src\\main\\resources\\font\\arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
    com.itextpdf.text.Font ft = new com.itextpdf.text.Font(bf, 9);
    //com.itextpdf.text.Font ft2 = new com.itextpdf.text.Font(bf2,9);

    PdfWriter.getInstance(document, new FileOutputStream(path + filename));

    document.open();
    Paragraph p = new Paragraph(event.getName() + " " + event.getData(), ft);
    p.setAlignment(Element.ALIGN_CENTER);
    document.add(p);
    document.add(new Paragraph(" "));
    PdfPTable table = new PdfPTable(workers.size() + 1);
    table.setWidthPercentage(98);
    PdfPCell cell = new PdfPCell(new Phrase("    "));
    table.addCell(cell);
    for (Person tempPerson : workers) {
        cell = new PdfPCell(new Paragraph(tempPerson.getName(), ft));
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(cell);

    }
    if (event.isZaladunekScenaDach()) {
        cell = new PdfPCell(new Paragraph("Za. Sc./Dach", ft));
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);

        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getZaladunekScenaDachWyplata() > 0) {
                cell = new PdfPCell(
                        new Paragraph(String.format("%.2f", tempPerson.getZaladunekScenaDachWyplata()), ft));
                cell.setVerticalAlignment(Element.ALIGN_CENTER);
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }
    if (event.isZaladunekTechniki()) {
        cell = new PdfPCell(new Phrase("Za. Tech.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getZaladunekTechnikiWyplata() > 0) {
                cell = new PdfPCell(
                        new Paragraph(String.format("%.2f", tempPerson.getZaladunekTechnikiWyplata()), ft));
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isRozladunekScenaDach()) {
        cell = new PdfPCell(new Phrase("Roz Sc/Dach", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getRozladunekScenaDachWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getRozladunekScenaDachWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }
    if (event.isRozladunekTechniki()) {
        cell = new PdfPCell(new Phrase("Roz. Tech.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getRozladunekTechnikiWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getRozladunekTechnikiWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isMontazDachu()) {
        cell = new PdfPCell(new Phrase("Mon. Dach", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getMontazDachuWyplata() > 0) {
                cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getMontazDachuWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isMontazDzwieku()) {
        cell = new PdfPCell(new Phrase("Mon. Dw.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getMontazDzwiekuWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getMontazDzwiekuWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isMontazSceny()) {
        cell = new PdfPCell(new Phrase("Mon. Sc.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getMontazScenyWyplata() > 0) {
                cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getMontazScenyWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isMontazSwiatla()) {
        cell = new PdfPCell(new Phrase("Mon. w.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getMontazSwiatlaWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getMontazSwiatlaWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isMontazTechniki()) {
        cell = new PdfPCell(new Phrase("Mon. Tech.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getMontazTechnikiWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getMontazTechnikiWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isDemontazDachu()) {
        cell = new PdfPCell(new Phrase("Dem. Dach", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getDemontazDachuWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getDemontazDachuWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isDemontazDzwieku()) {
        cell = new PdfPCell(new Phrase("Dem. Dw.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getDemontazDzwiekuWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getDemontazDzwiekuWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isDemontazSceny()) {
        cell = new PdfPCell(new Phrase("Dem. Sc.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getDemontazScenyWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getDemontazScenyWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isDemontazSwiatla()) {
        cell = new PdfPCell(new Phrase("Dem. w.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getDemontazSwiatlaWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getDemontazSwiatlaWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase("   "));
                table.addCell(cell);
            }
        }
    }

    if (event.isDemontazTechniki()) {
        cell = new PdfPCell(new Phrase("Dem. Tech.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getDemontazTechnikiWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getDemontazTechnikiWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isDyzur()) {
        cell = new PdfPCell(new Phrase("Dyur", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getDyzurWyplata() > 0) {
                cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getDyzurWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(""));
                table.addCell(cell);
            }
        }
    }

    if (event.isTechnikSceny()) {
        cell = new PdfPCell(new Phrase("Technik Sc.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getTechnikScenyWyplata() > 0) {
                cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getTechnikScenyWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isRealizacjaFOH()) {
        cell = new PdfPCell(new Phrase("Real. FOH", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getRealizacjaFOHWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getRealizacjaFOHWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isRealizacjaMON()) {
        cell = new PdfPCell(new Phrase("Real. MON", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getRealizacjaMONWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getRealizacjaMONWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (event.isRealizacjaSwiatla()) {
        cell = new PdfPCell(new Phrase("Real. w.", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getRealizacjaSwiatlaWyplata() > 0) {
                cell = new PdfPCell(
                        new Phrase(String.format("%.2f", tempPerson.getRealizacjaSwiatlaWyplata()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    if (true) {
        cell = new PdfPCell(new Phrase("Premia", ft));
        table.addCell(cell);
        for (Person tempPerson : workers) {
            if (tempPerson.getPremia() > 0) {
                cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getPremia()), ft));
                table.addCell(cell);
            } else {
                cell = new PdfPCell(new Phrase(" "));
                table.addCell(cell);
            }
        }
    }

    Paragraph ph = new Paragraph("Razem", ft);

    //cell = new PdfPCell(new Phrase(ph));
    cell.addElement(ph);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);
    for (Person tempPerson : workers) {
        if (tempPerson.getSumaWyplata() >= 0) {
            cell = new PdfPCell(new Phrase(String.format("%.2f", tempPerson.getSumaWyplata()) + " z", ft));
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            table.addCell(cell);
        } else {
            cell = new PdfPCell(new Phrase(" "));
            table.addCell(cell);
        }
    }
    //        for (Object obj : table.getChunks()) {
    //            if (obj instanceof PdfPCell) {
    //                System.out.println("jest PdfCell");
    //                PdfPCell tempCell = (PdfPCell) obj;
    //                tempCell.setVerticalAlignment(Element.ALIGN_CENTER);
    //                //tempCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    //            }
    //            
    //        }
    table.setHorizontalAlignment(Element.ALIGN_CENTER);
    document.add(table);
    document.close();

}