Example usage for com.itextpdf.text Rectangle TOP

List of usage examples for com.itextpdf.text Rectangle TOP

Introduction

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

Prototype

int TOP

To view the source code for com.itextpdf.text Rectangle TOP.

Click Source Link

Document

This represents one side of the border of the Rectangle.

Usage

From source file:be.rheynaerde.poolsheets.AbstractPoolSheet.java

License:Open Source License

protected void buildTitle(Document document) throws DocumentException {
    //the title is placed in a one-column table of width 100%
    PdfPTable table = new PdfPTable(1);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setWidthPercentage(100f);//  www  .ja v a 2 s. c om

    //one row for the title
    PdfPCell cell = new PdfPCell(new Phrase(configuration.getTitle(), configuration.getTitleFont()));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setPaddingBottom(10f);
    table.addCell(cell);

    //one row for the subtitle
    cell = new PdfPCell(new Phrase(configuration.getSubtitle(), configuration.getSubtitleFont()));
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setBorder(Rectangle.TOP);
    table.addCell(cell);

    //make sure that there is some spacing between the title and the scores
    //20f just seems to work allright, but maybe something more configurable
    //would be better.
    table.setSpacingAfter(20f);
    document.add(table);
}

From source file:com.asae.controllers.BeanGestionRutinas.java

public void generarPdf() {
    Document document = new Document();
    try {// w ww  .  ja v a2  s  . c o  m
        File file = File.createTempFile("rutina-", ".pdf", new File("/var/webapp/pdf"));
        pdfFileName = file.getName();

        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();
        Font bold = new Font(Font.FontFamily.HELVETICA, 12f, Font.BOLD);
        URL url = FacesContext.getCurrentInstance().getExternalContext()
                .getResource("/resources/img/logo-unicauca-negro.png");
        Image imgLogoUnicauca = Image.getInstance(url);
        imgLogoUnicauca.scaleAbsolute(118f, 131f);

        PdfPTable tableEncabezado = new PdfPTable(2);
        tableEncabezado.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        tableEncabezado.setWidthPercentage(100);
        tableEncabezado.setSpacingAfter(5);
        PdfPCell cell1 = new PdfPCell(imgLogoUnicauca);
        cell1.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell2 = new PdfPCell(new Paragraph("Vicerrectoria Administrativa"));
        cell2.setBorder(Rectangle.NO_BORDER);
        cell2.setVerticalAlignment(Element.ALIGN_BOTTOM);
        cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        PdfPCell cell3 = new PdfPCell(new Paragraph("Universidad del Cauca", bold));
        cell3.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell4 = new PdfPCell(new Paragraph("Gimnasio y Actividad Fsica", bold));
        cell4.setBorder(Rectangle.NO_BORDER);
        cell4.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tableEncabezado.addCell(cell1);
        tableEncabezado.addCell(cell2);
        tableEncabezado.addCell(cell3);
        tableEncabezado.addCell(cell4);

        PdfPTable tableDatosUsuario = new PdfPTable(3);
        tableDatosUsuario.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        tableDatosUsuario.setWidthPercentage(100);
        tableDatosUsuario.setSpacingBefore(20);
        PdfPCell cell5 = new PdfPCell(new Paragraph("Nombre: " + rutinaVisualizar.getIdusuario().getFisrtname()
                + " " + rutinaVisualizar.getIdusuario().getSecondname() + " "
                + rutinaVisualizar.getIdusuario().getFirstlastname() + " "
                + rutinaVisualizar.getIdusuario().getSecondlastname()));
        cell5.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell6 = new PdfPCell();
        cell6.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell7 = new PdfPCell();
        cell7.setBorder(Rectangle.NO_BORDER);

        tableDatosUsuario.addCell(cell5);
        tableDatosUsuario.addCell(cell6);
        tableDatosUsuario.addCell(cell7);

        PdfPTable tableFechas = new PdfPTable(3);
        tableFechas.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        tableFechas.setWidthPercentage(100);
        tableFechas.setSpacingBefore(10);
        PdfPCell cell8 = new PdfPCell(
                new Paragraph("Fecha de inicio: " + getMyFormattedDate(rutinaVisualizar.getFechaInicio())));
        cell8.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell9 = new PdfPCell(
                new Paragraph("Fecha de fin: " + getMyFormattedDate(rutinaVisualizar.getFechaFin())));
        cell9.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell10 = new PdfPCell();
        cell10.setBorder(Rectangle.NO_BORDER);

        tableFechas.addCell(cell8);
        tableFechas.addCell(cell9);
        tableFechas.addCell(cell10);

        PdfPTable tableMedidas = new PdfPTable(4);
        tableMedidas.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        tableMedidas.setWidthPercentage(100);
        tableMedidas.setSpacingBefore(10);

        Usuario usuAux = rutinaVisualizar.getIdusuario();
        List<Evaluacion> lstEvalAux = usuAux.getEvaluacionList();
        Evaluacion evalAux;
        double peso = 0;
        if (lstEvalAux.size() > 0) {
            evalAux = lstEvalAux.get(lstEvalAux.size() - 1);
            peso = evalAux.getPeso().doubleValue();
        }

        double estatura = 0;
        MedidasGenerales medGenAux = usuAux.getMedidasGenerales();
        if (medGenAux != null) {
            estatura = medGenAux.getEstatura().doubleValue();
        }

        PdfPCell cell11 = new PdfPCell(new Paragraph("Peso: " + peso));
        cell11.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell12 = new PdfPCell(new Paragraph("Talla: " + estatura));
        cell12.setBorder(Rectangle.NO_BORDER);

        double imc = 0;
        if (peso != 0 && estatura != 0) {
            imc = peso / Math.pow(estatura, 2);
        }

        PdfPCell cell13 = new PdfPCell(new Paragraph("I.M.C: " + imc));
        cell13.setBorder(Rectangle.NO_BORDER);
        PdfPCell cell14 = new PdfPCell(new Paragraph("Rutina: " + rutinaVisualizar.getCodigoRutina()));
        cell14.setBorder(Rectangle.NO_BORDER);

        tableMedidas.addCell(cell11);
        tableMedidas.addCell(cell12);
        tableMedidas.addCell(cell13);
        tableMedidas.addCell(cell14);

        PdfPTable tableDias = new PdfPTable(2);
        tableDias.getDefaultCell().setBorder(Rectangle.NO_BORDER);
        tableDias.setWidthPercentage(100);
        tableDias.setSpacingBefore(20);
        tableDias.setHorizontalAlignment(Element.ALIGN_LEFT);
        tableDias.setWidths(new int[] { 1, 9 });

        List<Dia> lstDiasPDF = rutinaVisualizar.getDiaList();

        PdfPCell cellCabezeraDia = new PdfPCell(new Paragraph("Da", bold));
        PdfPCell cellCabezeraDia2 = new PdfPCell();
        cellCabezeraDia2.setBorder(Rectangle.NO_BORDER);

        tableDias.addCell(cellCabezeraDia);
        tableDias.addCell(cellCabezeraDia2);

        for (Dia dia : lstDiasPDF) {
            PdfPCell cellDia = new PdfPCell(new Paragraph(dia.getNumDia().toString()));
            PdfPCell cellDia2 = new PdfPCell();
            cellDia2.setBorder(Rectangle.NO_BORDER);

            List<GrupoMuscular> lstGMuscularPDF = dia.getGrupoMuscularList();

            if (lstGMuscularPDF.size() > 0) {
                PdfPTable tableGMuscular = new PdfPTable(2);
                tableGMuscular.getDefaultCell().setBorder(Rectangle.NO_BORDER);
                tableGMuscular.setWidthPercentage(100);
                tableGMuscular.setHorizontalAlignment(Element.ALIGN_LEFT);
                tableGMuscular.setWidths(new int[] { 1, 6 });

                PdfPCell cellCabezeraGMuscular = new PdfPCell(new Paragraph("Grupo Muscular", bold));
                cellCabezeraGMuscular.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP);
                PdfPCell cellCabezeraGMuscular2 = new PdfPCell();
                cellCabezeraGMuscular2.setBorder(Rectangle.NO_BORDER);
                tableGMuscular.addCell(cellCabezeraGMuscular);
                tableGMuscular.addCell(cellCabezeraGMuscular2);

                int aux = 1;
                for (GrupoMuscular gMuscularFor : lstGMuscularPDF) {
                    PdfPCell cellGMuscular = new PdfPCell(
                            new Paragraph(gMuscularFor.getIdgrupoMuscularGeneral().getNombre()));
                    cellGMuscular.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);
                    PdfPCell cellGMuscular2 = new PdfPCell();
                    cellGMuscular2.setBorder(Rectangle.NO_BORDER);

                    List<EjercicioGm> lstEjerciciosGMuscularPDF = gMuscularFor.getEjercicioGmList();
                    BaseColor myColor = WebColors.getRGBColor("#CCEEFF");
                    if (lstEjerciciosGMuscularPDF.size() > 0) {
                        PdfPTable tableEjercicioGMsucular = new PdfPTable(5);
                        tableEjercicioGMsucular.getDefaultCell().setBorder(Rectangle.NO_BORDER);
                        tableEjercicioGMsucular.setWidthPercentage(100);
                        tableEjercicioGMsucular.setHorizontalAlignment(Element.ALIGN_LEFT);

                        PdfPCell cellCabezeraEjercicioGM = new PdfPCell(new Paragraph("Ejercicio", bold));
                        cellCabezeraEjercicioGM.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP);
                        cellCabezeraEjercicioGM.setLeading(20f, 0f);
                        cellCabezeraEjercicioGM.setBackgroundColor(myColor);
                        tableEjercicioGMsucular.addCell(cellCabezeraEjercicioGM);

                        PdfPCell cellCabezeraEjercicioGM2 = new PdfPCell(new Paragraph("Series", bold));
                        cellCabezeraEjercicioGM2.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP);
                        cellCabezeraEjercicioGM2.setLeading(20f, 0f);
                        cellCabezeraEjercicioGM2.setBackgroundColor(myColor);
                        tableEjercicioGMsucular.addCell(cellCabezeraEjercicioGM2);

                        PdfPCell cellCabezeraEjercicioGM3 = new PdfPCell(new Paragraph("Repeticiones", bold));
                        cellCabezeraEjercicioGM3.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP);
                        cellCabezeraEjercicioGM3.setLeading(20f, 0f);
                        cellCabezeraEjercicioGM3.setBackgroundColor(myColor);
                        tableEjercicioGMsucular.addCell(cellCabezeraEjercicioGM3);

                        PdfPCell cellCabezeraEjercicioGM4 = new PdfPCell(new Paragraph("Receso", bold));
                        cellCabezeraEjercicioGM4.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP);
                        cellCabezeraEjercicioGM4.setLeading(20f, 0f);
                        cellCabezeraEjercicioGM4.setBackgroundColor(myColor);
                        tableEjercicioGMsucular.addCell(cellCabezeraEjercicioGM4);

                        PdfPCell cellCabezeraEjercicioGM5 = new PdfPCell(new Paragraph("Peso", bold));
                        cellCabezeraEjercicioGM5.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP);
                        cellCabezeraEjercicioGM5.setLeading(20f, 0f);
                        cellCabezeraEjercicioGM5.setBackgroundColor(myColor);
                        tableEjercicioGMsucular.addCell(cellCabezeraEjercicioGM5);

                        int aux2 = 1;
                        for (EjercicioGm ejercicioGm : lstEjerciciosGMuscularPDF) {
                            PdfPCell cellEjercicioGM = new PdfPCell(
                                    new Paragraph(ejercicioGm.getEjercicio().getNombre()));
                            cellEjercicioGM.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);
                            cellEjercicioGM.setLeading(20f, 0f);

                            PdfPCell cellEjercicioGM2 = new PdfPCell(
                                    new Paragraph(ejercicioGm.getNumeroSeries().toString()));
                            cellEjercicioGM2.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);
                            cellEjercicioGM2.setLeading(20f, 0f);

                            PdfPCell cellEjercicioGM3 = new PdfPCell(
                                    new Paragraph(ejercicioGm.getRepeticiones().toString()));
                            cellEjercicioGM3.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);
                            cellEjercicioGM3.setLeading(20f, 0f);

                            PdfPCell cellEjercicioGM4 = new PdfPCell(
                                    new Paragraph(ejercicioGm.getReceso().toString()));
                            cellEjercicioGM4.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);
                            cellEjercicioGM4.setLeading(20f, 0f);

                            PdfPCell cellEjercicioGM5 = new PdfPCell(
                                    new Paragraph(ejercicioGm.getPeso().toString()));
                            cellEjercicioGM5.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT);
                            cellEjercicioGM5.setLeading(20f, 0f);

                            if (aux2 % 2 == 0) {
                                cellEjercicioGM.setBackgroundColor(myColor);
                                cellEjercicioGM2.setBackgroundColor(myColor);
                                cellEjercicioGM3.setBackgroundColor(myColor);
                                cellEjercicioGM4.setBackgroundColor(myColor);
                                cellEjercicioGM5.setBackgroundColor(myColor);
                            }

                            tableEjercicioGMsucular.addCell(cellEjercicioGM);
                            tableEjercicioGMsucular.addCell(cellEjercicioGM2);
                            tableEjercicioGMsucular.addCell(cellEjercicioGM3);
                            tableEjercicioGMsucular.addCell(cellEjercicioGM4);
                            tableEjercicioGMsucular.addCell(cellEjercicioGM5);
                            aux2++;
                        }
                        cellGMuscular2.addElement(tableEjercicioGMsucular);
                    }
                    tableGMuscular.addCell(cellGMuscular);
                    tableGMuscular.addCell(cellGMuscular2);
                    aux++;
                }
                cellDia2.addElement(tableGMuscular);
            }
            tableDias.addCell(cellDia);
            tableDias.addCell(cellDia2);
        }

        LineSeparator ls = new LineSeparator();
        document.add(tableEncabezado);
        document.add(ls);
        document.add(tableDatosUsuario);
        document.add(tableFechas);
        document.add(tableMedidas);
        document.add(tableDias);
        document.close();
    } catch (DocumentException | FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException ex) {
        Logger.getLogger(BeanGestionRutinas.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.athena.chameleon.engine.core.PDFCommonEventHelper.java

License:Apache License

/**
 * header ? footer  /*from  w w w  .  j  a  v a  2s  .c  o m*/
 */
public void onEndPage(PdfWriter writer, Document document) {

    if (titleFlag)
        return;

    Font font = new Font(bfKorean, 9);
    PdfPTable hTable = new PdfPTable(1);
    PdfPTable ftable = new PdfPTable(3);
    try {

        hTable.setWidths(new int[] { 100 });
        hTable.setTotalWidth(500);
        hTable.setLockedWidth(true);
        hTable.getDefaultCell().setFixedHeight(15);
        hTable.getDefaultCell().setBorder(Rectangle.BOTTOM);
        hTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        hTable.addCell(new Phrase(MessageUtil.getMessage("pdf.message.header.title"), font));
        hTable.writeSelectedRows(0, -1, 50, 803, writer.getDirectContent());

        ftable.setWidths(new int[] { 100, 100, 100 });
        ftable.setTotalWidth(500);
        ftable.setLockedWidth(true);
        ftable.getDefaultCell().setBorder(Rectangle.TOP);
        ftable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
        ftable.addCell(new Phrase(MessageUtil.getMessage("pdf.message.footer.left"), font));
        ftable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        if (pagingFlag)
            ftable.addCell(new Phrase(
                    MessageUtil.getMessage("pdf.message.footer.center", String.valueOf(writer.getPageNumber())),
                    font));
        else
            ftable.addCell("");

        ftable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        ftable.addCell(new Phrase(String.valueOf(new SimpleDateFormat("yyyy/MM/dd").format(new Date())), font));
        ftable.writeSelectedRows(0, -1, 50, 55, writer.getDirectContent());
    } catch (Exception de) {
        throw new ExceptionConverter(de);
    }
}

From source file:com.chaschev.itext.CellBuilder.java

License:Apache License

public CellBuilder topLine(float height, BaseColor color) {
    return this.setBorder(Rectangle.TOP).setBorderColorTop(color).setBorderWidthTop(0.2f).setPaddingTop(height);
}

From source file:com.cib.statementstamper.windows.StatementStamperMainWindow.java

License:Open Source License

protected PdfPTable getFooterTable(int x, int y) {
    PdfPTable table = new PdfPTable(1);
    table.setTotalWidth(537);/*from   w ww .j a v a2  s. c o  m*/
    table.setLockedWidth(true);
    table.getDefaultCell().setFixedHeight(40);
    table.getDefaultCell().setBorder(Rectangle.TOP);
    table.getDefaultCell().setBorderColor(new BaseColor(221, 72, 20));
    table.getDefaultCell().setBorderWidth(1);
    table.getDefaultCell().setPaddingLeft(0);
    table.getDefaultCell().setPaddingRight(0);
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    Phrase phrase = new Phrase();
    phrase.add(new Chunk(bottomChunk1, bottomFontBold));
    phrase.add(new Chunk(bottomChunk2, bottomFont));
    table.addCell(phrase);
    return table;
}

From source file:com.hris.payroll.reports.PayslipReportPDF.java

private PdfPTable leftColumnTable(PayrollRegister pr, Date payrollDate) throws DocumentException {
    PdfPTable table = new PdfPTable(3);
    table.setTotalWidth(new float[] { 120, 20, 103 });
    table.setWidthPercentage(100);/*from   w ww .ja v  a2 s  . c  o  m*/
    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.setLockedWidth(true);

    PdfPCell cellTitle = new PdfPCell();
    cellTitle.setColspan(3);
    Paragraph parTitle = new Paragraph();
    parTitle.add(new Phrase("Payslip: ", header));
    parTitle.setAlignment(Element.ALIGN_CENTER);
    cellTitle.addElement(parTitle);
    cellTitle.setBorder(cellBorder);
    table.addCell(cellTitle);

    PdfPCell cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    Paragraph parLabel = new Paragraph();
    parLabel.add(
            new Phrase("Payroll Date: " + CommonUtil.convertDateFormat(getPayrollDate().toString()), content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        PdfPCell cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    //        Paragraph parValue = new Paragraph();
    //        parValue.add(new Phrase(CommonUtil.convertDateFormat(getPayrollDate().toString()), content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    parLabel = new Paragraph();
    parLabel.add(
            new Phrase(
                    "Cut-off Date: " + CommonUtil.changeDateFormat(pr.getAttendancePeriodFrom().toString())
                            + " - " + CommonUtil.changeDateFormat(pr.getAttendancePeriodTo().toString()),
                    content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        PdfPCell cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    //        Paragraph parValue = new Paragraph();
    //        parValue.add(new Phrase(CommonUtil.convertDateFormat(pr.getAttendancePeriodFrom().toString())+" - "+CommonUtil.convertDateFormat(pr.getAttendancePeriodFrom().toString()), content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    parLabel = new Paragraph();
    String middlename;
    if (pr.getMiddlename() == null || pr.getMiddlename().isEmpty()) {
        middlename = " ";
    } else {
        middlename = String.valueOf(pr.getMiddlename().toUpperCase().charAt(0)) + ". ";
    }
    String name = pr.getLastname().toUpperCase() + ", " + pr.getFirstname().toUpperCase() + " " + middlename;
    parLabel.add(new Phrase("Employee Name: " + name, content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        cellValue = new PdfPCell();
    ////        cellValue.setUseAscender(true);
    //        parValue = new Paragraph();
    //        parValue.add(new Phrase(pr.getLastname().toUpperCase()+", "+pr.getFirstname().toUpperCase()+" "+pr.getMiddlename().toUpperCase().charAt(0)+".", employeeName));
    ////        parValue.add(new Phrase("NAME", content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(3);
    parLabel = new Paragraph();
    String position = (ephs.findByEmployee(pr.getEmployeeId()).getPosition() == null) ? "N/A"
            : ephs.findByEmployee(pr.getEmployeeId()).getPosition().toUpperCase();
    parLabel.add(new Phrase("POSITION: " + position, smallerFont));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    //        cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    //        parValue = new Paragraph();
    //        parValue.add(new Phrase(CommonUtil.convertDateFormat(new Date().toString()), content));
    //        parValue.setAlignment(Element.ALIGN_RIGHT);
    //        cellValue.addElement(parValue);     
    //        cellValue.setBorder(cellBorder);
    //        table.addCell(cellValue);

    cellLabel = new PdfPCell();
    //        cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Monthly/Daily Rate: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    PdfPCell cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    Paragraph parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getRate()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Half-month Rate: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getHalfMonthSalary()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Overtime: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getOvertimePay())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Holiday Premium: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double premium = (pr.getLegalHolidayPay() + pr.getSpecialHolidayPay())
            - (pr.getTotalLatesHolidayDeduction() + pr.getTotalUndertimeHolidayDeduction());
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(premium)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Working Day-off: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getWorkingDayOffPay())),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Night Differential: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getNightDifferential())),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Absences/Lates/Undertime: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double alu = pr.getAbsences() + pr.getTotalLatesDeduction() + pr.getTotalUndertimeDeduction();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(alu)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("GROSS PAY: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getGrossPay())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Allowances: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(" ", content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("COLA: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getColaAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Meal Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getMealAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("AFL: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getAllowanceForLiquidation()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Transportation Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    cellLabel.setColspan(2);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getTransportationAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Housing Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getOtherAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Communications Allowance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(pr.getCommunicationAllowance()), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("TOTAL PAY: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double totalPay = pr.getGrossPay() + pr.getCommunicationAllowance() + pr.getTransportationAllowance()
            + pr.getColaAllowance() + pr.getPerDiemAllowance() + pr.getMealAllowance() + pr.getOtherAllowance()
            + pr.getAllowanceForLiquidation();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(totalPay)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("DEDUCTIONS: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(" ", content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("SSS Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getSss())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("PHIC Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getPhic())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("HDMF Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getHdmf())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Withholoding Taxes: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getTax())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("SSS Loan: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "sss loan"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("HDMF Loan: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "hdmf loan"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Additional HDMF Contribution: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(
                    String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(
                            as.findAdvancesTotalAmount(pr.getPayrollId(), "additional HDMF contribution"))),
                    content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("PAG-IBIG 2: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "pag-ibig ii"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Advances to O/E: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(" ", content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Cash Bond: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "cash bond"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Cash Advance: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "cash advance"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Lending: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "lending"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Jewelry: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "jewelry"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Staffhouse: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(
            String.valueOf(CommonUtil
                    .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "staffhouse"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Hotel and Restaurant Charges: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(
                    String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(
                            as.findAdvancesTotalAmount(pr.getPayrollId(), "hotel and restaurant charges"))),
                    content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Cash Shortages: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil
            .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "cash shortages"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Employee Charges: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil
            .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "employee charges"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("ATM Initial Deposit: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil
            .roundOffToTwoDecimalPlaces(as.findAdvancesTotalAmount(pr.getPayrollId(), "atm initial deposit"))),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(allowances);
    parLabel.add(new Phrase("Others__________________: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double otherCharges = as.findAdvancesTotalAmount(pr.getPayrollId(), "advances to o/e")
            + as.findAdvancesTotalAmount(pr.getPayrollId(), "other charges");
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(otherCharges)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("TOTAL DEDUCTIONS:", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double totalDeductions = as.findAdvancesTotalAmount(pr.getPayrollId()) + pr.getTax() + pr.getPhic()
            + pr.getHdmf() + pr.getSss();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(totalDeductions)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    cellLabel.setColspan(2);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("NET PAY:", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    double netPay = CommonUtil.roundOffToTwoDecimalPlaces(totalPay - totalDeductions);
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(netPay)), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Adjustments:", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(
            new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(pr.getAdjustments())), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    //        parLabel.add(new Phrase("_____________________________", content));
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    //        parValue.add(new Phrase(String.valueOf(totalPay - totalDeductions), content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("TOTAL AMOUNT TO BE RECEIVED:", smallFont));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase(String.valueOf(CommonUtil.roundOffToTwoDecimalPlaces(netPay + pr.getAdjustments())),
            content));
    parValue.setAlignment(Element.ALIGN_RIGHT);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    //        cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase("Prepared By: ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    //        cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    //        cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase("Conforme: ", content));
    parValue.setAlignment(Element.ALIGN_LEFT);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    /***************************************************************************/
    int userId = ubas.findUserByBranch(getBranchId());
    String employeeId = us.findEmployeeIdByUserId(userId);
    Employee e = es.findEmployeeById(employeeId);

    String payrollClerkMiddlename;
    if (e.getMiddlename() == null || e.getMiddlename().isEmpty()) {
        payrollClerkMiddlename = " ";
    } else {
        payrollClerkMiddlename = String.valueOf(e.getMiddlename().toUpperCase().charAt(0)) + ". ";
    }
    String payrollClerk = e.getFirstname().toUpperCase() + " " + payrollClerkMiddlename
            + e.getLastname().toUpperCase();

    String employeeMiddlename;
    if (pr.getMiddlename() == null || pr.getMiddlename().isEmpty()) {
        employeeMiddlename = " ";
    } else {
        employeeMiddlename = String.valueOf(pr.getMiddlename().toUpperCase().charAt(0)) + ". ";
    }
    String employee = pr.getFirstname().toUpperCase() + " " + employeeMiddlename
            + pr.getLastname().toUpperCase();

    cellLabel = new PdfPCell();
    cellLabel.setPaddingTop(30);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(payrollClerk, smallerFont));
    parLabel.setAlignment(Element.ALIGN_CENTER);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(Rectangle.BOTTOM);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    cellLabel.setPaddingTop(30);
    parLabel = new Paragraph();
    parLabel.add(new Phrase(" ", content));
    parLabel.setAlignment(Element.ALIGN_CENTER);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setPaddingTop(30);
    parValue = new Paragraph();
    parValue.add(new Phrase(employee, smallerFont));
    parValue.setAlignment(Element.ALIGN_CENTER);
    cellValue.addElement(parValue);
    cellValue.setBorder(Rectangle.BOTTOM);
    table.addCell(cellValue);

    /***************************************************************************/
    cellLabel = new PdfPCell();
    cellLabel.setUseAscender(true);
    parLabel = new Paragraph();
    //        parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("Payroll Clerk", content));
    parLabel.setAlignment(Element.ALIGN_CENTER);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellLabel = new PdfPCell();
    parLabel = new Paragraph();
    //        parLabel.setIndentationLeft(halfMonthRate);
    parLabel.add(new Phrase("", content));
    parLabel.setAlignment(Element.ALIGN_LEFT);
    cellLabel.addElement(parLabel);
    cellLabel.setBorder(cellBorder);
    table.addCell(cellLabel);

    cellValue = new PdfPCell();
    cellValue.setUseAscender(true);
    parValue = new Paragraph();
    parValue.add(new Phrase("Employee", content));
    parValue.setAlignment(Element.ALIGN_CENTER);
    cellValue.addElement(parValue);
    cellValue.setBorder(cellBorder);
    table.addCell(cellValue);

    return table;
}

From source file:com.maxl.java.amikodesk.SaveBasket.java

License:Open Source License

public PdfPTable getShoppingBasketForAuthor(Author a, PdfContentByte cb) {
    int position = 0;
    float subtotal_CHF = 0.0f;
    float shipping_CHF = 0.0f;
    float vat25_CHF = 0.0f;
    float vat80_CHF = 0.0f;

    String author = a.getShortName();

    BarcodeEAN codeEAN = new BarcodeEAN();

    // Pos | Menge | Eancode | Bezeichnung | MwSt | Preis
    PdfPTable table = new PdfPTable(new float[] { 1, 2, 3, 6, 1, 2 });
    table.setWidthPercentage(100f);//from ww  w.  j  a  va 2s .  c  om
    table.getDefaultCell().setPadding(5);
    table.setSpacingAfter(5f);

    PdfPCell cell = new PdfPCell();

    table.addCell(getStringCell(m_rb.getString("position"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("quantity"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("ean"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("article"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("vat"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_RIGHT, 1));
    table.addCell(getStringCell(m_rb.getString("price") + " (CHF)", font_bold_10,
            Rectangle.TOP | Rectangle.BOTTOM, Element.ALIGN_RIGHT, 1));

    if (m_shopping_basket.size() > 0 && !author.isEmpty()) {
        for (Map.Entry<String, Article> entry : m_shopping_basket.entrySet()) {
            Article article = entry.getValue();
            if (article.getAuthor().trim().toLowerCase().contains(author)) {
                String price_pruned = "";
                String total_price_CHF = "";
                if (article.getCode() != null && article.getCode().equals("ibsa")) {
                    float cr = article.getCashRebate();
                    if (article.getDraufgabe() > 0) {
                        price_pruned = String.format("%.2f", article.getBuyingPrice(0.0f));
                        total_price_CHF = String.format("%.2f", article.getTotBuyingPrice(0.0f));
                    } else {
                        price_pruned = String.format("%.2f", article.getBuyingPrice(cr));
                        total_price_CHF = String.format("%.2f", article.getTotBuyingPrice(cr));
                    }
                } else {
                    price_pruned = article.getCleanExfactoryPrice();
                    total_price_CHF = String.format("%.2f", article.getTotExfactoryPrice());
                }

                if (!price_pruned.isEmpty() && !price_pruned.equals("..")) {
                    // Index
                    table.addCell(getStringCell(Integer.toString(++position), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));
                    // Anzahl
                    table.addCell(getStringCell(Integer.toString(article.getQuantity()), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 1));
                    // EAN code
                    codeEAN.setCode(article.getEanCode());
                    Image img = codeEAN.createImageWithBarcode(cb, null, null);
                    img.scalePercent(120);
                    cell = new PdfPCell(img);
                    cell.setBorder(Rectangle.NO_BORDER);
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    cell.setUseBorderPadding(true);
                    cell.setBorderWidth(5);
                    if (position == 1)
                        cell.setPaddingTop(8);
                    else
                        cell.setPaddingTop(0);
                    cell.setPaddingBottom(8);
                    table.addCell(cell);
                    // Artikelbezeichnung
                    table.addCell(getStringCell(article.getPackTitle(), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));
                    // MwSt                  
                    table.addCell(getStringCell(String.format("%.1f%%", article.getVat()), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 1));
                    // Preis (exkl. MwSt)
                    // float price_CHF = article.getQuantity()*Float.parseFloat(price_pruned);
                    table.addCell(getStringCell(total_price_CHF, font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_RIGHT, 1));
                }
            }
        }

        subtotal_CHF = a.getSubtotal();
        shipping_CHF = a.getShippingCosts();
        vat25_CHF = a.getVat25();
        vat80_CHF = a.getVat80() + a.getShippingCosts() * 0.08f;

        float fulltotal_CHF = subtotal_CHF + shipping_CHF + vat25_CHF + vat80_CHF;

        table.addCell(getStringCell(m_rb.getString("subtotal"), font_bold_10, Rectangle.TOP,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, Rectangle.TOP, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", subtotal_CHF), font_bold_10, Rectangle.TOP,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("shipping"), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", shipping_CHF), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("vat") + " (2.5%)", font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", vat25_CHF), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("vat") + " (8.0%)", font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", vat80_CHF), font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("gesamttotal"), font_bold_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", fulltotal_CHF), font_bold_10, PdfPCell.NO_BORDER,
                Element.ALIGN_RIGHT, 2));
    }
    return table;
}

From source file:com.maxl.java.amikodesk.SaveBasket.java

License:Open Source License

public PdfPTable getFullShoppingBasket(PdfContentByte cb, String mode) {
    int position = 0;
    float sub_total_CHF = 0.0f;

    BarcodeEAN codeEAN = new BarcodeEAN();

    // Pos | Menge | Eancode | Bezeichnung | Preis
    PdfPTable table = new PdfPTable(new float[] { 1, 1, 3, 6, 2 });
    table.setWidthPercentage(100f);/*from   w w  w. j av a2s .c  om*/
    table.getDefaultCell().setPadding(5);
    table.setSpacingAfter(5f);

    PdfPCell cell = new PdfPCell();

    table.addCell(getStringCell(m_rb.getString("position"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("quantity"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("ean"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("article"), font_bold_10, Rectangle.TOP | Rectangle.BOTTOM,
            Element.ALIGN_MIDDLE, 1));
    table.addCell(getStringCell(m_rb.getString("price") + " (CHF)", font_bold_10,
            Rectangle.TOP | Rectangle.BOTTOM, Element.ALIGN_RIGHT, 1));

    if (m_shopping_basket.size() > 0) {
        for (Map.Entry<String, Article> entry : m_shopping_basket.entrySet()) {
            Article article = entry.getValue();

            if (mode.equals("all") || (mode.equals("rest") && (m_map_of_authors == null
                    || !anyElemIsContained(m_map_of_authors, article.getAuthor().trim().toLowerCase())))) {
                String price_pruned = "";
                if (article.getCode() != null && article.getCode().equals("ibsa")) {
                    float cr = article.getCashRebate();
                    if (article.getDraufgabe() > 0)
                        price_pruned = String.format("%.2f", article.getBuyingPrice(0.0f));
                    else
                        price_pruned = String.format("%.2f", article.getBuyingPrice(cr));
                } else {
                    price_pruned = article.getCleanExfactoryPrice();
                }

                if (!price_pruned.isEmpty() && !price_pruned.equals("..")) {
                    table.addCell(getStringCell(Integer.toString(++position), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));
                    table.addCell(getStringCell(Integer.toString(article.getQuantity()), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 1));

                    codeEAN.setCode(article.getEanCode());
                    Image img = codeEAN.createImageWithBarcode(cb, null, null);
                    img.scalePercent(120);
                    cell = new PdfPCell(img);
                    cell.setBorder(Rectangle.NO_BORDER);
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                    cell.setUseBorderPadding(true);
                    cell.setBorderWidth(5);
                    if (position == 1)
                        cell.setPaddingTop(8);
                    else
                        cell.setPaddingTop(0);
                    cell.setPaddingBottom(8);
                    table.addCell(cell);

                    table.addCell(getStringCell(article.getPackTitle(), font_norm_10, PdfPCell.NO_BORDER,
                            Element.ALIGN_MIDDLE, 1));

                    float price_CHF = article.getQuantity() * Float.parseFloat(price_pruned);
                    sub_total_CHF += price_CHF;
                    table.addCell(getStringCell(String.format("%.2f", price_CHF), font_norm_10,
                            PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 1));
                }
            }
        }

        table.addCell(getStringCell(m_rb.getString("subtotal"), font_bold_10, Rectangle.TOP,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, Rectangle.TOP, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", sub_total_CHF), font_bold_10, Rectangle.TOP,
                Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("vat") + " (2.5%)", font_norm_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_norm_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", sub_total_CHF * 0.025f), font_norm_10,
                PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 2));

        table.addCell(getStringCell(m_rb.getString("gesamttotal"), font_bold_10, PdfPCell.NO_BORDER,
                Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell("", font_bold_10, PdfPCell.NO_BORDER, Element.ALIGN_MIDDLE, 2));
        table.addCell(getStringCell(String.format("%.2f", sub_total_CHF * 1.025f), font_bold_10,
                PdfPCell.NO_BORDER, Element.ALIGN_RIGHT, 2));
    }
    return table;
}

From source file:com.norbsoft.pdfconverter.helpers.PDFHelper.java

License:Open Source License

private PdfPTable table(Form form) {
    int cellPadding = 5;
    PdfPTable table = new PdfPTable(8);
    table.setSpacingBefore(20);/*from w  w  w  .j a  va2  s.  com*/

    try {
        table.setWidths(new int[] { 100, 120, 30, 60, 60, 50, 50, 50 });
    } catch (DocumentException e) {
        Log.e(TAG, "Width error:" + e.getMessage());
    }

    PdfPCell cell = new PdfPCell(new Paragraph("Adres: " + form.getAddress(), normal));
    cell.setColspan(8);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Odbiorca: " + form.getOwner(), normal));
    cell.setColspan(8);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Data: " + form.getDate(), normal));
    cell.setColspan(3);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.LEFT | Rectangle.BOTTOM);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("tel: " + form.getPhone(), normal));
    cell.setColspan(5);
    cell.setPadding(cellPadding);
    cell.setBorder(Rectangle.RIGHT | Rectangle.BOTTOM);
    cell.setBorderColorBottom(BaseColor.BLACK);
    table.addCell(cell);

    //Header
    Paragraph p = new Paragraph("WODOMIERZ", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setNoWrap(true);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Nr fabryczny", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("DN", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Typ\r\nProducent", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Stan w (m3)", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Rok\r\nlegalizacji", bold);
    cell = new PdfPCell(p);
    ;
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph("Czy plomba\r\nlegalizacyjna jest\r\nuszkodzona?", bold);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //First row
    cell = new PdfPCell(new Paragraph("Zamontowany", bold));
    cell.setNoWrap(true);
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getNewSN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewDN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewType() + "\r\n" + form.getNewManufacturer(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewState(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getNewYear(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getNewSeal().equals("Tak"))
        p = new Paragraph("tak", normal);
    else
        p = new Paragraph("tak", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getNewSeal().equals("Nie"))
        p = new Paragraph("nie", normal);
    else
        p = new Paragraph("nie", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //Second row
    cell = new PdfPCell(new Paragraph("Wymontowany", bold));
    cell.setNoWrap(true);
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getOldSN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldDN(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldType() + "\r\n" + form.getOldManufacturer(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldState(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    p = new Paragraph(form.getOldYear(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getOldSeal().equals("Tak"))
        p = new Paragraph("tak", normal);
    else
        p = new Paragraph("tak", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    if (form.getOldSeal().equals("Nie"))
        p = new Paragraph("nie", normal);
    else
        p = new Paragraph("nie", strike);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    //Third row
    cell = new PdfPCell(new Paragraph("Plomba nr 1", bold));
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getSealFirst(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Przyczyna wymiany: " + form.getReason(), normal));
    cell.setPadding(cellPadding);
    cell.setColspan(5);
    table.addCell(cell);

    //Fourth row
    cell = new PdfPCell(new Paragraph("Plomba nr 2", bold));
    cell.setPadding(cellPadding);
    table.addCell(cell);

    p = new Paragraph(form.getSealSecond(), normal);
    cell = new PdfPCell(p);
    cell.setPadding(cellPadding);
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph("Umiejscowienie wodomierza: " + form.getPlacement(), normal));
    cell.setPadding(cellPadding);
    cell.setColspan(5);
    table.addCell(cell);

    //Fourth row
    cell = new PdfPCell(new Paragraph("Nr moduu\r\nradiowego", bold));
    cell.setPadding(cellPadding);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(form.getNewModuleNumber(), normal));
    cell.setPadding(cellPadding);
    cell.setColspan(7);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(cell);

    table.setWidthPercentage(100);
    return table;
}

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 {// w  ww .j a va  2 s .c om

        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;
}