Example usage for com.itextpdf.text Rectangle RIGHT

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

Introduction

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

Prototype

int RIGHT

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

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 PdfPTable getBout(String player1, String player2) {
    PdfPTable table = new PdfPTable(2);
    table.setTotalWidth(configuration.getSquareCellSize() * 2);
    PdfPCell player1Name = new PdfPCell(new Phrase(player1));
    player1Name.setBorder(Rectangle.BOTTOM);
    player1Name.setHorizontalAlignment(Element.ALIGN_CENTER);
    player1Name.setFixedHeight(configuration.getSquareCellSize());
    PdfPCell player2Name = new PdfPCell(new Phrase(player2));
    player2Name.setBorder(Rectangle.BOTTOM);
    player2Name.setHorizontalAlignment(Element.ALIGN_CENTER);
    player2Name.setFixedHeight(configuration.getSquareCellSize());
    PdfPCell player1Score = new PdfPCell(new Phrase(" "));
    player1Score.setBorder(Rectangle.RIGHT);
    player1Score.setFixedHeight(configuration.getSquareCellSize());
    PdfPCell player2Score = new PdfPCell(new Phrase(" "));
    player2Score.setBorder(Rectangle.LEFT);
    player2Score.setFixedHeight(configuration.getSquareCellSize());
    table.addCell(player1Name);/*from   w ww . ja  v  a 2 s.co m*/
    table.addCell(player2Name);
    table.addCell(player1Score);
    table.addCell(player2Score);
    table.setSpacingBefore(10);
    return table;
}

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

License:Open Source License

@Override
protected PdfPTable getScoreTable() throws DocumentException {
    final int columnCount = configuration.getNrOfPlayers(1) + configuration.getNrOfPlayers(2) + 2;
    //one column for each player, an extra column for the numbers and a column for the team marks

    PdfPTable table = new PdfPTable(columnCount);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setTotalWidth((columnCount) * configuration.getSquareCellSize());
    table.setLockedWidth(true);/*  w w w .  j a  v a 2s .c  o m*/
    float[] widths = new float[columnCount];
    for (int i = 0; i < widths.length; i++) {
        widths[i] = 1f;
    }
    table.setWidths(widths);

    PdfPCell topCell = getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, 2);
    topCell.setFixedHeight(configuration.getSquareCellSize());
    table.addCell(topCell);
    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, configuration.getNrOfPlayers(1)));
    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, configuration.getNrOfPlayers(2)));

    table.addCell(getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, 1, 1));
    {
        table.addCell(getSolidCell());
        for (int i = 0; i < configuration.getNrOfPlayers(1) + configuration.getNrOfPlayers(2); i++) {
            table.addCell(getHeaderCell(Integer.toString(i + 1)));
        }
    }

    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, configuration.getNrOfPlayers(1), 1));
    for (int i = 0; i < configuration.getNrOfPlayers(1) + configuration.getNrOfPlayers(2); i++) {
        if (i == configuration.getNrOfPlayers(1))
            table.addCell(getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM,
                    configuration.getNrOfPlayers(2), 1));

        table.addCell(getHeaderCell(Integer.toString(i + 1)));
        for (int j = 0; j < configuration.getNrOfPlayers(1) + configuration.getNrOfPlayers(2); j++) {
            if (i == j) {
                PdfPCell blackCell = getSolidCell();
                table.addCell(blackCell);
            } else {
                table.addCell(configuration.getResult(i, j));
            }
        }
    }

    table.setHorizontalAlignment(Element.ALIGN_RIGHT);
    return table;
}

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

License:Open Source License

@Override
protected PdfPTable getScoreTable() throws DocumentException {
    final int columnCount = configuration.getNrOfPlayers() + 2;

    PdfPTable table = new PdfPTable(columnCount);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setTotalWidth((columnCount) * configuration.getSquareCellSize());
    table.setLockedWidth(true);/*  ww  w .j  a v  a 2  s .  c o m*/
    float[] widths = new float[columnCount];
    for (int i = 0; i < widths.length; i++) {
        widths[i] = 1f;
    }
    table.setWidths(widths);

    PdfPCell topCell = getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, 2);
    topCell.setFixedHeight(configuration.getSquareCellSize());
    table.addCell(topCell);
    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, configuration.getNrOfPlayers()));

    table.addCell(getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, 1, 1));
    {
        table.addCell(getSolidCell());
        for (int i = 0; i < configuration.getNrOfPlayers(); i++) {
            table.addCell(getHeaderCell(Integer.toString(i + 1)));
        }
    }

    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, configuration.getNrOfPlayers(), 1));
    for (int i = 0; i < configuration.getNrOfPlayers(); i++) {
        table.addCell(getHeaderCell(Integer.toString(i + 1)));
        for (int j = 0; j < configuration.getNrOfPlayers(); j++) {
            if (i == j) {
                PdfPCell blackCell = getSolidCell();
                table.addCell(blackCell);
            } else {
                table.addCell(configuration.getResult(i, j));
            }
        }
    }

    table.setHorizontalAlignment(Element.ALIGN_RIGHT);
    return table;
}

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

License:Open Source License

protected PdfPTable getScoreTable() throws DocumentException {
    //table for scores
    final int columnCount = configuration.getNrOfPlayers(1) + configuration.getNrOfPlayers(2) + 2;
    //one column for each player, an extra column for the numbers and a column for the team marks

    PdfPTable table = new PdfPTable(columnCount);
    table.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
    table.setTotalWidth((columnCount) * configuration.getSquareCellSize());
    table.setLockedWidth(true);/*w  w w .j av  a  2 s  .c o m*/
    float[] widths = new float[columnCount];
    for (int i = 0; i < widths.length; i++) {
        widths[i] = 1f;
    }
    table.setWidths(widths);

    PdfPCell topCell = getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, 2);
    topCell.setFixedHeight(configuration.getSquareCellSize());
    table.addCell(topCell);
    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, configuration.getNrOfPlayers(1)));
    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.RIGHT, 1, configuration.getNrOfPlayers(2)));

    table.addCell(getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, 1, 1));
    {
        table.addCell(getSolidCell());
        for (int i = 0; i < configuration.getNrOfPlayers(1) + configuration.getNrOfPlayers(2); i++) {
            table.addCell(getHeaderCell(Integer.toString(i + 1)));
        }
    }

    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, configuration.getNrOfPlayers(1), 1));
    for (int i = 0; i < configuration.getNrOfPlayers(1); i++) {
        table.addCell(getHeaderCell(Integer.toString(i + 1)));
        if (i == 0) {
            PdfPCell blackCell = getSolidCell();
            blackCell.setColspan(configuration.getNrOfPlayers(1));
            blackCell.setRowspan(configuration.getNrOfPlayers(1));
            table.addCell(blackCell);
        }
        for (int j = 0; j < configuration.getNrOfPlayers(2); j++) {
            table.addCell(configuration.getResult(0, i, 1, j));
        }
    }

    table.addCell(
            getCellWithBorder(table.getDefaultCell(), Rectangle.BOTTOM, configuration.getNrOfPlayers(2), 1));
    for (int i = 0; i < configuration.getNrOfPlayers(2); i++) {
        table.addCell(getHeaderCell(Integer.toString(configuration.getNrOfPlayers(1) + i + 1)));
        for (int j = 0; j < configuration.getNrOfPlayers(1); j++) {
            table.addCell(configuration.getResult(1, i, 0, j));
        }
        if (i == 0) {
            PdfPCell blackCell = getSolidCell();
            blackCell.setColspan(configuration.getNrOfPlayers(2));
            blackCell.setRowspan(configuration.getNrOfPlayers(2));
            table.addCell(blackCell);
        }
    }
    table.setHorizontalAlignment(Element.ALIGN_RIGHT);
    return table;
}

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

public void generarPdf() {
    Document document = new Document();
    try {//from  w ww  .j ava 2 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.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  ww w.j a v a  2  s . co  m

    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 {/*from  www .  j  a v  a2  s .c o  m*/

        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 personalCertification(Document document, PdfWriter writer, AddressBook addressbook) {
    // TODO Auto-generated method stub
    log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalCertification ");
    try {/*from w  ww  . java 2  s. co  m*/

        /*  New Page   */
        document.newPage();

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

        for (Iterator itr = addressbook.getCandidateProfessionalCertifications().iterator(); itr.hasNext();) {
            CandidateProfessionalCertification procertification = (CandidateProfessionalCertification) itr
                    .next();
            if (i != 0) {
                PdfPCell 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);
            }
            i++;
            PdfPCell c1 = new PdfPCell(new Phrase("PERSONAL CERTIFICATION"));
            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("Certificate Name: " + procertification.getCertificateName(), 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("Chrater Agency: " + procertification.getCharterAgency(), font));
            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("Charter Date : " + format.format(procertification.getCharterDate()), 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(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            //c1.setBorder(Rectangle.BOTTOM);
            table.addCell(c1);

        }

        document.add(table);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        log.log(Level.INFO, "ApplicationFormPDFMaintenance --> personalCertification " + 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 Education(Document document, PdfWriter writer, AddressBook addressbook) {
    // TODO Auto-generated method stub
    log.log(Level.INFO, "ApplicationFormPDFMaintenance --> Education ");
    try {/*  www .jav  a 2 s.c  o m*/

        /*  New Page   */
        document.newPage();

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

        int i = 0;
        for (Iterator itr = addressbook.getCandidateEducations().iterator(); itr.hasNext();) {
            CandidateEducation candidateEducation = (CandidateEducation) itr.next();
            if (i != 0) {
                PdfPCell 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);
            }

            i++;
            PdfPCell c1 = new PdfPCell(new Phrase("EDUCATION"));
            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("Start Date: " + format.format(candidateEducation.getStartDate()), 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("End Date: " + format.format(candidateEducation.getEndDate()), font));
            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("Witness : " + candidateEducation.getWitness(), 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("Education : " + candidateEducation.getEducation(), font));
            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("Education Level : " + candidateEducation.getEducationLevel(), 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("School : " + candidateEducation.getSchool(), font));
            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("Witness Contect Number : " + candidateEducation.getWitnessContactNo(), 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(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            //c1.setBorder(Rectangle.BOTTOM);
            table.addCell(c1);

        }
        document.add(table);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        log.log(Level.INFO, "ApplicationFormPDFMaintenance --> Education " + 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 workExperience(Document document, PdfWriter writer, AddressBook addressbook) {
    // TODO Auto-generated method stub
    log.log(Level.INFO, "ApplicationFormPDFMaintenance --> workExperience ");
    try {//from   w  w  w .ja v  a  2 s.  c  om

        document.newPage();

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

        int i = 0;

        for (Iterator itr = addressbook.getCandidateWorkExperiences().iterator(); itr.hasNext();) {
            CandidateWorkExperience candidateWorkExp = (CandidateWorkExperience) itr.next();
            if (i != 0) {

                PdfPCell 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(" ", font));
                c1.setBorder(Rectangle.NO_BORDER);
                c1.setLeading(4f, 0f);
                c1.setFixedHeight(15f);
                table.addCell(c1);
            }
            i++;
            PdfPCell c1 = new PdfPCell(new Phrase("WORK EXPERIENCE"));
            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 < 3; 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("Start Date: " + format.format(candidateWorkExp.getStartDate()), 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("End Date: " + format.format(candidateWorkExp.getEndDate()), 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("Witness: " + candidateWorkExp.getWitness(), font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            c1.setBorder(Rectangle.BOTTOM);
            table.addCell(c1);

            for (int j = 0; j < 3; 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("Unit : " + candidateWorkExp.getUnit(), 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("Occupation : " + candidateWorkExp.getOccupation(), 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("Witness Contect Number : \n\n\n  \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
                    + candidateWorkExp.getWitnessContactNo(), font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(25f);
            //c1.setPaddingBottom(10f);
            c1.setBorder(Rectangle.BOTTOM);

            table.addCell(c1);

            for (int j = 0; j < 3; 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("Income : " + candidateWorkExp.getIncome(), 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("Possition : " + candidateWorkExp.getPosition(), 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(" ", font));
            c1.setBorder(Rectangle.NO_BORDER);
            c1.setLeading(4f, 0f);
            c1.setFixedHeight(15f);
            c1.setBorder(Rectangle.BOTTOM);
            table.addCell(c1);

        }

        document.add(table);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        log.log(Level.INFO, "ApplicationFormPDFMaintenance --> workExperience " + 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;
}