Example usage for com.itextpdf.text Element ALIGN_LEFT

List of usage examples for com.itextpdf.text Element ALIGN_LEFT

Introduction

In this page you can find the example usage for com.itextpdf.text Element ALIGN_LEFT.

Prototype

int ALIGN_LEFT

To view the source code for com.itextpdf.text Element ALIGN_LEFT.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:jdbreport.model.io.pdf.itext5.ITextWriter.java

License:Apache License

protected int toPdfHAlignment(int horizontalAlignment) {
    switch (horizontalAlignment) {
    case CellStyle.LEFT:
        return Element.ALIGN_LEFT;
    case CellStyle.RIGHT:
        return Element.ALIGN_RIGHT;
    case CellStyle.CENTER:
        return Element.ALIGN_CENTER;
    case CellStyle.JUSTIFY:
        return Element.ALIGN_JUSTIFIED;
    }//  w  ww.j av a2 s  .  co m
    return Element.ALIGN_LEFT;
}

From source file:ke.co.tawi.babblesms.server.utils.export.PdfUtil.java

License:Open Source License

/**
 * Adds the header and the footer.// w  w  w  . ja  v  a  2  s  .com
 * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(
 *      com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document)
 */
@Override
public void onEndPage(PdfWriter writer, Document document) {
    Rectangle rect = writer.getBoxSize("art");
    switch (writer.getPageNumber() % 1) {

    case 0:
        ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, header[0], rect.getRight(),
                rect.getTop(), 0);
        break;
    case 1:
        ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_LEFT, header[1], rect.getLeft(),
                rect.getTop(), 0);
        break;
    }
    ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER,
            new Phrase(String.format("page %d", pagenumber)), (rect.getLeft() + rect.getRight()) / 2,
            rect.getBottom() - 18, 0);
}

From source file:KTCNPM.ExportFile.java

public void exportFile(ArrayList<String> list, ArrayList<String> listTAW, ArrayList<String> listTBF,
        ArrayList<String> listTCF, ArrayList<String> listEF, ArrayList<String> listG) throws IOException {
    Document document = new Document();

    try {//  w  w w.  ja  v  a 2  s.c  o  m
        String fileSRC = "E:\\KTCNPM.pdf";
        File file = new File(fileSRC);
        if (file.exists()) {
            file.delete();
        } else {
            file.createNewFile();
        }

        PdfWriter.getInstance(document, new FileOutputStream(fileSRC));
        document.open();

        Font f1 = new Font(
                BaseFont.createFont("/newpackage/vuArialBold.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
        Font f2 = new Font(
                BaseFont.createFont("/newpackage/vuArial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED));
        f2.setSize(9);
        f1.setSize(13);

        Paragraph paragraph2 = new Paragraph("", f2);
        Paragraph paragraph3 = new Paragraph();

        paragraph2.setIndentationLeft(80);
        paragraph2.setIndentationRight(80);
        paragraph2.setAlignment(Element.ALIGN_LEFT);
        paragraph2.setSpacingAfter(15);

        Phrase phrase2 = new Phrase("Tn phn m?m: Tnh chi ph phn m?m");
        Phrase phrase3 = new Phrase(" ");
        paragraph3.add(phrase3);
        paragraph2.add(phrase2);

        //Phu luc 3
        Phrase phrase5 = new Phrase(
                "Ph lc III: Bng tnh ton im cc tc nhn (actors) tng tc, trao i thng tin");
        Paragraph paragraph5 = new Paragraph("", f1);
        paragraph5.setIndentationLeft(80);
        paragraph5.setIndentationRight(80);
        paragraph5.setAlignment(Element.ALIGN_CENTER);
        paragraph5.setSpacingAfter(10);
        paragraph5.add(phrase5);

        document.add(paragraph5);
        document.add(paragraph2);

        PdfPTable table3 = new PdfPTable(5);

        table3.setWidthPercentage(400 / 5.23f);
        table3.setWidths(new int[] { 1, 5, 3, 2, 3 });
        for (int i = 0; i < listTAW.size(); i++) {
            Paragraph p = new Paragraph(listTAW.get(i), f2);
            PdfPCell data = new PdfPCell(p);
            table3.addCell(data);
        }
        document.add(table3);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        // phu luc 4
        Phrase phrase41 = new Phrase(
                "Ph lc IV: Bng tnh ton im cc tr?ng hp s dung (use case)");
        Paragraph paragraph41 = new Paragraph("", f1);
        paragraph41.setIndentationLeft(80);
        paragraph41.setIndentationRight(80);
        paragraph41.setAlignment(Element.ALIGN_CENTER);
        paragraph41.setSpacingAfter(10);
        paragraph41.add(phrase41);

        document.add(paragraph41);
        document.add(paragraph2);

        PdfPTable table4 = new PdfPTable(4);
        table4.setWidthPercentage(400 / 5.23f);
        table4.setWidths(new int[] { 1, 3, 3, 4 });
        for (int i = 0; i < listTBF.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listTBF.get(i), f2));
            table4.addCell(data);
        }
        document.add(table4);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        // phu luc 5
        Phrase phrase51 = new Phrase(
                "Ph lc V: Bng tnh ton h s phc tp k thut - cng ngh");
        Paragraph paragraph51 = new Paragraph("", f1);
        paragraph51.setIndentationLeft(80);
        paragraph51.setIndentationRight(80);
        paragraph51.setAlignment(Element.ALIGN_CENTER);
        paragraph51.setSpacingAfter(10);
        paragraph51.add(phrase51);

        document.add(paragraph51);
        document.add(paragraph2);

        PdfPTable table5 = new PdfPTable(5);
        table5.setWidthPercentage(400 / 5.23f);
        table5.setWidths(new int[] { 1, 6, 2, 2, 2 });
        for (int i = 0; i < listTCF.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listTCF.get(i), f2));
            table5.addCell(data);
        }
        document.add(table5);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        //phu luc 6
        Phrase phrase61 = new Phrase(
                "Ph lc VI: Bng tnh ton h s tc ng mi tr?ng v nhm lm vic, h s phc tp v? mi tr?ng");
        Paragraph paragraph61 = new Paragraph("", f1);
        paragraph61.setIndentationLeft(80);
        paragraph61.setIndentationRight(80);
        paragraph61.setAlignment(Element.ALIGN_CENTER);
        paragraph61.setSpacingAfter(10);
        paragraph61.add(phrase61);

        document.add(paragraph61);
        document.add(paragraph2);

        PdfPTable table6 = new PdfPTable(6);
        table6.setWidthPercentage(400 / 5.23f);
        table6.setWidths(new int[] { 1, 6, 2, 2, 2, 3 });
        for (int i = 0; i < listEF.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listEF.get(i), f2));
            table6.addCell(data);
        }
        document.add(table6);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        //phu luc 7
        Phrase phrase7 = new Phrase("Ph lc VII: Bng tnh ton gi tr phn m?m");
        Paragraph paragraph7 = new Paragraph("", f1);
        paragraph7.setIndentationLeft(80);
        paragraph7.setIndentationRight(80);
        paragraph7.setAlignment(Element.ALIGN_CENTER);
        paragraph7.setSpacingAfter(10);
        paragraph7.add(phrase7);

        document.add(paragraph7);
        document.add(paragraph2);

        PdfPTable table7 = new PdfPTable(5);
        table7.setWidthPercentage(400 / 5.23f);
        table7.setWidths(new int[] { 1, 5, 5, 4, 2 });
        for (int i = 0; i < listG.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(listG.get(i), f2));
            table7.addCell(data);
        }
        document.add(table7);
        document.add(paragraph3);
        document.add(paragraph3);
        document.add(paragraph3);

        // phu luc 8
        Paragraph paragraph1 = new Paragraph("", f1);
        paragraph1.setIndentationLeft(80);
        paragraph1.setIndentationRight(80);
        paragraph1.setAlignment(Element.ALIGN_CENTER);
        paragraph1.setSpacingAfter(10);
        Phrase phrase1 = new Phrase("Ph lc VIII: Bng tng hp chi ph phn m?m");
        paragraph1.add(phrase1);
        document.add(paragraph1);
        document.add(paragraph2);
        PdfPTable table = new PdfPTable(5);
        table.setWidthPercentage(400 / 5.23f);
        table.setWidths(new int[] { 1, 5, 3, 4, 2 });

        for (int i = 0; i < list.size(); i++) {
            PdfPCell data = new PdfPCell(new Paragraph(list.get(i), f2));
            table.addCell(data);
        }
        document.add(table);
        document.close();

    } catch (DocumentException | FileNotFoundException e) {
    }
}

From source file:Login.ventas.fproyectos.java

/**
 * Creates new form cliente//w w w.  j a v a  2 s  . c  o m
 * @param user
 */
public fproyectos(Login user) {
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    @SuppressWarnings("MismatchedReadAndWriteOfArray")
    String[] fecha = { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre",
            "Octubre", "Noviembre", "Diciembre" };
    initComponents();
    Calendar rightNow = Calendar.getInstance();
    int ccyy = rightNow.get(Calendar.YEAR);
    int month = rightNow.get(Calendar.MONTH);
    setSize(d.width, d.height - 95);
    this.usuario = user;
    add(f);
    f.setLocation(jPanel1.getX(), jPanel1.getY());
    add(f3);
    f3.setLocation(jPanel1.getX(), jPanel1.getY());
    add(f4);
    f4.setLocation(jPanel1.getX(), jPanel1.getY());
    add(f5);
    f5.setLocation(jPanel1.getX(), jPanel1.getY());
    add(f2);
    f2.setLocation(jPanel1.getX(), jPanel1.getY());

    f2.getjButton1().addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                ServiceHb helper = new ServiceHb();
                helper.iniciarTransaccion();
                Fcomisiones fc = helper.getFcomisiones(idcliente, idinstalacion);
                if (helper.getFcomisiones(idcliente, idinstalacion) == null) {
                    fc = new Fcomisiones();
                    Calendar d = Calendar.getInstance();
                    fc.setFecha(new java.sql.Date(d.getTime().getTime()));
                    fc.setClientes(
                            (Clientes) helper.obtenerObjeto(Clientes.class, Integer.parseInt(idcliente)));
                    fc.setInstalacion((Instalacion) helper.obtenerObjeto(Instalacion.class,
                            Integer.parseInt(idinstalacion)));
                    fc.setRentabilidad(f2.getjLabel20().getText());
                    fc.setValor1(f2.getjLabel11().getText().substring(2, f2.getjLabel11().getText().length()));
                    fc.setValor2(f2.getjLabel2().getText().substring(3, f2.getjLabel2().getText().length()));
                    fc.setDiferido(f2.getjLabel4().getText());
                    fc.setDias(numeroinstala);
                    helper.crearObjeto(fc);
                    helper.confirmarTransaccion();
                    helper.cerrarSesion();
                    JOptionPane.showMessageDialog(null,
                            "Comision prepara con fecha " + Funcion.DateFormatSql(d.getTime()));
                } else {
                    Calendar d = Calendar.getInstance();
                    fc.setFecha(new java.sql.Date(d.getTime().getTime()));
                    fc.setRentabilidad(f2.getjLabel20().getText());
                    fc.setValor1(f2.getjLabel11().getText().substring(2, f2.getjLabel11().getText().length()));
                    fc.setValor2(f2.getjLabel2().getText().substring(3, f2.getjLabel2().getText().length()));
                    fc.setDiferido(f2.getjLabel4().getText());
                    fc.setDias(numeroinstala);
                    helper.actualizarObjeto(fc);
                    helper.confirmarTransaccion();
                    helper.cerrarSesion();
                    JOptionPane.showMessageDialog(null,
                            "Actualizado / Comision prepara con fecha " + Funcion.DateFormatSql(d.getTime()));
                }
            } catch (Exception io) {
                System.out.println(io);
            }
        }
    });
    f2.getjButton2().addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        @SuppressWarnings("UseSpecificCatch")
        public void mouseClicked(MouseEvent e) {
            float ancho = 0;
            try {
                Document documento = new Document(PageSize.A4, 0, 0, 0, 0);
                ancho = documento.getPageSize().getWidth() - 100;
                FileOutputStream ficheroPdf;
                PdfWriter writer = null;
                PdfWriter writer2 = null;
                String direccion = "";
                Calendar now2 = Calendar.getInstance();
                try {
                    JFileChooser chooser = new JFileChooser();
                    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                    //Mostrar la ventana para abrir archivo y recoger la respuesta
                    //En el parmetro del showOpenDialog se indica la ventana
                    //  al que estar asociado. Con el valor this se asocia a la
                    //  ventana que la abre.
                    int respuesta = chooser.showOpenDialog(null);
                    String cadena = "";
                    if (respuesta == JFileChooser.APPROVE_OPTION) {
                        direccion = chooser.getSelectedFile().getAbsolutePath();
                    }
                    Calendar d = Calendar.getInstance();
                    ficheroPdf = new FileOutputStream(direccion + "/" + idcliente + idinstalacion + ".pdf");
                    writer = PdfWriter.getInstance(documento, ficheroPdf);
                } catch (IOException ex) {
                    System.out.println(ex.toString());
                }
                ServiceHb helper = null;
                try {
                    List<Productos> lt = null;
                    helper = new ServiceHb();
                    helper.iniciarTransaccion();
                    PdfPTable tabla;
                    PdfPCell casilla;
                    PdfPTable salto = null;
                    PdfPCell celda;
                    Font fontpersonalizado = FontFactory.getFont("ARIAL", 7, Font.BOLD);
                    Font fontpersonalizado2 = FontFactory.getFont("ARIAL", 7, Font.NORMAL);
                    documento.open();
                    PdfContentByte canvas = writer.getDirectContent();
                    fondos(documento, canvas);
                    //Materiales
                    double total = 0;
                    double total2 = 0;
                    double total3 = 0;
                    double total4 = 0;
                    double total5 = 0;
                    tabla = new PdfPTable(6);
                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                    tabla.setTotalWidth(ancho);
                    tabla.setLockedWidth(true);
                    celda = new PdfPCell(new Paragraph("ADQUISICION DE MATERIALES"));
                    celda.setColspan(6);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);
                    float pagina = documento.getPageSize().getHeight() - 140;
                    final float max = pagina;
                    pagina = pagina - tabla.getRow(0).calculateHeights();
                    if (ltart != null) {
                        Object nuevo2[] = { "FECHA", "DETALLE", "CANT.", "PRECIO", "SUBTOTAL", "TOTAL DIARIO" };
                        for (Object obj : nuevo2) {
                            celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                            celda.setBorderColor(new Color(195, 195, 195));
                            celda.setColspan(1);
                            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                            tabla.addCell(celda);
                        }
                        pagina = pagina - tabla.getRow(1).calculateHeights();
                        int tam = 0;
                        double diario = 0;
                        int turno = 0;
                        for (int i = 0; i < ltart.size(); i++) {
                            turno = 0;
                            fact = helper.getFacturafecha(ltart.get(i).getIdfactura());
                            String fecha = "";
                            if (fact != null) {
                                fecha = Funcion.DateFormatSql(fact.getFecha());
                            }
                            if ((i + 1) == ltart.size()) {
                                diario = diario + Double.parseDouble(ltart.get(i).getTotal());
                                turno = 1;
                            } else {
                                fact2 = helper.getFacturafecha(ltart.get(i + 1).getIdfactura());
                                String fecha2 = "";
                                if (fact2 != null) {
                                    fecha2 = Funcion.DateFormatSql(fact2.getFecha());
                                    if (fecha.equalsIgnoreCase(fecha2)) {
                                        diario = diario + Double.parseDouble(ltart.get(i).getTotal());
                                    } else {
                                        diario = diario + Double.parseDouble(ltart.get(i).getTotal());
                                        turno = 1;
                                    }
                                }
                            }
                            String uni = "$ " + df.format(Double.parseDouble(ltart.get(i).getUnitario()))
                                    .replace(",", ".");
                            String tot = "$ "
                                    + df.format(Double.parseDouble(ltart.get(i).getTotal())).replace(",", ".");
                            total = total + Double.parseDouble(ltart.get(i).getTotal());
                            if (turno == 0) {
                                Object nuevo[] = { fecha, ltart.get(i).getDescripcion(),
                                        ltart.get(i).getCantidad(), uni, tot, "" };
                                for (Object obj : nuevo) {

                                    celda = new PdfPCell(
                                            new Paragraph((String) obj, new Font(fontpersonalizado2)));
                                    if (((String) obj).equalsIgnoreCase("")) {
                                        celda.setBorder(Rectangle.RIGHT);
                                    }
                                    celda.setBorderColor(new Color(195, 195, 195));
                                    celda.setColspan(1);
                                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                                    tabla.addCell(celda);
                                }
                            } else {
                                Object nuevo[] = { fecha, ltart.get(i).getDescripcion(),
                                        ltart.get(i).getCantidad(), uni, tot,
                                        "$ " + df.format(diario).replace(",", ".") };
                                int va = 0;
                                for (Object obj : nuevo) {
                                    va++;
                                    celda = new PdfPCell(
                                            new Paragraph((String) obj, new Font(fontpersonalizado2)));
                                    if (va == 5) {
                                        celda.setBorder(Rectangle.BOTTOM);
                                    }
                                    celda.setColspan(1);
                                    celda.setBorderColor(new Color(195, 195, 195));
                                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                                    tabla.addCell(celda);
                                }
                                diario = 0;
                            }
                            pagina = pagina - tabla.getRow(tam).getMaxHeights();
                            tam++;
                            if (pagina < 11) {
                                salto = new PdfPTable(1);
                                casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                                casilla.setMinimumHeight(90);
                                casilla.setBorder(PdfPCell.NO_BORDER);
                                salto.addCell(casilla);
                                documento.add(salto);

                                documento.add(tabla);
                                documento.newPage();
                                fondos(documento, canvas);
                                tabla = new PdfPTable(6);
                                tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                                tabla.setTotalWidth(ancho);
                                tabla.setLockedWidth(true);
                                pagina = max;
                                tam = 0;
                            }

                        }
                    }
                    salto = new PdfPTable(1);
                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                    casilla.setMinimumHeight(90);
                    casilla.setBorder(PdfPCell.NO_BORDER);
                    salto.addCell(casilla);
                    documento.add(salto);

                    celda = new PdfPCell(new Paragraph("Total", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(
                            new Paragraph("Adquisicin de Materiales", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(4);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("$ " + df.format(total).replace(",", "."),
                            new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    documento.add(tabla);
                    documento.newPage();
                    fondos(documento, canvas);
                    /*Parte 2*/

                    tabla = new PdfPTable(4);
                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                    tabla.setTotalWidth(ancho);
                    tabla.setLockedWidth(true);
                    tabla.setWidths(new int[] { 1, 3, 1, 1 });
                    celda = new PdfPCell(new Paragraph("MANO DE OBRA TECNICOS"));
                    celda.setColspan(4);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);
                    pagina = documento.getPageSize().getHeight() - 140;
                    pagina = pagina - tabla.getRow(0).calculateHeights();

                    if (list != null) {
                        Object nuevo2[] = { "FECHA", "DETALLE", "CANT.", "SUBTOTAL" };
                        for (Object obj : nuevo2) {
                            celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                            celda.setBorderColor(new Color(195, 195, 195));
                            celda.setColspan(1);
                            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                            tabla.addCell(celda);
                        }
                        pagina = pagina - tabla.getRow(1).calculateHeights();
                        int tam = 0;
                        double diario = 0;
                        int turno = 0;
                        for (Ctepagar list1 : list) {
                            if (list1.getDetalle().contains("ci:")) {
                                String fecha = list1.getFecha();
                                String desc = list1.getDetalle();
                                String[] cadena = desc.split(" ");
                                String result = "";
                                int contador = 0;
                                for (String n : cadena) {
                                    if (n.contains("ci:")) {
                                        result = result + ", ";
                                        contador++;
                                    } else {
                                        result = result + n + " ";
                                    }
                                }
                                result = result.substring(0, result.length() - 2);
                                String uni = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                String tot = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                total2 = total2 + Double.parseDouble(list1.getValor());
                                Object nuevo[] = { fecha, result, "" + contador, tot };
                                for (Object obj : nuevo) {
                                    celda = new PdfPCell(
                                            new Paragraph((String) obj, new Font(fontpersonalizado2)));
                                    celda.setBorderColor(new Color(195, 195, 195));
                                    celda.setColspan(1);
                                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                                    tabla.addCell(celda);
                                }
                                pagina = pagina - tabla.getRow(tam).getMaxHeights();
                                tam++;
                                if (pagina < 90) {
                                    salto = new PdfPTable(1);
                                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado2)));
                                    casilla.setMinimumHeight(90);
                                    casilla.setBorder(PdfPCell.NO_BORDER);
                                    salto.addCell(casilla);
                                    documento.add(salto);

                                    documento.add(tabla);
                                    documento.newPage();
                                    fondos(documento, canvas);
                                    tabla = new PdfPTable(4);
                                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                                    tabla.setTotalWidth(ancho);
                                    tabla.setLockedWidth(true);
                                    tabla.setWidths(new int[] { 1, 3, 1, 1 });
                                    pagina = max;
                                    tam = 0;
                                }
                            }
                        }
                    }
                    salto = new PdfPTable(1);
                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                    casilla.setMinimumHeight(90);
                    casilla.setBorder(PdfPCell.NO_BORDER);
                    salto.addCell(casilla);
                    documento.add(salto);

                    celda = new PdfPCell(new Paragraph("Total", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("Mano de Obra Tcnicos", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(2);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("$ " + df.format(total2).replace(",", "."),
                            new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    documento.add(tabla);

                    documento.newPage();
                    fondos(documento, canvas);

                    tabla = new PdfPTable(3);
                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                    tabla.setTotalWidth(ancho);
                    tabla.setLockedWidth(true);
                    tabla.setWidths(new int[] { 1, 3, 1 });
                    celda = new PdfPCell(new Paragraph("TRANSPORTE"));
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);
                    pagina = documento.getPageSize().getHeight() - 140;
                    pagina = pagina - tabla.getRow(0).calculateHeights();

                    if (list != null) {
                        Object nuevo2[] = { "FECHA", "DETALLE", "SUBTOTAL" };
                        for (Object obj : nuevo2) {
                            celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                            celda.setBorderColor(new Color(195, 195, 195));
                            celda.setColspan(1);
                            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                            tabla.addCell(celda);
                        }
                        pagina = pagina - tabla.getRow(1).calculateHeights();
                        int tam = 0;
                        for (Ctepagar list1 : list) {
                            if (list1.getDetalle().contains("Transporte")) {
                                String fecha = list1.getFecha();
                                String desc = list1.getDetalle();
                                String result = "";
                                String uni = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                String tot = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                total3 = total3 + Double.parseDouble(list1.getValor());
                                Object nuevo[] = { fecha, desc, tot };
                                for (Object obj : nuevo) {
                                    celda = new PdfPCell(
                                            new Paragraph((String) obj, new Font(fontpersonalizado2)));
                                    celda.setBorderColor(new Color(195, 195, 195));
                                    celda.setColspan(1);
                                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                                    tabla.addCell(celda);
                                }
                                pagina = pagina - tabla.getRow(tam).getMaxHeights();
                                tam++;
                                if (pagina < 50) {
                                    salto = new PdfPTable(1);
                                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado2)));
                                    casilla.setMinimumHeight(90);
                                    casilla.setBorder(PdfPCell.NO_BORDER);
                                    salto.addCell(casilla);
                                    documento.add(salto);

                                    documento.add(tabla);
                                    documento.newPage();
                                    fondos(documento, canvas);
                                    tabla = new PdfPTable(3);
                                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                                    tabla.setTotalWidth(ancho);
                                    tabla.setLockedWidth(true);
                                    tabla.setWidths(new int[] { 1, 3, 1 });
                                    pagina = max;
                                    tam = 0;
                                }
                            }
                        }
                    }
                    salto = new PdfPTable(1);
                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                    casilla.setMinimumHeight(90);
                    casilla.setBorder(PdfPCell.NO_BORDER);
                    salto.addCell(casilla);
                    documento.add(salto);

                    celda = new PdfPCell(new Paragraph("Total", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("Transporte", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("$ " + df.format(total3).replace(",", "."),
                            new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    documento.add(tabla);

                    documento.newPage();
                    fondos(documento, canvas);

                    tabla = new PdfPTable(3);
                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                    tabla.setTotalWidth(ancho);
                    tabla.setLockedWidth(true);
                    tabla.setWidths(new int[] { 1, 3, 1 });
                    celda = new PdfPCell(new Paragraph("COMBUSTIBLE"));
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);
                    pagina = documento.getPageSize().getHeight() - 140;
                    pagina = pagina - tabla.getRow(0).calculateHeights();

                    if (list != null) {
                        Object nuevo2[] = { "FECHA", "DETALLE", "SUBTOTAL" };
                        for (Object obj : nuevo2) {
                            celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                            celda.setBorderColor(new Color(195, 195, 195));
                            celda.setColspan(1);
                            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                            tabla.addCell(celda);
                        }
                        pagina = pagina - tabla.getRow(1).calculateHeights();
                        int tam = 0;
                        for (Ctepagar list1 : list) {
                            if (list1.getDetalle().contains("Combustible")) {
                                String fecha = list1.getFecha();
                                String desc = list1.getDetalle();
                                String result = "";
                                String uni = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                String tot = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                total4 = total4 + Double.parseDouble(list1.getValor());
                                Object nuevo[] = { fecha, desc, tot };
                                for (Object obj : nuevo) {
                                    celda = new PdfPCell(
                                            new Paragraph((String) obj, new Font(fontpersonalizado2)));
                                    celda.setBorderColor(new Color(195, 195, 195));
                                    celda.setColspan(1);
                                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                                    tabla.addCell(celda);
                                }
                                pagina = pagina - tabla.getRow(tam).getMaxHeights();
                                tam++;
                                if (pagina < 50) {
                                    salto = new PdfPTable(1);
                                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                                    casilla.setMinimumHeight(90);
                                    casilla.setBorder(PdfPCell.NO_BORDER);
                                    salto.addCell(casilla);
                                    documento.add(salto);

                                    documento.add(tabla);
                                    documento.newPage();
                                    fondos(documento, canvas);
                                    tabla = new PdfPTable(3);
                                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                                    tabla.setTotalWidth(ancho);
                                    tabla.setLockedWidth(true);
                                    tabla.setWidths(new int[] { 1, 3, 1 });
                                    pagina = max;
                                    tam = 0;
                                }
                            }
                        }
                    }
                    salto = new PdfPTable(1);
                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                    casilla.setMinimumHeight(90);
                    casilla.setBorder(PdfPCell.NO_BORDER);
                    salto.addCell(casilla);
                    documento.add(salto);

                    celda = new PdfPCell(new Paragraph("Total", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("Combustible", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("$ " + df.format(total4).replace(",", "."),
                            new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    documento.add(tabla);

                    documento.newPage();
                    fondos(documento, canvas);

                    //Extras

                    tabla = new PdfPTable(3);
                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                    tabla.setTotalWidth(ancho);
                    tabla.setLockedWidth(true);
                    tabla.setWidths(new int[] { 1, 3, 1 });
                    celda = new PdfPCell(new Paragraph("EXTRAS"));
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);
                    pagina = documento.getPageSize().getHeight() - 140;
                    pagina = pagina - tabla.getRow(0).calculateHeights();

                    if (list != null) {
                        Object nuevo2[] = { "FECHA", "DETALLE", "SUBTOTAL" };
                        for (Object obj : nuevo2) {
                            celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                            celda.setBorderColor(new Color(195, 195, 195));
                            celda.setColspan(1);
                            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                            tabla.addCell(celda);
                        }
                        pagina = pagina - tabla.getRow(1).calculateHeights();
                        int tam = 0;
                        for (Ctepagar list1 : list) {
                            if (!list1.getDetalle().contains("Combustible")
                                    && !list1.getDetalle().contains("ci:")
                                    && !list1.getDetalle().contains("Transporte")) {
                                String fecha = list1.getFecha();
                                String desc = list1.getDetalle();
                                String result = "";
                                String uni = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                String tot = "$ "
                                        + df.format(Double.parseDouble(list1.getValor())).replace(",", ".");
                                total5 = total5 + Double.parseDouble(list1.getValor());
                                Object nuevo[] = { fecha, desc, tot };
                                for (Object obj : nuevo) {
                                    celda = new PdfPCell(
                                            new Paragraph((String) obj, new Font(fontpersonalizado2)));
                                    celda.setBorderColor(new Color(195, 195, 195));
                                    celda.setColspan(1);
                                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                                    tabla.addCell(celda);
                                }
                                pagina = pagina - tabla.getRow(tam).getMaxHeights();
                                tam++;
                                if (pagina < 50) {
                                    salto = new PdfPTable(1);
                                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                                    casilla.setMinimumHeight(90);
                                    casilla.setBorder(PdfPCell.NO_BORDER);
                                    salto.addCell(casilla);
                                    documento.add(salto);

                                    documento.add(tabla);
                                    documento.newPage();
                                    fondos(documento, canvas);
                                    tabla = new PdfPTable(3);
                                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                                    tabla.setTotalWidth(ancho);
                                    tabla.setLockedWidth(true);
                                    tabla.setWidths(new int[] { 1, 3, 1 });
                                    pagina = max;
                                    tam = 0;
                                }
                            }
                        }
                    }
                    salto = new PdfPTable(1);
                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                    casilla.setMinimumHeight(90);
                    casilla.setBorder(PdfPCell.NO_BORDER);
                    salto.addCell(casilla);
                    documento.add(salto);

                    celda = new PdfPCell(new Paragraph("Total", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("Extra", new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("$ " + df.format(total5).replace(",", "."),
                            new Font(fontpersonalizado2)));
                    celda.setBorderColor(new Color(195, 195, 195));
                    celda.setColspan(1);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);

                    documento.add(tabla);

                    documento.newPage();
                    fondos(documento, canvas);

                    //Final Vendedor

                    tabla = new PdfPTable(3);
                    tabla.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
                    tabla.setTotalWidth(ancho);
                    tabla.setLockedWidth(true);
                    tabla.setWidths(new int[] { 1, 3, 1 });
                    celda = new PdfPCell(new Paragraph(nombrecliente));
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);

                    celda = new PdfPCell(new Paragraph("Venta"));
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_LEFT);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);

                    pagina = documento.getPageSize().getHeight() - 140;
                    pagina = pagina - tabla.getRow(0).calculateHeights();

                    Object nuevo2[] = { "FECHA", "DETALLE", "TOTAL" };
                    for (Object obj : nuevo2) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                        celda.setBorderColor(new Color(195, 195, 195));
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo3[] = { "", nombreinstalacion, totalinstalacion };
                    for (Object obj : nuevo3) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorderColor(new Color(195, 195, 195));
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    celda = new PdfPCell(new Paragraph("INVERSION", new Font(fontpersonalizado)));
                    celda.setBorder(PdfPCell.NO_BORDER);
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                    tabla.addCell(celda);
                    Object nuevo4[] = { "Uso de Materiales", "", "$ " + df.format(total).replace(",", ".") };
                    for (Object obj : nuevo4) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo5[] = { "Mano de obra tcnicos", "",
                            "$ " + df.format(total2).replace(",", ".") };
                    for (Object obj : nuevo5) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo6[] = { "Transporte", "", "$ " + df.format(total3).replace(",", ".") };
                    for (Object obj : nuevo6) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo7[] = { "Combustible", "", "$ " + df.format(total4).replace(",", ".") };
                    for (Object obj : nuevo7) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo71[] = { "Extras", "", "$ " + df.format(total5).replace(",", ".") };
                    for (Object obj : nuevo71) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo8[] = { "Total Inversin", "",
                            "$ " + df.format(total + total2 + total3 + total4).replace(",", ".") };
                    for (Object obj : nuevo8) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado2)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    celda = new PdfPCell(new Paragraph(""));
                    celda.setColspan(3);
                    celda.setHorizontalAlignment(Element.ALIGN_LEFT);
                    celda.setBorder(PdfPCell.NO_BORDER);
                    tabla.addCell(celda);

                    Object nuevo9[] = { "Utilidad del proyecto", "", "$ "
                            + df.format(proyectoval - total - total2 - total3 - total4).replace(",", ".") };
                    for (Object obj : nuevo9) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                        celda.setColspan(1);
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }
                    Object nuevo10[] = { "Rentabilidad ", "", df.format(porcent).replace(",", ".") + " %" };
                    for (Object obj : nuevo10) {
                        celda = new PdfPCell(new Paragraph((String) obj, new Font(fontpersonalizado)));
                        celda.setBorder(PdfPCell.NO_BORDER);
                        celda.setColspan(1);
                        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
                        tabla.addCell(celda);
                    }

                    salto = new PdfPTable(1);
                    casilla = new PdfPCell(new Phrase("", new Font(fontpersonalizado)));
                    casilla.setMinimumHeight(90);
                    casilla.setBorder(PdfPCell.NO_BORDER);
                    salto.addCell(casilla);
                    documento.add(salto);

                    documento.add(tabla);

                    /*Fin Parte 3*/
                    documento.close();
                    helper.cerrarSesion();
                } catch (Exception ex) {
                    documento.close();
                }
                JOptionPane.showMessageDialog(null, "PDF Generado");
            } catch (Exception io) {
                System.out.println(io);
            }
        }
    });
    f.getjTable1().addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int row = f.getjTable1().getSelectedRow();
            int col = f.getjTable1().getSelectedColumn();
            if (col == 4) {
                f2.setVisible(true);
                f.setVisible(false);
                idcliente = f.getjTable1().getValueAt(row, 5).toString();
                idinstalacion = f.getjTable1().getValueAt(row, 6).toString();
                f2.getjLabel15().setText(f.getjTable1().getValueAt(row, 0).toString());
                f2.getjLabel8().setText(f.getjTable1().getValueAt(row, 2).toString());
                nombrecliente = f.getjTable1().getValueAt(row, 0).toString();
                nombreinstalacion = f.getjTable1().getValueAt(row, 2).toString();
                updateTablas up = new updateTablas(1);
                up.start();
            }
        }
    });
    f5.getjComboBox1().addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            DefaultTableModel temp2 = (DefaultTableModel) f5.getjTable2().getModel();
            for (int i = temp2.getRowCount() - 1; i >= 0; i--) {
                temp2.removeRow(i);
            }
            f5.setComi(null);
            f5.setNinstalacion("");
            f5.setNcliente("");
            f5.setList(null);
            f5.setId("");
            updateTablas up = new updateTablas(4);
            up.start();
        }
    });
    f3.getjTable1().addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int row = f3.getjTable1().getSelectedRow();
            int col = f3.getjTable1().getSelectedColumn();
            if (col == 6) {
                visible(f4);
                fcomisiones = f3.getjTable1().getValueAt(row, 6).toString();
                try {
                    ServiceHb helper = new ServiceHb();
                    helper.iniciarTransaccion();
                    Fcomisiones ft = (Fcomisiones) helper.obtenerObjeto(Fcomisiones.class,
                            Integer.parseInt(fcomisiones));
                    numeroinstala = ft.getDias();
                    f4.setIdcliente("" + ft.getClientes().getId());
                    f4.setIdinstalacion("" + ft.getInstalacion().getId());
                    f4.getDiasint().setText(numeroinstala);
                    helper.cerrarSesion();
                } catch (Exception io) {

                }
                f4.getjLabel1().setText(fcomisiones);
                f4.getC1().setText(f3.getjTable1().getValueAt(row, 0).toString());
                f4.getC2().setText(f3.getjTable1().getValueAt(row, 1).toString());
                double campo1 = Double
                        .parseDouble(f3.getjTable1().getValueAt(row, 3).toString().replace("$ ", ""));
                double campo2 = Double
                        .parseDouble(f3.getjTable1().getValueAt(row, 4).toString().replace("-$ ", ""));
                f4.getC3().setText(f3.getjTable1().getValueAt(row, 3).toString());
                f4.getC4().setText(f3.getjTable1().getValueAt(row, 4).toString());
                f4.getC5().setText(f3.getjTable1().getValueAt(row, 5).toString());
                f4.getC6().setText("$ " + df.format((campo1 - campo2)).replace(",", "."));

                updateTablas up = new updateTablas(3);
                up.start();
            }
        }
    });

    setVisible(false);
}

From source file:main.ItextPDF.java

public void createPdf(String filename, Person person) {
    // step 1/*from w w w .  j  av  a  2  s .c  om*/
    Document document = new Document();
    // step 2
    try {
        PdfWriter.getInstance(document, new FileOutputStream(filename));
        // step 3
        document.open();

        BaseFont bf_ru = BaseFont.createFont(FONT_RU, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        Font font_ru = new Font(bf_ru, 10);
        BaseFont bf_ch = BaseFont.createFont(FONT_CH, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        Font font_ch = new Font(bf_ch, 10);
        ResourceBundle rb_ch = ResourceBundle.getBundle("bundles/lang", Locale.CHINA);
        ResourceBundle rb_ru = ResourceBundle.getBundle("bundles/lang", Locale.GERMANY);
        //
        Paragraph preface = new Paragraph(rb_ch.getString("pdfFileheder1"), font_ch);
        preface.setAlignment(Element.ALIGN_CENTER);
        document.add(preface);

        preface = new Paragraph(rb_ru.getString("pdfFileheder1"), font_ru);
        preface.setAlignment(Element.ALIGN_CENTER);
        document.add(preface);
        document.add(new Phrase(rb_ch.getString("pdfFileheder2"), font_ch));
        document.add(new Phrase(rb_ru.getString("pdfFileheder2"), font_ru));
        Phrase pr = new Phrase("\n ");
        pr.add(new Phrase(rb_ch.getString("part1"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part1"), font_ru));

        document.add(pr);

        PdfPTable basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);

        PdfPTable table1 = new PdfPTable(4);
        pr = new Phrase(rb_ch.getString("nameDesc"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("nameDesc"), font_ru));
        PdfPCell cell = new PdfPCell(pr);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setRowspan(3);
        table1.addCell(cell);

        //line 1
        //PdfPTable table2 = new PdfPTable(2);
        pr = new Phrase(rb_ch.getString("lastname"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("lastname"), font_ru));
        PdfPCell cell1 = new PdfPCell(pr);
        PdfPCell cell2 = new PdfPCell(new Paragraph(person.getField1()));
        cell2.setColspan(2);
        table1.addCell(cell1);
        table1.addCell(cell2);

        pr = new Phrase(rb_ch.getString("fathername"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("fathername"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField2()));
        table1.addCell(cell1);
        cell2.setColspan(2);
        table1.addCell(cell2);

        pr = new Phrase(rb_ch.getString("firstname"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("firstname"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField3()));
        table1.addCell(cell1);
        cell2.setColspan(2);
        table1.addCell(cell2);
        //basetable.addCell(table1);
        //basetable.addCell(table2);
        ///line 2 1.2 1.3
        //table1 = new PdfPTable(4);

        pr = new Phrase(rb_ch.getString("chinaseName"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("chinaseName"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField4()));
        table1.addCell(cell1);
        table1.addCell(cell2);

        pr = new Phrase(rb_ch.getString("othername"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("othername"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField5()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.4 1.5
        pr = new Phrase(rb_ch.getString("sex"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("sex"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField6() + " " + person.getField7()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("databirth"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("databirth"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Phrase();
        pr.add(new Phrase(person.getField8()));
        pr.add(new Phrase("/"));
        pr.add(new Phrase(person.getField9()));
        pr.add(new Phrase("/"));
        pr.add(new Phrase(person.getField10()));
        cell2 = new PdfPCell(pr);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.6 1.7
        pr = new Phrase(rb_ch.getString("citizen"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("citizen"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField11()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("old_citizen_of"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("old_citizen_of"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField12()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.8
        pr = new Phrase(rb_ch.getString("birthplace"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("birthplace"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField13()));
        cell1.setColspan(2);
        table1.addCell(cell1);
        cell2.setColspan(2);
        table1.addCell(cell2);
        //1.9
        pr = new Phrase(rb_ch.getString("passportData"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportData"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField14()));
        cell1.setColspan(2);
        table1.addCell(cell1);
        cell2.setColspan(2);
        table1.addCell(cell2);
        //1.10
        pr = new Phrase(rb_ch.getString("passportType"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportType"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Phrase(person.getField15() + " " + person.getField16() + " " + person.getField17() + " "
                + person.getField18() + " " + person.getField19(), font_ru);
        cell2 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        cell2.setColspan(2);
        table1.addCell(cell2);
        //1.11 1.12
        pr = new Phrase(rb_ch.getString("passportNumber"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportNumber"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField20()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("passportGivenDate"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportGivenDate"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(
                new Paragraph(person.getField21() + "/" + person.getField22() + "/" + person.getField23()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.13 1.14
        pr = new Phrase(rb_ch.getString("passportGivenPlace"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportGivenPlace"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(person.getField24()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("passportValidDate"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportValidDate"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(
                new Paragraph(person.getField25() + "/" + person.getField26() + "/" + person.getField27()));
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.15
        pr = new Phrase(rb_ch.getString("passportProfession"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("passportProfession"), font_ru));
        cell1 = new PdfPCell(pr);
        /*cell2 = new PdfPCell(new Paragraph(
                person.getField28() + " " +
                person.getField29() + " " +
                person.getField30()
                ));*/
        table1.addCell(cell1);
        //table1.addCell(cell2);
        //cell2 = new PdfPCell(new Paragraph(rs.getString("FIELD" + 16)));
        PdfPTable innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("profession1"), font_ch);
        if (!person.getField28().equals("")) {
            pr.add(new Phrase("                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession1"), font_ru));

        PdfPCell innercell = new PdfPCell(pr);

        //innercell.setBorder(Rectangle.BOTTOM);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession10"), font_ch);
        if (!person.getField37().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField38(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession10"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.LEFT);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession2"), font_ch);
        if (!person.getField29().equals("")) {
            pr.add(new Phrase("                             "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession2"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.BOTTOM);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession11"), font_ch);
        if (!person.getField39().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField40(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession11"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.LEFT);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession3"), font_ch);
        if (!person.getField30().equals("")) {
            pr.add(new Phrase("                             "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession3"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.RIGHT);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession12"), font_ch);
        if (!person.getField41().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField42(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession12"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.NO_BORDER);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession4"), font_ch);
        if (!person.getField31().equals("")) {
            pr.add(new Phrase("                           "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession4"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.RIGHT);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession13"), font_ch);
        if (!person.getField43().equals("")) {
            pr.add(new Phrase("                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession13"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.NO_BORDER);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession5"), font_ch);
        if (!person.getField32().equals("")) {
            pr.add(new Phrase("                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession5"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.RIGHT);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession14"), font_ch);
        if (!person.getField44().equals("")) {
            pr.add(new Phrase("                                          "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession14"), font_ru));
        innercell = new PdfPCell(pr);
        //innercell.setBorder(Rectangle.NO_BORDER);
        innertable.addCell(innercell);

        pr = new Phrase(rb_ch.getString("profession6"), font_ch);
        if (!person.getField33().equals("")) {
            pr.add(new Phrase("                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }

        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession6"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("profession15"), font_ch);
        if (!person.getField45().equals("")) {
            pr.add(new Phrase("                                 "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession15"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("profession7"), font_ch);
        if (!person.getField34().equals("")) {
            pr.add(new Phrase("                                        "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession7"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase("");
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("profession8"), font_ch);
        if (!person.getField35().equals("")) {
            pr.add(new Phrase("                                        "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession8"), font_ru));
        innertable.addCell(pr);
        pr = new Phrase("");
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("profession9"), font_ch);
        if (!person.getField36().equals("")) {
            pr.add(new Phrase("                                        "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession9"), font_ru));
        innertable.addCell(pr);
        pr = new Phrase("");
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("profession16"), font_ch);
        if (!person.getField173().equals("")) {
            pr.add(new Phrase("                                        "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase(person.getField174(), font_ru));
            pr.add(new Phrase("\n"));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("profession16"), font_ru));
        innertable.addCell(pr);
        pr = new Phrase("");
        innertable.addCell(pr);

        cell2.setColspan(3);
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //1.16
        pr = new Phrase(rb_ch.getString("education"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("education"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(""));
        cell1.setColspan(1);
        table1.addCell(cell1);

        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("education1"), font_ch);
        if (!person.getField46().equals("")) {
            pr.add(new Phrase("                                   "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("education1"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("education2"), font_ch);
        if (!person.getField47().equals("")) {
            pr.add(new Phrase("                                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("education2"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("education3"), font_ch);
        if (!person.getField48().equals("")) {
            pr.add(new Phrase("           "));
            pr.add(new Phrase(person.getField49(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("education3"), font_ru));
        innertable.addCell(pr);

        innertable.addCell(new Phrase());

        cell2.setColspan(3);
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //1.17
        pr = new Phrase(rb_ch.getString("workPlace"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("workPlace"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(""));
        cell1.setColspan(1);
        table1.addCell(cell1);

        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("workPlace1"), font_ch);
        if (!person.getField50().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField50(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("workPlace1"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("workPlace2"), font_ch);
        if (!person.getField51().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField51(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("workPlace2"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("workPlace3"), font_ch);
        if (!person.getField52().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField52(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("workPlace3"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("workPlace4"), font_ch);
        if (!person.getField53().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField53(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("workPlace4"), font_ru));
        innertable.addCell(pr);

        cell2.setColspan(3);
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //
        PdfPCell tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        //
        document.add(basetable);

        //////////////////////////////////////////////////////////page2
        basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);
        table1 = new PdfPTable(4);
        //1.18 1.19
        pr = new Phrase(rb_ch.getString("homeAddr"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("homeAddr"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Paragraph("");
        if (!person.getField54().equals("")) {
            pr.add(new Phrase(person.getField54(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("zipCode"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("zipCode"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Paragraph("");
        if (!person.getField55().equals("")) {
            pr.add(new Phrase(person.getField55(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.20 1.21
        pr = new Phrase(rb_ch.getString("phoneNum"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("phoneNum"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Paragraph("");
        if (!person.getField56().equals("")) {
            pr.add(new Phrase(person.getField56(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("email"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("email"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Paragraph("");
        if (!person.getField57().equals("")) {
            pr.add(new Phrase(person.getField57(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //1.22
        pr = new Phrase(rb_ch.getString("familyStatus"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("familyStatus"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        pr = new Phrase(" ");
        if (!person.getField66().equals("")) {
            pr.add(new Phrase(rb_ru.getString("familyStatus1"), font_ru));
            pr.add(new Phrase(" "));
        }
        if (!person.getField67().equals("")) {
            pr.add(new Phrase(rb_ru.getString("familyStatus2"), font_ru));
            pr.add(new Phrase(" "));
        }
        if (!person.getField68().equals("")) {
            pr.add(new Phrase(rb_ru.getString("familyStatus3"), font_ru));
            pr.add(new Phrase(" "));
            pr.add(new Phrase(person.getField69(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        cell2.setColspan(3);
        table1.addCell(cell2);

        /*tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);*/
        //1.23
        pr = new Phrase(rb_ch.getString("familyStaff"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("familyStaff"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        innertable = new PdfPTable(4);
        innertable.setWidthPercentage(100);
        pr = new Phrase(rb_ch.getString("familyStaff1"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("familyStaff1"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("familyStaff2"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("familyStaff2"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("familyStaff3"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("familyStaff3"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("familyStaff4"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("familyStaff4"), font_ru));
        innertable.addCell(pr);

        //add 4 empty row
        //for(int l =0 ; l < 16; l++){
        innertable.addCell(new Phrase(person.getField58(), font_ru));
        innertable.addCell(new Phrase(person.getField59(), font_ru));
        innertable.addCell(new Phrase(person.getField60(), font_ru));
        innertable.addCell(new Phrase(person.getField61(), font_ru));

        innertable.addCell(new Phrase(person.getField62(), font_ru));
        innertable.addCell(new Phrase(person.getField63(), font_ru));
        innertable.addCell(new Phrase(person.getField64(), font_ru));
        innertable.addCell(new Phrase(person.getField65(), font_ru));

        innertable.addCell(new Phrase(person.getField66(), font_ru));
        innertable.addCell(new Phrase(person.getField67(), font_ru));
        innertable.addCell(new Phrase(person.getField68(), font_ru));
        innertable.addCell(new Phrase(person.getField69(), font_ru));

        innertable.addCell(new Phrase(person.getField70(), font_ru));
        innertable.addCell(new Phrase(person.getField71(), font_ru));
        innertable.addCell(new Phrase(person.getField72(), font_ru));
        innertable.addCell(new Phrase(person.getField73(), font_ru));
        //}

        tcell = new PdfPCell(innertable);
        tcell.setColspan(3);
        table1.addCell(tcell);
        //1.24
        pr = new Phrase(rb_ch.getString("contactPerson"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("contactPerson"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);
        pr = new Phrase(rb_ch.getString("contactPerson1"), font_ch);
        if (!person.getField74().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField74(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("contactPerson1"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("contactPerson2"), font_ch);
        if (!person.getField75().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField75(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("contactPerson2"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("contactPerson3"), font_ch);
        if (!person.getField76().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField76(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("contactPerson3"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(" ");
        innertable.addCell(pr);

        tcell = new PdfPCell(innertable);
        tcell.setColspan(3);
        table1.addCell(tcell);
        //1.25
        pr = new Phrase(rb_ch.getString("visitedPlace"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("visitedPlace"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField77().equals("")) {
            pr.add(new Phrase("    "));
            pr.add(new Phrase(person.getField77(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        cell2.setColspan(2);
        table1.addCell(cell2);

        //
        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        //////////////////////////////////////////////

        document.add(basetable);

        ///////////////////////////////////////part2
        pr = new Phrase("\n");
        pr.add(new Phrase(rb_ch.getString("part2Title"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part2Title"), font_ru));
        pr.add(new Phrase("\n"));
        document.add(pr);
        //2.1
        basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);
        table1 = new PdfPTable(2);
        table1.setWidths(new int[] { 1, 5 });

        pr = new Phrase(rb_ch.getString("travelPurpose"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setRowspan(6);
        table1.addCell(cell1);

        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("travelPurpose1"), font_ch);

        if (!person.getField78().equals("")) {
            pr.add(new Phrase("                                               "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose1"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose8"), font_ch);
        if (!person.getField79().equals("")) {
            pr.add(new Phrase("                                    "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose8"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose2"), font_ch);
        if (!person.getField80().equals("")) {
            pr.add(new Phrase("                                                       "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose2"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose9"), font_ch);
        if (!person.getField82().equals("")) {
            pr.add(new Phrase("                                         "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose9"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose3"), font_ch);
        if (!person.getField81().equals("")) {
            pr.add(new Phrase("                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose3"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose10"), font_ch);
        if (!person.getField84().equals("")) {
            pr.add(new Phrase("                                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose10"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose4"), font_ch);
        if (!person.getField83().equals("")) {
            pr.add(new Phrase("                                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose4"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose11"), font_ch);
        if (!person.getField86().equals("")) {
            pr.add(new Phrase("                                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose11"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose5"), font_ch);
        if (!person.getField85().equals("")) {
            pr.add(new Phrase("                                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose5"), font_ru));
        innertable.addCell(pr);
        innertable.addCell(new Phrase(" "));

        pr = new Phrase(rb_ch.getString("travelPurpose6"), font_ch);

        if (!person.getField87().equals("")) {
            pr.add(new Phrase("                                              "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose6"), font_ru));
        innertable.addCell(pr);
        innertable.addCell(new Phrase(" "));

        pr = new Phrase(rb_ch.getString("travelPurpose7"), font_ch);

        if (!person.getField88().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose7"), font_ru));
        innertable.addCell(pr);
        innertable.addCell(new Phrase(" "));

        innertable.addCell(new Phrase());
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //
        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("travelPurpose12"), font_ch);
        if (!person.getField89().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose12"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose13"), font_ch);
        if (!person.getField90().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose13"), font_ru));
        innertable.addCell(pr);
        /*for(int j=12; j < 14; j++){
            pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch);
            pr.add(new Phrase(" "));
            pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru));
            innertable.addCell(pr);
        }*/
        cell2 = new PdfPCell(new Phrase(""));
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //
        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        /*for(int j=14; j < 16; j++){
            pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch);
            pr.add(new Phrase(" "));
            pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru));
            innertable.addCell(pr);
        }*/
        pr = new Phrase(rb_ch.getString("travelPurpose14"), font_ch);
        if (!person.getField91().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose14"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose15"), font_ch);
        if (!person.getField92().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose15"), font_ru));
        innertable.addCell(pr);

        cell2 = new PdfPCell(new Phrase(""));
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //
        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("travelPurpose16"), font_ch);
        if (!person.getField93().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose16"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose17"), font_ch);
        if (!person.getField94().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose17"), font_ru));
        innertable.addCell(pr);
        /*for(int j=16; j < 18; j++){
            pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch);
            pr.add(new Phrase(" "));
            pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru));
            innertable.addCell(pr);
        }*/
        cell2 = new PdfPCell(new Phrase(""));
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //
        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        /*for(int j=18; j < 20; j++){
            pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch);
            pr.add(new Phrase(" "));
            pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru));
            innertable.addCell(pr);
        }*/
        pr = new Phrase(rb_ch.getString("travelPurpose18"), font_ch);
        if (!person.getField95().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose18"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("travelPurpose19"), font_ch);
        if (!person.getField96().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose19"), font_ru));
        innertable.addCell(pr);

        cell2 = new PdfPCell(new Phrase(""));
        cell2.addElement(innertable);
        table1.addCell(cell2);
        //
        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);

        pr = new Phrase(rb_ch.getString("travelPurpose20"), font_ch);
        if (!person.getField97().equals("")) {
            pr.add(new Phrase("          "));
            pr.add(new Phrase(person.getField98(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("travelPurpose20"), font_ru));
        PdfPCell innerCell2 = new PdfPCell(pr);
        innerCell2.setColspan(2);
        innertable.addCell(innerCell2);

        cell2 = new PdfPCell(new Phrase(""));
        cell2.addElement(innertable);
        table1.addCell(cell2);
        ///2.2
        pr = new Phrase(rb_ch.getString("planingTravel"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("planingTravel"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase(rb_ch.getString("planingTravel1"), font_ch);
        if (!person.getField99().equals("")) {
            pr.add(new Phrase("                                                                 "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("planingTravel1"), font_ru));
        pr.add(new Phrase("\n \n"));

        pr.add(new Phrase(rb_ch.getString("planingTravel2"), font_ch));
        if (!person.getField100().equals("")) {
            pr.add(new Phrase("                                                           "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("planingTravel2"), font_ru));
        pr.add(new Phrase("\n \n"));

        pr.add(new Phrase(rb_ch.getString("planingTravel3"), font_ch));
        if (!person.getField101().equals("")) {
            pr.add(new Phrase("                                                      "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("planingTravel3"), font_ru));
        pr.add(new Phrase("\n \n"));

        pr.add(new Phrase(rb_ch.getString("planingTravel4"), font_ch));
        if (!person.getField102().equals("")) {
            pr.add(new Phrase("                                                        "));
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("planingTravel4"), font_ru));
        pr.add(new Phrase("\n \n"));

        pr.add(new Phrase(rb_ch.getString("planingTravel5"), font_ch));
        if (!person.getField103().equals("")) {
            pr.add(new Phrase("                   "));
            pr.add(new Phrase(person.getField104(), font_ch));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("planingTravel5"), font_ru));
        pr.add(new Phrase("\n \n"));
        cell2 = new PdfPCell(pr);

        table1.addCell(cell2);

        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        /////////////////////////////////////
        table1 = new PdfPTable(2);
        table1.setWidths(new int[] { 4, 1 });
        pr = new Phrase(rb_ch.getString("fastService"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("fastService"), font_ru));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ch.getString("fastService2"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("fastService2"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField144().equals("")) {
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        if (!person.getField105().equals("")) {
            pr.add(new Phrase(rb_ch.getString("no"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("no"), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell2);

        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        document.add(basetable);
        //////////////////////////////////////////////////////////page3
        basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);
        table1 = new PdfPTable(3);
        table1.setWidths(new int[] { 1, 1, 1 });
        //2.4 2.5
        pr = new Phrase(rb_ch.getString("dataSuggestion"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("dataSuggestion"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(""));
        cell1.setColspan(2);
        table1.addCell(cell1);
        table1.addCell(cell2);
        pr = new Phrase(rb_ch.getString("dataViseted"), font_ch);
        if (!person.getField106().equals("")) {
            pr.add(new Phrase("        "));
            pr.add(new Phrase(person.getField106(), font_ch));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("dataViseted"), font_ru));
        cell1 = new PdfPCell(pr);
        cell2 = new PdfPCell(new Paragraph(""));
        cell1.setColspan(2);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //2.6
        pr = new Phrase(rb_ch.getString("marshrut"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("marshrut"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        innertable = new PdfPTable(2);
        innertable.setWidthPercentage(100);
        pr = new Phrase(rb_ch.getString("date"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("date"), font_ru));
        innertable.addCell(pr);

        pr = new Phrase(rb_ch.getString("addressMore"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("addressMore"), font_ru));
        innertable.addCell(pr);

        //add 4 empty row
        /*for(int l =0 ; l < 10; l++){
            innertable.addCell(new Phrase(" "));
        }*/
        pr = new Phrase("");
        if (!person.getField107().equals("")) {
            pr.add(new Phrase(person.getField107(), font_ru));
        }
        if (!person.getField108().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField108(), font_ru));
        }
        if (!person.getField109().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField109(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField110().equals("")) {
            pr.add(new Phrase(person.getField110(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField111().equals("")) {
            pr.add(new Phrase(person.getField111(), font_ru));
        }
        if (!person.getField112().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField112(), font_ru));
        }
        if (!person.getField113().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField113(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField114().equals("")) {
            pr.add(new Phrase(person.getField114(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField115().equals("")) {
            pr.add(new Phrase(person.getField115(), font_ru));
        }
        if (!person.getField116().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField116(), font_ru));
        }
        if (!person.getField117().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField117(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField118().equals("")) {
            pr.add(new Phrase(person.getField118(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField119().equals("")) {
            pr.add(new Phrase(person.getField119(), font_ru));
        }
        if (!person.getField120().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField120(), font_ru));
        }
        if (!person.getField121().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField121(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField122().equals("")) {
            pr.add(new Phrase(person.getField122(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField123().equals("")) {
            pr.add(new Phrase(person.getField123(), font_ru));
        }
        if (!person.getField124().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField124(), font_ru));
        }
        if (!person.getField125().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField125(), font_ru));
        }
        innertable.addCell(pr);

        pr = new Phrase("");
        if (!person.getField126().equals("")) {
            pr.add(new Phrase(person.getField126(), font_ru));
        }
        innertable.addCell(pr);

        tcell = new PdfPCell(innertable);
        tcell.setColspan(2);
        table1.addCell(tcell);
        //2.7
        pr = new Phrase(rb_ch.getString("howpay"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("howpay"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Phrase("");
        if (!person.getField127().equals("")) {
            pr.add(new Phrase(person.getField127(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //2.8
        pr = new Phrase(rb_ch.getString("infoAboutVisit"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("infoAboutVisit"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setRowspan(4);
        table1.addCell(cell1);

        pr = new Phrase(rb_ch.getString("nazvanie"), font_ch);
        if (!person.getField128().equals("")) {
            pr.add(new Phrase(" "));
            pr.add(new Phrase(person.getField128(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("nazvanie"), font_ru));
        cell2 = new PdfPCell(pr);
        cell2.setColspan(2);
        table1.addCell(cell2);

        pr = new Phrase(rb_ch.getString("address"), font_ch);
        if (!person.getField129().equals("")) {
            pr.add(new Phrase(" "));
            pr.add(new Phrase(person.getField129(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("address"), font_ru));
        cell2 = new PdfPCell(pr);
        cell2.setColspan(2);
        table1.addCell(cell2);

        pr = new Phrase(rb_ch.getString("tel"), font_ch);
        if (!person.getField130().equals("")) {
            pr.add(new Phrase(" "));
            pr.add(new Phrase(person.getField130(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("tel"), font_ru));
        cell2 = new PdfPCell(pr);
        cell2.setColspan(2);
        table1.addCell(cell2);

        pr = new Phrase(rb_ch.getString("relation"), font_ch);
        if (!person.getField131().equals("")) {
            pr.add(new Phrase(" "));
            pr.add(new Phrase(person.getField131(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("relation"), font_ru));
        cell2 = new PdfPCell(pr);
        cell2.setColspan(2);
        table1.addCell(cell2);
        //2.9
        pr = new Phrase(rb_ch.getString("oldVisa"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("oldVisa"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Paragraph("");
        if (!person.getField132().equals("")) {
            pr.add(new Phrase(person.getField132(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //2.10
        pr = new Phrase(rb_ch.getString("otherViseted"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("otherViseted"), font_ru));
        cell1 = new PdfPCell(pr);
        pr = new Paragraph("");
        if (!person.getField133().equals("")) {
            pr.add(new Phrase(person.getField133(), font_ru));
        }
        cell2 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        table1.addCell(cell2);
        //
        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        /////////////////////////////////////
        document.add(basetable);

        ///////////////////////////////////////part3
        pr = new Phrase("\n");
        pr.add(new Phrase(rb_ch.getString("part3"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part3"), font_ru));
        pr.add(new Phrase("\n"));
        document.add(pr);
        //3.1
        basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);
        table1 = new PdfPTable(4);
        table1.setWidths(new int[] { 1, 1, 1, 1 });

        pr = new Phrase(rb_ch.getString("wrongVisit"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("wrongVisit"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(3);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField134().equals("")) {
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        if (!person.getField135().equals("")) {
            pr.add(new Phrase(rb_ch.getString("no"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("no"), font_ru));
        }

        cell2 = new PdfPCell(pr);
        table1.addCell(cell2);
        //3.2
        pr = new Phrase(rb_ch.getString("rejectedVisit"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("rejectedVisit"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(3);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField136().equals("")) {
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        if (!person.getField137().equals("")) {
            pr.add(new Phrase(rb_ch.getString("no"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("no"), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell2);
        //3.3
        pr = new Phrase(rb_ch.getString("sudimost"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("sudimost"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(3);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField138().equals("")) {
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        if (!person.getField139().equals("")) {
            pr.add(new Phrase(rb_ch.getString("no"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("no"), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell2);

        //3.4
        pr = new Phrase(rb_ch.getString("illness"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("illness"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(3);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField140().equals("")) {
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        if (!person.getField141().equals("")) {
            pr.add(new Phrase(rb_ch.getString("no"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("no"), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell2);

        //3.5
        pr = new Phrase(rb_ch.getString("ilnessContry"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("ilnessContry"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(3);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField142().equals("")) {
            pr.add(new Phrase(rb_ch.getString("yes"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("yes"), font_ru));
        }
        if (!person.getField143().equals("")) {
            pr.add(new Phrase(rb_ch.getString("no"), font_ch));
            pr.add(new Phrase("  "));
            pr.add(new Phrase(rb_ru.getString("no"), font_ru));
        }
        cell2 = new PdfPCell(pr);
        table1.addCell(cell2);
        //3.6
        pr = new Phrase(rb_ch.getString("ilnessContryMoreDesc"), font_ch);
        if (!person.getField145().equals("")) {
            pr.add(new Phrase(person.getField145(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("ilnessContryMoreDesc"), font_ru));

        cell1 = new PdfPCell(pr);
        cell1.setColspan(4);
        table1.addCell(cell1);
        //3.7
        pr = new Phrase(rb_ch.getString("ilnessContryOtherDesc"), font_ch);
        if (!person.getField146().equals("")) {
            pr.add(new Phrase(person.getField146(), font_ru));
        }
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("ilnessContryOtherDesc"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(4);
        table1.addCell(cell1);
        //3.8
        pr = new Phrase(rb_ch.getString("ilnessContryPersonData"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("ilnessContryPersonData"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(4);
        table1.addCell(cell1);
        //3.8.1
        pr = new Phrase(rb_ch.getString("info"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("info"), font_ru));
        pr.add(new Phrase("\n"));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //3.8.2
        pr = new Phrase(rb_ch.getString("person1"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("person1"), font_ru));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ch.getString("photo"), font_ch));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("photo"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //3.8.3
        pr = new Phrase(rb_ch.getString("person2"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("person2"), font_ru));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ch.getString("photo"), font_ch));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("photo"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //3.8.4
        pr = new Phrase(rb_ch.getString("person3"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("person3"), font_ru));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ch.getString("photo"), font_ch));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("photo"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //3.8.body
        //for(int i = 1; i< 4; i++){
        //fio
        pr = new Phrase(rb_ch.getString("part3.8_1"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part3.8_1"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField147().equals("")) {
            pr.add(new Phrase(person.getField147(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField148().equals("")) {
            pr.add(new Phrase(person.getField148(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField149().equals("")) {
            pr.add(new Phrase(person.getField149(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //sex
        pr = new Phrase(rb_ch.getString("part3.8_2"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part3.8_2"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField150().equals("")) {
            pr.add(new Phrase(person.getField150(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField151().equals("")) {
            pr.add(new Phrase(person.getField151(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField152().equals("")) {
            pr.add(new Phrase(person.getField152(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //
        pr = new Phrase(rb_ch.getString("part3.8_3"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part3.8_3"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        pr = new Phrase("");
        if (!person.getField153().equals("")) {
            pr.add(new Phrase(person.getField153(), font_ru));
        }
        if (!person.getField154().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField154(), font_ru));
        }
        if (!person.getField155().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField155(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField156().equals("")) {
            pr.add(new Phrase(person.getField156(), font_ru));
        }
        if (!person.getField157().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField157(), font_ru));
        }
        if (!person.getField158().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField158(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase("");
        if (!person.getField159().equals("")) {
            pr.add(new Phrase(person.getField159(), font_ru));
        }
        if (!person.getField160().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField160(), font_ru));
        }
        if (!person.getField161().equals("")) {
            pr.add(new Phrase("/"));
            pr.add(new Phrase(person.getField161(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //}
        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        document.add(basetable);
        //////////////////////////////////////part4
        pr = new Phrase("\n");
        pr.add(new Phrase(rb_ch.getString("part4"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part4"), font_ru));
        pr.add(new Phrase("\n"));
        document.add(pr);
        //4.1
        basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);
        table1 = new PdfPTable(2);
        table1.setWidths(new int[] { 1, 1 });

        pr = new Phrase(rb_ch.getString("part4.1"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part4.1"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);

        //4.2
        pr = new Phrase(rb_ch.getString("part4.2"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part4.2"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);

        //4.3
        pr = new Phrase(rb_ch.getString("part4.3"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part4.3"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        //4.4
        pr = new Phrase(rb_ch.getString("part4.4"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part4.4"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        pr = new Phrase(rb_ch.getString("part4.5"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part4.5"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //4.5
        pr = new Phrase(rb_ch.getString("part4.5"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part4.5"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        //
        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        //
        document.add(basetable);
        //////////////////////////////////////part5
        pr = new Phrase("\n");
        pr.add(new Phrase(rb_ch.getString("part5"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part5"), font_ru));
        pr.add(new Phrase("\n"));
        document.add(pr);

        basetable = new PdfPTable(2);
        basetable.setWidthPercentage(100);
        table1 = new PdfPTable(4);
        table1.setWidths(new int[] { 1, 1, 1, 1 });
        //5.1 5.2
        pr = new Phrase(rb_ch.getString("part5.1"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part5.1"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField162().equals("")) {
            pr.add(new Phrase("                "));
            pr.add(new Phrase(person.getField162(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase(rb_ch.getString("part5.2"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part5.2"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField163().equals("")) {
            pr.add(new Phrase("                "));
            pr.add(new Phrase(person.getField163(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //5.3 5.4
        pr = new Phrase(rb_ch.getString("part5.3"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part5.3"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField164().equals("")) {
            pr.add(new Phrase("                "));
            pr.add(new Phrase(person.getField164(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase(rb_ch.getString("part5.4"), font_ch);
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ru.getString("part5.4"), font_ru));
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);

        pr = new Phrase();
        if (!person.getField165().equals("")) {
            pr.add(new Phrase("                "));
            pr.add(new Phrase(person.getField165(), font_ru));
        }
        cell1 = new PdfPCell(pr);
        table1.addCell(cell1);
        //5.5
        pr = new Phrase(rb_ch.getString("part5.5"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part5.5"), font_ru));
        pr.add(new Phrase("\n"));
        pr.add(new Phrase(rb_ch.getString("part5.5.1"), font_ch));
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part5.5.1"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(4);
        table1.addCell(cell1);
        //5.5
        pr = new Phrase(rb_ch.getString("part5.6"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part5.6"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);

        pr = new Phrase(rb_ch.getString("part5.7"), font_ch);
        pr.add(new Phrase(" "));
        pr.add(new Phrase(rb_ru.getString("part5.7"), font_ru));
        cell1 = new PdfPCell(pr);
        cell1.setColspan(2);
        table1.addCell(cell1);
        //
        tcell = new PdfPCell(table1);
        tcell.setColspan(2);
        basetable.addCell(tcell);
        /////////////////////////////////////
        document.add(basetable);
    } catch (Exception e) {
        System.err.println(e.getClass().getName() + ": " + e.getMessage());
        System.exit(0);
    }

    // step 5
    document.close();
    //
}

From source file:Measurment_Result_Record.MeasurmentSetup.java

/**
 *  write the given table datas to the given document
 * @param doc  document to write the result tables on
 * @param table  the result table //  w  w  w  .  ja  v  a2  s  . c o  m
 * @param m_title   the measurment title
 */
public static void addResultTablesTotheDocument(Document doc, JTable table, String m_title)
        throws DocumentException {
    //add the measurment title and table
    Paragraph measurmenttitle = new Paragraph(m_title + "\n ");
    measurmenttitle.getFont().setStyle(com.itextpdf.text.Font.BOLD);
    doc.add(measurmenttitle);

    int colmWidth = table.getColumnCount();
    int rowCount = table.getModel().getRowCount();
    PdfPTable resultTable = new PdfPTable(colmWidth);
    resultTable.setHorizontalAlignment(Element.ALIGN_LEFT);

    //add the table headers
    for (int i = 0; i < colmWidth; i++) {
        String headertext = table.getModel().getColumnName(i);
        PdfPCell cell = new PdfPCell(new Paragraph(headertext));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
        cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
        resultTable.addCell(cell);
    }

    //add the table body

    for (int r = 0; r < rowCount; r++) {
        for (int c = 0; c < colmWidth; c++) {
            String data = table.getValueAt(r, c).toString();
            resultTable.addCell(data);
        }
    }

    resultTable.setSpacingAfter(10);
    //add the table to the document
    doc.add(resultTable);

}

From source file:Model.Emprestimo.java

private void resultado() {
    Document documento = new Document();
    Livro l;/*w  w  w .ja  v a2  s  .  c  o  m*/
    try {
        PdfWriter.getInstance(documento, new FileOutputStream("Emprestimo" + id() + ".pdf"));
    } catch (DocumentException ex) {
        Logger.getLogger(Emprestimo.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
        Logger.getLogger(Emprestimo.class.getName()).log(Level.SEVERE, null, ex);
    }
    documento.open();

    try {
        Paragraph pa = new Paragraph();
        Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 28, Font.BOLD, new BaseColor(0, 0, 225));
        pa.setFont(fonte);
        pa.setAlignment(Element.ALIGN_CENTER);
        pa.setSpacingAfter(50);
        pa.add("Emprestimo");
        documento.add(pa);
        fonte = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD, new BaseColor(0, 0, 0));
        pa = new Paragraph();
        pa.setFont(fonte);
        pa.setAlignment(Element.ALIGN_LEFT);
        pa.add("id: " + Integer.toString(id()));
        documento.add(pa);
        pa = new Paragraph();
        pa.setFont(fonte);
        pa.setAlignment(Element.ALIGN_LEFT);
        pa.add("ra: " + Integer.toString(this.getRa()));
        documento.add(pa);
        String lin = "";
        String[] h = this.Livros.split("/");
        for (int c = 0; c < h.length; c++) {
            l = new Livro();
            l.consultar(Integer.parseInt(h[c]));
            lin = lin + l.getNome() + "\n";
        }
        pa = new Paragraph();
        pa.setFont(fonte);
        pa.setAlignment(Element.ALIGN_LEFT);
        pa.add("Livros: " + lin);
        documento.add(pa);
        pa = new Paragraph();
        pa.setFont(fonte);
        pa.setAlignment(Element.ALIGN_LEFT);
        pa.add("Data de Realizao: " + this.dataR);
        documento.add(pa);
        pa = new Paragraph();
        pa.setFont(fonte);
        pa.setAlignment(Element.ALIGN_LEFT);
        pa.add("Data de Devoluo: " + this.dataD);
        documento.add(pa);
    } catch (DocumentException ex) {
        Logger.getLogger(Emprestimo.class.getName()).log(Level.SEVERE, null, ex);
    }
    documento.close();
}

From source file:Model.GerarRelatorio.java

private void preencheNomeColuna() {
    toParagraphs("\n", Element.ALIGN_LEFT);
    toParagraphs("\n", Element.ALIGN_LEFT);
    for (int x = 0; x < columnName.length; x++) {
        insertCell(pdfPTable, columnName[x], Element.ALIGN_LEFT, 1, tableHeader);
    }//  w  ww  . j  a v  a 2  s.  c  o m
}

From source file:Model.GerarRelatorio.java

public void preenche() throws ParseException {
    MainFrameSLM.getInstance().getStatusBar().setProcesso("Realizando a consulta");
    ArrayList<HashMap> registros = new RelatorioDB().getRegistros(relatorio.getSelect(), restricoes, orderBy);
    int contadorDePreenchimento = 0;
    MainFrameSLM.getInstance().getStatusBar().setProcesso("Montando o relatrio");
    for (int x = 0; x < registros.size(); x++) {
        registros.get(x).entrySet().toArray();
        while (contadorDePreenchimento < columnswidth.length) {
            for (Object registro : registros.get(x).entrySet().toArray()) {
                String temp = registro.toString();
                int separador = temp.indexOf("=");
                String temp2 = temp.substring(0, separador);
                String temp3 = temp.substring(separador + 1, temp.length());
                if (getNmAtributo(temp2).equalsIgnoreCase(columnName[contadorDePreenchimento])) {
                    if (temp.contains("DT")) {
                        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
                        insertCell(pdfPTable, sdf.format(new Date(Timestamp.valueOf(temp3).getTime())),
                                Element.ALIGN_LEFT, 1, tableContent);
                    } else {
                        insertCell(pdfPTable, temp3.equalsIgnoreCase("null") ? "" : temp3, Element.ALIGN_LEFT,
                                1, tableContent);
                    }/*from   w w w. j  a v  a 2s.c o  m*/
                    contadorDePreenchimento++;
                }
                if (contadorDePreenchimento >= columnswidth.length) {
                    break;
                }
            }
        }
        contadorDePreenchimento = 0;
    }

    /*for (OrdemDeServico os : ordens) {
     String ordem = null;
     JFormattedTextField jft = new JFormattedTextField();
     MaskFormatter maskFormatter = new MaskFormatter(new Utilidades().mascaraOrdem(os.getNumeroOrdem()));
     maskFormatter.install(jft);
     jft.setText(String.valueOf(os.getNumeroOrdem()));
     ordem = jft.getText();
     SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
     insertCell(pdfPTable, ordem, Element.ALIGN_LEFT, 1, tableContent);
     insertCell(pdfPTable, sdf.format(os.getDataEmissao()), Element.ALIGN_LEFT, 1, tableContent);
     insertCell(pdfPTable, os.getServicosAExecutar(), Element.ALIGN_LEFT, 1, tableContent);
     double valor = 0;
     for (MaoDeObra mao : os.getMaoDeObra()) {
     valor += mao.getQtd();
     }
     String Metragem = String.valueOf(valor);
     Metragem = Metragem.replace(".", ",");
     insertCell(pdfPTable, Metragem, Element.ALIGN_LEFT, 1, tableContent);
     for (Equipe equipe : equipes) {
     if (equipe.getId() == os.getEquipe()) {
     insertCell(pdfPTable, equipe.getNomeEquipe(), Element.ALIGN_LEFT, 1, tableContent);
     break;
     }
     }
     insertCell(pdfPTable, os.getObs(), Element.ALIGN_LEFT, 1, tableContent);
            
     }*/
    Paragraph p = new Paragraph();
    pdfPTable.setWidthPercentage(100);
    p.add(pdfPTable);
    paragrafos.add(p);
}

From source file:Model.GerarRelatorio.java

public void dateHeader() {
    Font fonte = new Font(FontFamily.TIMES_ROMAN, 10);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm");
    toParagraphs(sdf.format(new Date(System.currentTimeMillis())), Element.ALIGN_RIGHT, fonte);
    toParagraphs("\n", Element.ALIGN_LEFT);
    fonte = new Font(FontFamily.TIMES_ROMAN, 15, Font.BOLD);
    toParagraphs("Santos Engenharia", Element.ALIGN_LEFT, fonte);
    toParagraphs("\n", Element.ALIGN_CENTER);
    fonte = new Font(FontFamily.TIMES_ROMAN, 15);
    toParagraphs(relatorio.getNmRelatorio(), Element.ALIGN_CENTER, fonte);
    toParagraphs("\n", Element.ALIGN_CENTER);
    sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm");
    toParagraphs("Data: " + (sdf.format(new Date(System.currentTimeMillis()))), Element.ALIGN_LEFT);

}