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

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

Introduction

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

Prototype

public PdfPCell(PdfPCell cell) 

Source Link

Document

Constructs a deep copy of a PdfPCell.

Usage

From source file:com.udec.utilidades.PdfTable.java

public PdfPTable tabla3(List<Nomina> no) throws DocumentException {
    //Instanciamos una tabla de 3 columnas
    PdfPTable tabla = new PdfPTable(4);
    tabla.setWidthPercentage(100);// w  w  w  .  j  a v  a 2 s. com
    tabla.setWidths(new float[] { 1, 3, 1, 1 });
    //Declaramos un objeto para manejar las celdas
    PdfPCell celda;
    celda = new PdfPCell(new Phrase("CODIGO"));
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    celda.setBorder(Rectangle.BOTTOM);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderWidth(1);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase("DESCRIPCION"));
    celda.setBorder(Rectangle.BOTTOM);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderWidth(1);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase("VLR.DEVEN"));
    celda.setBorder(Rectangle.BOTTOM);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderWidth(1);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    celda.setBorderWidth(1);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase("VLR.DEDUC"));
    celda.setBorder(Rectangle.BOTTOM);
    celda.setVerticalAlignment(Element.ALIGN_TOP);
    celda.setBorderWidth(1);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    tabla.addCell(celda);
    double totalDev = 0, totalDed = 0;
    for (Nomina nomina : no) {
        celda = new PdfPCell(new Phrase("" + nomina.getConceptoIdconcepto().getCodigo()));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        tabla.addCell(celda);
        celda = new PdfPCell(new Phrase("" + nomina.getConceptoIdconcepto().getConcepto()));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
        tabla.addCell(celda);
        if (nomina.getConceptoIdconcepto().getTipo().equals("DEVENGADO")) {
            totalDev += nomina.getValor();
            celda = new PdfPCell(new Phrase("" + nomina.getValor()));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
            tabla.addCell(celda);
        } else {
            celda = new PdfPCell(new Phrase(""));
            celda.setBorder(Rectangle.NO_BORDER);
            tabla.addCell(celda);
        }
        if (nomina.getConceptoIdconcepto().getTipo().equals("DEDUCIDO")) {
            totalDed += nomina.getValor();
            celda = new PdfPCell(new Phrase("" + nomina.getValor()));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
            tabla.addCell(celda);
        } else {
            celda = new PdfPCell(new Phrase(""));
            celda.setBorder(Rectangle.NO_BORDER);
            tabla.addCell(celda);
        }

    }

    celda = new PdfPCell(new Phrase(""));
    celda.setBorder(Rectangle.NO_BORDER);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase("TOTALES"));
    celda.setBorder(Rectangle.NO_BORDER);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase("" + totalDev));
    celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
    celda.setBorder(Rectangle.TOP);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase(" " + totalDed));
    celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
    celda.setBorder(Rectangle.TOP);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase(""));
    celda.setBorder(Rectangle.NO_BORDER);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase("NETO A PAGAR"));
    celda.setBorder(Rectangle.NO_BORDER);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase(" " + (totalDev - totalDed)));
    celda.setBorder(Rectangle.NO_BORDER);
    celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
    tabla.addCell(celda);
    celda = new PdfPCell(new Phrase(" "));
    celda.setBorder(Rectangle.NO_BORDER);
    tabla.addCell(celda);

    return tabla;
}

From source file:com.vimbox.hr.LicensePDFGenerator.java

/**
 * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 * methods./*from  ww  w .  j  a  v a  2 s  .c om*/
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("application/pdf");
    String fileName = request.getParameter("license_name");
    String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
    String path = System.getProperty("user.dir") + "/documents/licenses/" + fileName;
    path = path.replaceAll("%20", " ");
    if (ext.equalsIgnoreCase("pdf")) {
        FileInputStream baos = new FileInputStream(path);

        OutputStream os = response.getOutputStream();

        byte buffer[] = new byte[8192];
        int bytesRead;

        while ((bytesRead = baos.read(buffer)) != -1) {
            os.write(buffer, 0, bytesRead);
        }

        os.flush();
        os.close();
    } else {
        try {
            // Document Settings //
            Document document = new Document();
            PdfWriter.getInstance(document, response.getOutputStream());
            document.open();

            // Loading MC //
            PdfPTable table = new PdfPTable(1);
            table.setWidthPercentage(100);
            // the cell object
            PdfPCell cell;

            Image img = Image.getInstance(path);
            int indentation = 0;
            float scaler = ((document.getPageSize().getWidth() - document.leftMargin() - document.rightMargin()
                    - indentation) / img.getWidth()) * 100;
            img.scalePercent(scaler);
            //img.scaleAbsolute(80f, 80f);
            cell = new PdfPCell(img);
            cell.setBorder(Rectangle.NO_BORDER);
            table.addCell(cell);
            document.add(table);
            //-----------------------------------//
            document.close();
        } catch (DocumentException de) {
            throw new IOException(de.getMessage());
        }
    }

}

From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java

License:Open Source License

protected void showTitleOnPdf() throws Exception {
    PdfPTable tableTitle = new PdfPTable(1);
    tableTitle.setTotalWidth(pdfwidth);/* www. jav  a  2  s .co  m*/
    tableTitle.setLockedWidth(true);//
    int titlefontsize = 0;
    if (this.pdfbean != null)
        titlefontsize = this.pdfbean.getTitlefontsize();
    if (titlefontsize <= 0)
        titlefontsize = 10;
    Font headFont = new Font(PdfAssistant.getInstance().getBfChinese(), titlefontsize, Font.BOLD);
    PdfPCell cell = new PdfPCell(
            new Paragraph(rbean.getTitle(rrequest) + "  " + rbean.getSubtitle(rrequest), headFont));
    cell.setColspan(1);
    cell.setBorder(0);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    tableTitle.addCell(cell);
    document.add(tableTitle);
}

From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java

License:Open Source License

protected void addDataHeaderCell(Object configbean, String value, int rowspan, int colspan, int align) {
    if (dataheadFont == null) {
        int dataheaderfontsize = 0;
        if (this.pdfbean != null)
            dataheaderfontsize = this.pdfbean.getDataheaderfontsize();
        if (dataheaderfontsize <= 0)
            dataheaderfontsize = 6;//from   w w w  . j ava 2 s.com
        dataheadFont = new Font(PdfAssistant.getInstance().getBfChinese(), dataheaderfontsize, Font.BOLD);//??
    }
    PdfPCell cell = new PdfPCell(new Paragraph(value, dataheadFont));
    cell.setColspan(colspan);
    cell.setRowspan(rowspan);
    //            cell.setImage(img);
    //        cell.addElement(new Paragraph(value+"2222",dataheadFont));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setHorizontalAlignment(align);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    if (pdfbean != null && pdfbean.getInterceptorObj() != null) {
        pdfbean.getInterceptorObj().displayPerColDataWithoutTemplate(this, configbean, -1, value, cell);
    }
    pdfDataTable.addCell(cell);
}

From source file:com.wabacus.system.component.application.report.abstractreport.AbsReportType.java

License:Open Source License

protected void addDataCell(Object configbean, String value, int rowspan, int colspan, int align) {
    if (dataFont == null) {
        int datafontsize = 0;
        if (this.pdfbean != null)
            datafontsize = this.pdfbean.getDatafontsize();
        if (datafontsize <= 0)
            datafontsize = 6;/* ww  w  .  ja va2s . co m*/
        dataFont = new Font(PdfAssistant.getInstance().getBfChinese(), datafontsize, Font.NORMAL);
    }
    PdfPCell cell = new PdfPCell(new Paragraph(value, dataFont));
    cell.setColspan(colspan);//??
    cell.setRowspan(rowspan);
    //        }catch(Exception e)
    cell.setHorizontalAlignment(align);//??
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    if (pdfbean != null && pdfbean.getInterceptorObj() != null) {
        pdfbean.getInterceptorObj().displayPerColDataWithoutTemplate(this, configbean, rowspan, value, cell);
    }
    pdfDataTable.addCell(cell);
}

From source file:com.xumpy.itext.services.TimeSheet.java

public List<PdfPCell> header() throws BadElementException, IOException, URISyntaxException {
    List<PdfPCell> header = new ArrayList<PdfPCell>();

    Image img = Image.getInstance(this.getClass().getResource("/timesheet/QR.png"));
    Properties properties = new Properties();
    properties.load(new FileInputStream(
            new File(this.getClass().getResource("/timesheet/default.properties").toURI())));

    img.scaleToFit(120, 120);/*ww  w  .ja  v  a  2  s. c  om*/

    PdfPCell cell1 = new PdfPCell(new Paragraph("\nTimesheet Report\n\n" + properties.getProperty("name")));
    PdfPCell cell2 = new PdfPCell();
    PdfPCell cell3 = new PdfPCell(img);

    header.add(cell1);
    header.add(cell2);
    header.add(cell3);

    return header;
}

From source file:com.xumpy.itext.services.TimeSheet.java

public List<PdfPCell> footer() {
    List<PdfPCell> footer = new ArrayList<PdfPCell>();

    PdfPCell cell1 = new PdfPCell(new Paragraph("Consultant Signature"));
    PdfPCell cell2 = new PdfPCell();
    PdfPCell cell3 = new PdfPCell(new Paragraph("Client Signature"));

    footer.add(cell1);//from   w  w  w .  ja v  a2s .  c  o m
    footer.add(cell2);
    footer.add(cell3);

    return footer;
}

From source file:com.xumpy.itext.services.TimeSheet.java

public PdfPTable body(List<Jobs> jobs) throws DocumentException {
    BigDecimal totalHours = new BigDecimal(0);

    PdfPTable timesheets = new PdfPTable(5);
    timesheets.setWidths(new int[] { 25, 20, 10, 10, 48 });

    SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");

    PdfPCell header1 = new PdfPCell(new Paragraph("Client"));
    PdfPCell header2 = new PdfPCell(new Paragraph("Date"));
    PdfPCell header3 = new PdfPCell(new Paragraph("Hours"));
    PdfPCell header4 = new PdfPCell(new Paragraph("Perc."));
    PdfPCell header5 = new PdfPCell(new Paragraph("Remarks"));

    timesheets.addCell(header1);//from  www.j a  v  a2 s. c o  m
    timesheets.addCell(header2);
    timesheets.addCell(header3);
    timesheets.addCell(header4);
    timesheets.addCell(header5);

    for (Jobs job : jobs) {
        PdfPCell cell1 = new PdfPCell(new Paragraph(job.getJobsGroup().getName()));
        PdfPCell cell2 = new PdfPCell(new Paragraph(df.format(job.getJobDate())));
        PdfPCell cell3 = new PdfPCell(new Paragraph(job.getWorkedHours().toString()));
        PdfPCell cell4 = new PdfPCell(new Paragraph(" "));
        if (job.getPercentage() != null) {
            cell4 = new PdfPCell(new Paragraph(job.getPercentage().toString()));
        }
        PdfPCell cell5 = new PdfPCell(new Paragraph(job.getRemarks()));

        timesheets.addCell(cell1);
        timesheets.addCell(cell2);
        timesheets.addCell(cell3);
        timesheets.addCell(cell4);
        timesheets.addCell(cell5);

        totalHours = totalHours.add(job.getWorkedHours());
    }

    PdfPCell footer1 = new PdfPCell(new Paragraph(" "));
    PdfPCell footer2 = new PdfPCell(new Paragraph("Total Hours"));
    PdfPCell footer3 = new PdfPCell(new Paragraph(totalHours.toString()));
    PdfPCell footer4 = new PdfPCell(new Paragraph(" "));
    PdfPCell footer5 = new PdfPCell(new Paragraph(" "));

    PdfPCell footer6 = new PdfPCell(new Paragraph(" "));
    PdfPCell footer7 = new PdfPCell(new Paragraph("Total Days"));
    PdfPCell footer8 = new PdfPCell(new Paragraph(totalHours.divide(new BigDecimal(8)).toString()));
    PdfPCell footer9 = new PdfPCell(new Paragraph(" "));
    PdfPCell footer10 = new PdfPCell(new Paragraph(" "));

    timesheets.addCell(footer1);
    timesheets.addCell(footer2);
    timesheets.addCell(footer3);
    timesheets.addCell(footer4);
    timesheets.addCell(footer5);
    timesheets.addCell(footer6);
    timesheets.addCell(footer7);
    timesheets.addCell(footer8);
    timesheets.addCell(footer9);
    timesheets.addCell(footer10);

    return timesheets;
}

From source file:comisionesafis.informes.CintaComisiones.java

public boolean generar() {

    // Abrimos el fichero de comisiones
    String sSQL = "";
    Statement stmt;//from  w  ww . ja va 2  s  . c om
    ResultSet rsComisiones;
    ResultSet rsBanco;
    String cuenta;

    // Generamos la sentencia de Seleccin de Datos
    try {

        // Generamos el PDF
        Document documento = new Document(PageSize.A4, 80, 80, 50, 50);
        FileOutputStream salida = new FileOutputStream(FICHERO_PDF);
        PdfWriter writer = PdfWriter.getInstance(documento, salida);
        writer.setInitialLeading(0);

        //  Obtenemos una instancia de nuestro manejador de eventos
        CintaComisionesPie pie = new CintaComisionesPie();
        //Asignamos el manejador de eventos al escritor.
        writer.setPageEvent(pie);

        // Abrimos el Documento
        documento.open();

        sSQL = "SELECT * ";
        sSQL += "  FROM ResumenComisiones";
        sSQL += " ORDER BY CodAgente";
        stmt = conexion.createStatement();
        rsComisiones = stmt.executeQuery(sSQL);

        Paragraph Titulo = new Paragraph();
        Titulo.setAlignment(Element.ALIGN_CENTER);
        Titulo.add("CINTA COMISIONES");

        float[] anchuras = { 1f, 1.5f, 3f, 4f, 1f, 1.5f };
        PdfPTable table = new PdfPTable(anchuras);
        table.setWidthPercentage(100);
        table.setSpacingBefore(15f);
        table.setSpacingAfter(10f);
        PdfPCell celda;

        // Tipo de letra para la tabla
        Font font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);

        celda = new PdfPCell(new Phrase("Agente", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(celda);
        celda = new PdfPCell(new Phrase("Importe", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(celda);
        celda = new PdfPCell(new Phrase("Cuenta Bancaria", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(celda);
        celda = new PdfPCell(new Phrase("Nombre", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(celda);
        celda = new PdfPCell(new Phrase("Irpf", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(celda);
        celda = new PdfPCell(new Phrase("Total", font));
        celda.setBorder(Rectangle.NO_BORDER);
        celda.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(celda);

        while (rsComisiones.next()) {

            // Buscamos la Cuenta Bancaria
            sSQL = "SELECT * ";
            sSQL += "  FROM Agentes";
            sSQL += " WHERE CodAgente='" + rsComisiones.getString("CodAgente") + "'";
            stmt = conexion.createStatement();
            rsBanco = stmt.executeQuery(sSQL);
            if (!rsBanco.next()) {
                cuenta = "                    ";
            } else {
                cuenta = rsBanco.getString("Banco");
                cuenta += rsBanco.getString("Sucursal");
                cuenta += rsBanco.getString("DC");
                cuenta += rsBanco.getString("Cuenta");
            }

            // Datos del agente
            celda = new PdfPCell(new Phrase(rsComisiones.getString("CodAgente"), font));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(celda);

            celda = new PdfPCell(new Phrase(
                    Numeros.formateaDosDecimales(Double.parseDouble(rsComisiones.getString("TotalComisiones"))),
                    font));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(celda);

            celda = new PdfPCell(new Phrase(cuenta, font));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_CENTER);
            table.addCell(celda);

            celda = new PdfPCell(new Phrase(rsComisiones.getString("Nombre"), font));
            celda.setBorder(Rectangle.NO_BORDER);
            table.addCell(celda);

            celda = new PdfPCell(new Phrase(
                    Numeros.formateaDosDecimales(Double.parseDouble(rsComisiones.getString("TotalRetencion"))),
                    font));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(celda);

            celda = new PdfPCell(new Phrase(
                    Numeros.formateaDosDecimales(Double.parseDouble(rsComisiones.getString("TotalPagar"))),
                    font));
            celda.setBorder(Rectangle.NO_BORDER);
            celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
            table.addCell(celda);

        }

        documento.add(Titulo);
        documento.add(new Paragraph(" "));

        // Agregamos la tabla al documento            
        documento.add(table);

        documento.close();

        return true;

    } catch (Exception e) {
        return false;
    }
}

From source file:comisionesafis.informes.LiquidacionComisiones.java

public boolean generar() {

    // Abrimos el fichero de comisiones
    String sSQL = "";
    Statement stmt;/*from ww w. j  a va2  s.c  o  m*/
    ResultSet rsAgentes;
    ResultSet rsRecibos;
    PdfPCell celda;
    boolean cabeceraColumnas;
    int filasPorPagina = 0;
    int fila = 0;
    PdfPTable table;
    Double dblTotal = 0.0;

    // Generamos la sentencia de Seleccin de Datos
    try {

        // Generamos el PDF
        Document documento = new Document(PageSize.A4, 80, 80, 50, 50);
        FileOutputStream salida = new FileOutputStream("LiquidacionComisiones.pdf");
        PdfWriter writer = PdfWriter.getInstance(documento, salida);
        writer.setInitialLeading(0);

        //  Obtenemos una instancia de nuestro manejador de eventos
        LiquidacionComisionesPie pie = new LiquidacionComisionesPie();
        //Asignamos el manejador de eventos al escritor.
        writer.setPageEvent(pie);

        // Abrimos el Documento
        documento.open();

        // SELECT para extraer todos los cdigos de los agentes con Recibos
        sSQL = "SELECT DISTINCT (CodAgente) AS Agente ";
        sSQL += "  FROM ResumenComisiones";
        sSQL += " ORDER BY CodAgente";
        stmt = conexion.createStatement();
        rsAgentes = stmt.executeQuery(sSQL);

        while (rsAgentes.next()) {

            if (sumaComisiones(rsAgentes.getString("Agente")) != 0) {
                paginaNum = 0;
                printCabecera1(documento);
                printCabeceraPelayo(documento);
                printCabecera2(documento, rsAgentes);

                // SELECT para extraer todos los Recibos de un agente
                sSQL = "SELECT * ";
                sSQL += "  FROM Recibos";
                sSQL += " WHERE CodAgente = '" + rsAgentes.getString("Agente") + "'";
                stmt = conexion.createStatement();
                rsRecibos = stmt.executeQuery(sSQL);

                //                if(rsAgentes.getString("Agente").equals("10803")){
                //                    System.out.println("");
                //                }

                // Creamos la tabla formateada
                table = creaTabla();

                cabeceraColumnas = true;
                filasPorPagina = 42;
                dblTotal = 0.0;
                while (rsRecibos.next()) {
                    if (Double.parseDouble(rsRecibos.getString("ImpComision")) != 0) {
                        if (fila >= filasPorPagina) {
                            // Salto de pgina
                            // Imprimimos el contenido de la tabla
                            documento.add(table);
                            documento.newPage();
                            table = creaTabla();
                            saltoDePagina(documento, table, rsAgentes);
                            fila = 1;
                            filasPorPagina = 47;
                        } else if (cabeceraColumnas) {
                            // Primera pgina
                            printCabeceraColumnas(table);
                            cabeceraColumnas = false;
                            fila = 1;
                        }
                        Font font = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL);
                        celda = new PdfPCell(new Phrase(rsRecibos.getString("NPoliza"), font));
                        celda.setBorder(Rectangle.NO_BORDER);
                        celda.setHorizontalAlignment(Element.ALIGN_LEFT);
                        table.addCell(celda);
                        celda = new PdfPCell(
                                new Phrase(Fechas.fechaVencimiento(rsRecibos.getString("Fecha")), font));
                        celda.setBorder(Rectangle.NO_BORDER);
                        celda.setHorizontalAlignment(Element.ALIGN_LEFT);
                        table.addCell(celda);
                        celda = new PdfPCell(new Phrase(fondoRecibo(rsRecibos.getString("Descripcion")), font));
                        celda.setBorder(Rectangle.NO_BORDER);
                        celda.setHorizontalAlignment(Element.ALIGN_LEFT);
                        table.addCell(celda);
                        celda = new PdfPCell(new Phrase(rsRecibos.getString("Importe"), font));
                        celda.setBorder(Rectangle.NO_BORDER);
                        celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
                        table.addCell(celda);
                        celda = new PdfPCell(new Phrase(Numeros.formateaDosDecimales(
                                Double.parseDouble(rsRecibos.getString("ImpComision"))), font));
                        celda.setBorder(Rectangle.NO_BORDER);
                        celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
                        table.addCell(celda);
                        dblTotal += Double.parseDouble(rsRecibos.getString("ImpComision"));
                        fila++;
                    }
                }
                if (fila >= filasPorPagina - 5) {
                    documento.add(table);
                    documento.newPage();
                    table = creaTabla();
                }
                printResumenContable(table, dblTotal, rsAgentes.getString("Agente"));
                documento.add(table);
                documento.newPage();
            }
        }
        documento.close();
        return true;
    } catch (Exception e) {
        return false;
    }
}