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

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

Introduction

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

Prototype

public void setHorizontalAlignment(int horizontalAlignment) 

Source Link

Document

Sets the horizontal alignment for the cell.

Usage

From source file:com.solidmaps.webapp.report.RequerimentAlterLicenseFederalPDF.java

private void insertHeaderCell(PdfPTable table, String text, Integer colSpan) {

    if (text == null) {
        text = "";
    }//from   w  ww .j a  v  a 2 s.  com

    // create a new cell with the specified Text and Font
    PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
    // set the cell alignment
    // in case there is no text and you wan to create an empty row
    if (text.trim().equalsIgnoreCase("")) {
        cell.setMinimumHeight(10f);
    }

    cell.setVerticalAlignment(Element.ALIGN_CENTER);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setColspan(colSpan);
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setBorderWidth(2);
    cell.setPadding(3f);

    // add the call to the table
    table.addCell(cell);
}

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

public PdfPTable Tabla_compleja() {
    //creamos una tabla con 3 columnas
    PdfPTable mitablacompleja = new PdfPTable(3);
    //aadimos texto con formato a la primera celda
    PdfPCell celda = new PdfPCell(new Paragraph("Historial de Observaciones", FontFactory.getFont("arial", // fuente
            22, // tamao
            Font.BOLD, // estilo
            BaseColor.RED))); // color
    //unimos esta celda con otras 2
    celda.setColspan(3);/*from  w  ww. j ava  2  s  .  c  o m*/
    //alineamos el contenido al centro
    celda.setHorizontalAlignment(Element.ALIGN_CENTER);
    // aadimos un espaciado
    celda.setPadding(12.0f);
    //colocamos un color de fondo
    celda.setBackgroundColor(BaseColor.GRAY);
    //se aade a la tabla
    mitablacompleja.addCell(celda);

    //fila 2
    celda = new PdfPCell(new Paragraph("AUDITORIA DE SISTEMAS"));
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.GREEN);
    mitablacompleja.addCell(celda);
    celda = new PdfPCell(new Paragraph("Aprobado"));
    celda.setBackgroundColor(BaseColor.LIGHT_GRAY);
    mitablacompleja.addCell(celda);
    //fila 3        
    celda = new PdfPCell(new Paragraph("COMPILADORES"));
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.YELLOW);
    mitablacompleja.addCell(celda);
    celda = new PdfPCell(new Paragraph("Reprobado"));
    celda.setBackgroundColor(BaseColor.LIGHT_GRAY);
    mitablacompleja.addCell(celda);
    //fila 4        
    celda = new PdfPCell(new Paragraph("Prog. Bajo Nivel"));
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.CYAN);
    mitablacompleja.addCell(celda);
    celda = new PdfPCell(new Paragraph("Eximido"));
    celda.setBackgroundColor(BaseColor.LIGHT_GRAY);
    mitablacompleja.addCell(celda);
    //fila 5
    mitablacompleja.addCell("Conclusion");
    celda = new PdfPCell(new Paragraph("GET A LIFE!!!"));
    celda.setHorizontalAlignment(Element.ALIGN_RIGHT);
    celda.setColspan(2);
    celda.setBackgroundColor(BaseColor.ORANGE);
    mitablacompleja.addCell(celda);
    // se retorna la tabla

    return mitablacompleja;
}

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

public void readPdf() {
    try {/* w ww . ja  v a 2s  .  com*/
        OutputStream file = new FileOutputStream(new File("D:\\SamplePDFje.pdf"));

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

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

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

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

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

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

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

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

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

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

        document.add(pdfTable);

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

    } catch (Exception e) {

        e.printStackTrace();
    }
}

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

public PdfPTable tabla2(List<Nomina> no) throws DocumentException {
    //Instanciamos una tabla de 3 columnas
    PdfPTable tabla = new PdfPTable(4);
    tabla.setWidthPercentage(100);// ww  w  .j av a  2  s .  com
    tabla.setWidths(new float[] { 1, 1, 1, 3 });
    //Declaramos un objeto para manejar las celdas
    PdfPCell celda;
    celda = new PdfPCell(new Phrase("Codigo:"));
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    //celda.setBorder(Rectangle.NO_BORDER);
    tabla.addCell(celda);
    if (!no.isEmpty()) {
        celda = new PdfPCell(new Phrase("" + no.get(0).getEmpleadoCodigo().getCodigo()));
        //celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);
    }

    celda = new PdfPCell(new Phrase("Nombre:"));
    //celda.setBorder(Rectangle.NO_BORDER);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    tabla.addCell(celda);

    if (!no.isEmpty()) {
        celda = new PdfPCell(new Phrase(no.get(0).getEmpleadoCodigo().getNombre()));
        //celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);
    }
    celda = new PdfPCell(new Phrase("Cedula:"));
    //celda.setBorder(Rectangle.NO_BORDER);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    tabla.addCell(celda);
    if (!no.isEmpty()) {
        celda = new PdfPCell(new Phrase(no.get(0).getEmpleadoCodigo().getCedula()));
        //celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);
    }
    celda = new PdfPCell(new Phrase("Cargo:"));
    //celda.setBorder(Rectangle.NO_BORDER);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    tabla.addCell(celda);
    if (!no.isEmpty()) {
        celda = new PdfPCell(new Phrase(no.get(0).getEmpleadoCodigo().getCargoCargoid().getCargo()));
        //celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);
    }
    celda = new PdfPCell(new Phrase("Dias Lab:"));
    //celda.setBorder(Rectangle.NO_BORDER);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    tabla.addCell(celda);
    if (!no.isEmpty()) {
        dt = dtC.findBySingle2("periodoIdperiodo", no.get(0).getPeriodoIdperiodo(), "empleadoCodigo",
                no.get(0).getEmpleadoCodigo());

        celda = new PdfPCell(new Phrase("" + dt.getDias()));
        //celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);
    }
    celda = new PdfPCell(new Phrase("Sueldo:"));

    //celda.setBorder(Rectangle.NO_BORDER);
    celda.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);

    tabla.addCell(celda);

    if (!no.isEmpty()) {
        celda = new PdfPCell(new Phrase("" + no.get(0).getEmpleadoCodigo().getSalario()));
        //celda.setBorder(Rectangle.NO_BORDER);
        tabla.addCell(celda);
    }

    return tabla;
}

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  ww .  jav  a2  s  .  c o m
    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.vectorprint.report.itext.EventHelper.java

License:Open Source License

/**
 * prints a footer table with a line at the top, a date and page numbering, second cell will be right aligned
 *
 * @see #PAGEFOOTERTABLEKEY//from w w w  .  j a  v a  2 s  . c  o m
 * @see #PAGEFOOTERSTYLEKEY
 *
 * @param writer
 * @param document
 * @throws DocumentException
 * @throws VectorPrintException
 */
protected void renderFooter(PdfWriter writer, Document document)
        throws DocumentException, VectorPrintException, InstantiationException, IllegalAccessException {
    if (!debugHereAfter && !failuresHereAfter) {
        PdfPTable footerTable = elementProducer.createElement(null, PdfPTable.class,
                getStylers(PAGEFOOTERTABLEKEY));

        footerTable.addCell(createFooterCell(ValueHelper.createDate(new Date())));

        String pageText = writer.getPageNumber() + getSettings().getProperty(" of ", UPTO);

        PdfPCell c = createFooterCell(pageText);
        c.setHorizontalAlignment(Element.ALIGN_RIGHT);
        footerTable.addCell(c);

        footerTable.addCell(createFooterCell(new Chunk()));
        footerTable.writeSelectedRows(0, -1, document.getPageSize().getLeft() + document.leftMargin(),
                document.getPageSize().getBottom(document.bottomMargin()), writer.getDirectContentUnder());
        footerBottom = document.bottom() - footerTable.getTotalHeight();
    }
}

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);/*from ww w. ja  v  a 2 s  .c  o 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.jav a  2s  . c o m
        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;/*from w  w w  .  j a v  a2  s.c  o 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:comisionesafis.informes.CintaComisiones.java

public boolean generar() {

    // Abrimos el fichero de comisiones
    String sSQL = "";
    Statement stmt;/*www  . j av a  2 s  .com*/
    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;
    }
}