Example usage for com.itextpdf.text BaseColor WHITE

List of usage examples for com.itextpdf.text BaseColor WHITE

Introduction

In this page you can find the example usage for com.itextpdf.text BaseColor WHITE.

Prototype

BaseColor WHITE

To view the source code for com.itextpdf.text BaseColor WHITE.

Click Source Link

Usage

From source file:com.miraflorescarwash.controller.PdfController.java

private void crearPdfClientesFreq(Document doc, List<ClienteReporte> reporteCompras, PdfWriter writer) {
    Paragraph parrafo;/*from  w  w w.j  a v a 2  s. c  o m*/
    PdfPTable tabla;
    String txt;
    PdfPCell cell;
    Phrase frase;
    String fuente;
    JFreeChart chart;
    int i, w, h;

    fuente = "arial";
    if (reporteCompras.isEmpty()) {
        return;
    }
    try {
        //

        // Se abre el documento.
        doc.open();

        txt = "Miraflores Car Wash";
        parrafo = new Paragraph(txt, FontFactory.getFont(fuente, 10, Font.BOLD, BaseColor.BLACK));
        parrafo.setAlignment(Element.ALIGN_LEFT);
        doc.add(parrafo);

        txt = "Clientes Frecuentes";
        parrafo = new Paragraph(txt, FontFactory.getFont(fuente, 30, Font.BOLD, BaseColor.BLACK));
        parrafo.setAlignment(Element.ALIGN_CENTER);

        doc.add(parrafo);
        LineSeparator ls = new LineSeparator();
        doc.add(new Chunk(ls));

        doc.add(Chunk.NEWLINE);

        tabla = new PdfPTable(3);

        frase = new Phrase("Id", FontFactory.getFont(fuente, 12, Font.BOLD, BaseColor.WHITE));
        cell = new PdfPCell(frase);
        cell.setBackgroundColor(BaseColor.RED);
        tabla.addCell(cell);

        frase = new Phrase("Nombre", FontFactory.getFont(fuente, 12, Font.BOLD, BaseColor.WHITE));
        cell = new PdfPCell(frase);
        cell.setBackgroundColor(BaseColor.RED);
        tabla.addCell(cell);

        frase = new Phrase("Dinero", FontFactory.getFont(fuente, 12, Font.BOLD, BaseColor.WHITE));
        cell = new PdfPCell(frase);
        cell.setBackgroundColor(BaseColor.RED);
        tabla.addCell(cell);

        i = 1;

        for (ClienteReporte clienteReporte : reporteCompras) {

            if (i % 2 == 0) {
                cell = new PdfPCell();
                cell.setBackgroundColor(new BaseColor(244, 119, 119));

                frase = new Phrase(clienteReporte.getId() + "");
                cell.setPhrase(frase);
                tabla.addCell(cell);

                frase = new Phrase(clienteReporte.getApellido() + " " + clienteReporte.getNombre());
                cell.setPhrase(frase);
                tabla.addCell(cell);

                frase = new Phrase("S/. " + clienteReporte.getTotal() + "0");
                cell.setPhrase(frase);
                tabla.addCell(cell);

            } else {
                tabla.addCell(clienteReporte.getId() + "");
                tabla.addCell(clienteReporte.getApellido() + " " + clienteReporte.getNombre());
                tabla.addCell("S/. " + clienteReporte.getTotal() + "0");
            }
            i++;
        }
        doc.add(tabla);

        doc.newPage();
        txt = "Miraflores Car Wash";
        parrafo = new Paragraph(txt, FontFactory.getFont(fuente, 10, Font.BOLD, BaseColor.BLACK));
        parrafo.setAlignment(Element.ALIGN_LEFT);
        doc.add(parrafo);

        chart = clienteService.generarChartReporte(reporteCompras);

        w = 500;
        h = 500;

        PdfContentByte cb = writer.getDirectContent();
        PdfTemplate tp = cb.createTemplate(w, h);
        Graphics2D g2d = tp.createGraphics(w, h, new DefaultFontMapper());
        Rectangle2D r2d = new Rectangle2D.Double(0, 0, w, h);
        chart.draw(g2d, r2d);
        cb.addTemplate(tp, 50, 250);
        g2d.dispose();
        doc.close();
    } catch (DocumentException ex) {

    }
}

From source file:com.mx.ipn.clases.PDF.java

public PdfPTable Tabla_Simple() throws BadElementException, IOException {
    Paragraph paragraph1 = new Paragraph();
    Font nomb = FontFactory.getFont(FontFactory.TIMES_BOLD, 9, Font.NORMAL, BaseColor.DARK_GRAY);
    Image image;/*from   w w w.  ja v  a2s.c  o  m*/

    // Obtenemos el logo de datojava
    image = Image.getInstance(getClass().getResource("/com/ipn/mx/imagenes/logo.png"));
    image.scaleAbsolute(70f, 60f);

    //creamos la tabla con 3 columnas
    PdfPTable mitablasimple = new PdfPTable(2);
    PdfPCell cellimage = new PdfPCell(image);

    // Propiedades de la celda

    cellimage.setBorderColor(BaseColor.WHITE);
    cellimage.setHorizontalAlignment(Element.ALIGN_CENTER);

    paragraph1.add(new Phrase("1. Nombre completo Y/O Razn Social.", nomb));
    paragraph1.add(new Phrase(Chunk.NEWLINE));
    paragraph1.add(new Phrase("2. Direccin.", nomb));
    paragraph1.add(new Phrase(Chunk.NEWLINE));
    paragraph1.add(new Phrase("3. Registro Federal de Contribuyentes Y/O CURP.", nomb));
    paragraph1.add(new Phrase(Chunk.NEWLINE));
    paragraph1.add(new Phrase("4. Telfonos de Oficina y mviles.", nomb));
    paragraph1.add(new Phrase(Chunk.NEWLINE));
    paragraph1.add(new Phrase("5. Actividad econmica e ingreso promedio.", nomb));
    paragraph1.add(new Phrase(Chunk.NEWLINE));
    paragraph1.add(new Phrase("6. Correo Electrnico. ", nomb));
    paragraph1.add(new Phrase(Chunk.NEWLINE));
    PdfPCell cell = new PdfPCell(paragraph1);

    // Propiedades de la celda

    cell.setBorderColor(BaseColor.WHITE);
    cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    mitablasimple.addCell(cell);
    mitablasimple.addCell(cellimage);
    //retornamos la tabla

    return mitablasimple;
}

From source file:com.photoshop.misc.Factuurgenerator.java

private void creatCell(String cellnaam, PdfPTable table, boolean header) {
    if (header == true) {
        Font font = new Font(FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.WHITE);
        PdfPCell c1 = new PdfPCell(new Phrase(cellnaam, font));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setBackgroundColor(new BaseColor(0, 121, 182));
        c1.setMinimumHeight(20);//from   w  w  w . jav a  2  s  . co m
        table.addCell(c1);
    }
    if (header == false) {
        PdfPCell c1 = new PdfPCell(new Phrase(cellnaam));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
    }
}

From source file:com.photoshop.misc.Indexkaartgenerator.java

private void creatCell(String cellnaam, PdfPTable table, boolean header) {
    if (header == true) {
        Font font = new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD, BaseColor.WHITE);
        PdfPCell c1 = new PdfPCell(new Phrase(cellnaam, font));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        c1.setBackgroundColor(new BaseColor(0, 121, 182));
        c1.setMinimumHeight(20);// w w  w .  j a v  a  2  s .  c o  m
        table.addCell(c1);
    }
    if (header == false) {
        PdfPCell c1 = new PdfPCell(new Phrase(cellnaam));
        c1.setHorizontalAlignment(Element.ALIGN_CENTER);
        table.addCell(c1);
    }
}

From source file:com.sapito.pdf.PDFView.PDFGeneratorActivosFijos.java

public void crearPDFInversion(HttpServletResponse hsr1, ArrayList<HashMap> resultados,
        double granTotalDepActual, double granTotalValorActual, double granTotalValorOr) throws Exception {
    Document dcmntaf = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(dcmntaf, baos);
    System.out.println(resultados.get(0).size());

    dcmntaf.open();//from w ww . java2 s. c  om
    dcmntaf.open();
    dcmntaf.addTitle("Sapito PDFs");
    dcmntaf.addSubject("Pdf de sapito");

    //------------------------ TAIS  ______________________________
    Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg"));
    dcmntaf.add(tais);

    //---------------------  BODY    ---------------------------------------------------------
    Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png"));
    body.setAlignment(Image.UNDERLYING);
    body.setTransparency(new int[] { 0x00, 0x10 });
    body.setAbsolutePosition(50, 250);
    dcmntaf.add(body);
    //-------------------------------------------------------------------------------------------
    Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg"));
    footer.setAbsolutePosition(50, 20);
    dcmntaf.add(footer);
    //----------------------  TITLE ---------------------------
    String titulo = "Reporte de Inversin"; //Cambiar el titulo del PDF aqui
    Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK);
    Chunk c = new Chunk(titulo + " \n ", f);
    c.setBackground(BaseColor.WHITE);
    Paragraph title = new Paragraph(c);
    title.setAlignment(Element.ALIGN_CENTER);

    String titulo2 = "Reporte de Activos Fijos por Tipo"; //Cambiar el titulo del PDF aqui
    Font f2 = new Font(FontFamily.HELVETICA, 12.0f, Font.NORMAL, BaseColor.BLACK);
    Chunk c2 = new Chunk(titulo2 + " \n ", f2);
    c2.setBackground(BaseColor.WHITE);
    Paragraph title2 = new Paragraph(c2);
    title2.setAlignment(Element.ALIGN_LEFT);
    title2.setIndentationLeft(50);
    //-------------------------  CONTENIDO -------------------------------------------------------
    dcmntaf.add(title); //Titulo del PDF
    dcmntaf.add(title2);
    PdfPTable table = new PdfPTable(4);

    //                                 PdfPCell cell;
    //                            cell = new PdfPCell(new Phrase("Tipo de A", FontFactory.getFont("TIMES_ROMAN", 12, Font.BOLD, BaseColor.BLACK)));                     
    //                        table.addCell(cell);      
    table.addCell("Tipo de Activo fijo");
    table.addCell("Valor Original");
    table.addCell("Depreciacin Actual ");
    table.addCell("Valor Actual");
    //        Iterator it = resultados.get(0).entrySet().iterator();
    for (int i = 0; i < resultados.size(); i++) {
        table.addCell(resultados.get(i).get("tipo").toString());
        table.addCell(resultados.get(i).get("valorOriginal").toString());
        table.addCell(resultados.get(i).get("depreciacionActual").toString());
        table.addCell(resultados.get(i).get("valoreActual").toString());
    }

    //        while (it.hasNext()) {
    //            Map.Entry e = (Map.Entry) it.next();
    //            System.out.println(e.getKey() + " " + e.getValue());
    //            
    //            table.addCell(e.getValue().toString());
    //        }

    dcmntaf.add(table);

    String titulo3 = "Reporte Total de Activos Fijos"; //Cambiar el titulo del PDF aqui
    Font f3 = new Font(FontFamily.HELVETICA, 12.0f, Font.NORMAL, BaseColor.BLACK);
    Chunk c3 = new Chunk(titulo3 + " \n ", f3);
    c3.setBackground(BaseColor.WHITE);

    Paragraph title3 = new Paragraph(c3);
    title3.setAlignment(Element.ALIGN_LEFT);
    title3.setIndentationLeft(50);
    dcmntaf.add(title3);

    PdfPTable table2 = new PdfPTable(3);
    //                                 PdfPCell cell;
    //                            cell = new PdfPCell(new Phrase("Tipo de A", FontFactory.getFont("TIMES_ROMAN", 12, Font.BOLD, BaseColor.BLACK)));                     
    //                        table.addCell(cell);                        
    table2.addCell("Valor Original Total");
    table2.addCell("Depreciacin Anual Total");
    table2.addCell("Valor Total");
    table2.addCell(granTotalValorOr + "");
    table2.addCell(granTotalDepActual + "");
    table2.addCell(granTotalValorActual + "");

    dcmntaf.add(table2);

    PdfPTable table3 = new PdfPTable(1);
    table3.setWidthPercentage(100.0f);
    table3.setWidths(new float[] { 2.0f });
    table3.setSpacingBefore(10);

    // define font for table header row
    Font font = FontFactory.getFont(FontFactory.COURIER_BOLD);
    font.setColor(BaseColor.WHITE);

    // define table header cell
    PdfPCell cell = new PdfPCell();
    cell.setBackgroundColor(BaseColor.BLUE);
    cell.setPadding(5);

    // write table header 
    cell.setPhrase(new Phrase("Resultado", font));
    table3.addCell(cell);
    Depreciacion dep = new Depreciacion();

    String bla = a + " ";
    table3.addCell(bla);

    //-------------------------- FIN CONTENIDO -----------------
    dcmntaf.close();

    dcmntaf.close();

    byte[] bytes = baos.toByteArray();

    hsr1.setContentType("application/pdf");
    hsr1.setContentLength(bytes.length);
    hsr1.getOutputStream().write(bytes);
}

From source file:com.sapito.pdf.PDFView.PDFGeneratorContabilidad.java

public void crearEstadoResultados(HttpServletResponse hsr1, String ingresos, String cVenta, String cGeneral,
        String cImpu, String cImpTot) throws Exception {
    Document document = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    document.open();//from  ww  w  .  j a v a  2  s  .  c  om
    document.addTitle("Sapito PDFs");
    document.addSubject("Pdf de sapito");

    //------------------------ TAIS  ______________________________
    Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg"));
    document.add(tais);

    //---------------------  BODY    ---------------------------------------------------------
    Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png"));
    body.setAlignment(Image.UNDERLYING);
    body.setTransparency(new int[] { 0x00, 0x10 });
    body.setAbsolutePosition(50, 250);
    document.add(body);
    //-------------------------------------------------------------------------------------------
    Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg"));
    footer.setAbsolutePosition(50, 20);
    document.add(footer);
    //----------------------  TITLE ---------------------------
    String titulo = "Estado de Resultados"; //Cambiar el titulo del PDF aqui
    Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK);
    Chunk c = new Chunk(titulo + " \n ", f);
    c.setBackground(BaseColor.WHITE);
    Paragraph title = new Paragraph(c);
    title.setAlignment(Element.ALIGN_CENTER);
    //-------------------------  CONTENIDO -------------------------------------------------------
    document.add(title); //Titulo del PDF
    PdfPTable table = new PdfPTable(2);

    table.addCell("Ingresos");
    table.addCell(ingresos);//valor
    table.addCell("Costo de Venta");
    table.addCell(cVenta);//valor
    table.addCell("Costos Generales");
    table.addCell(cGeneral);//valor
    table.addCell("Impuestos de Ingresos");
    table.addCell(cImpu);//valor
    table.addCell("Impuesto de Costos Totales");
    table.addCell(cImpTot);//valor
    document.add(table);
    document.close();

    byte[] bytes = baos.toByteArray();

    hsr1.setContentType("application/pdf");
    hsr1.setContentLength(bytes.length);
    hsr1.getOutputStream().write(bytes);
}

From source file:com.sapito.pdf.PDFView.PDFGeneratorContabilidad.java

public void crearVariacionContable(HttpServletResponse hsr1, String sInicial, String aumento, String utilidad,
        String disminucion, String perdidas, String sFinal) throws Exception {
    Document document = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    document.open();/*from   w ww.ja v a2 s  . c  o  m*/
    document.addTitle("Sapito PDFs");
    document.addSubject("Pdf de sapito");

    //------------------------ TAIS  ______________________________
    Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg"));
    document.add(tais);

    //---------------------  BODY    ---------------------------------------------------------
    Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png"));
    body.setAlignment(Image.UNDERLYING);
    body.setTransparency(new int[] { 0x00, 0x10 });
    body.setAbsolutePosition(50, 250);
    document.add(body);
    //-------------------------------------------------------------------------------------------
    Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg"));
    footer.setAbsolutePosition(50, 20);
    document.add(footer);
    //----------------------  TITLE ---------------------------
    String titulo = "Variaciones de Capital Contable"; //Cambiar el titulo del PDF aqui
    Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK);
    Chunk c = new Chunk(titulo + " \n ", f);
    c.setBackground(BaseColor.WHITE);
    Paragraph title = new Paragraph(c);
    title.setAlignment(Element.ALIGN_CENTER);
    //-------------------------  CONTENIDO -------------------------------------------------------
    document.add(title); //Titulo del PDF
    PdfPTable table = new PdfPTable(2);

    table.addCell("Saldo al inicio del ejercicio");
    table.addCell(sInicial);//valor
    table.addCell("Aumentos");
    table.addCell(aumento);//valor
    table.addCell("Utilidades");
    table.addCell(utilidad);//valor
    table.addCell("Disminuciones");
    table.addCell(disminucion);//valor
    table.addCell("Perdidas");
    table.addCell(perdidas);//valor
    table.addCell("Saldo al final del ejercicio");
    table.addCell(sFinal);//valor

    document.add(table);
    document.close();

    byte[] bytes = baos.toByteArray();

    hsr1.setContentType("application/pdf");
    hsr1.setContentLength(bytes.length);
    hsr1.getOutputStream().write(bytes);
}

From source file:com.sapito.pdf.PDFView.PDFGeneratorContabilidad.java

public void crearFlujo(HttpServletResponse hsr1, String operacion, String sInicio, String sFin)
        throws Exception {
    Document document = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    document.open();/* w ww. j a v a2 s . com*/
    document.addTitle("Sapito PDFs");
    document.addSubject("Pdf de sapito");

    //------------------------ TAIS  ______________________________
    Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg"));
    document.add(tais);

    //---------------------  BODY    ---------------------------------------------------------
    Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png"));
    body.setAlignment(Image.UNDERLYING);
    body.setTransparency(new int[] { 0x00, 0x10 });
    body.setAbsolutePosition(50, 250);
    document.add(body);
    //-------------------------------------------------------------------------------------------
    Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg"));
    footer.setAbsolutePosition(50, 20);
    document.add(footer);
    //----------------------  TITLE ---------------------------
    String titulo = "Flujo de Efectivo"; //Cambiar el titulo del PDF aqui
    Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK);
    Chunk c = new Chunk(titulo + " \n ", f);
    c.setBackground(BaseColor.WHITE);
    Paragraph title = new Paragraph(c);
    title.setAlignment(Element.ALIGN_CENTER);
    //-------------------------  CONTENIDO -------------------------------------------------------
    document.add(title); //Titulo del PDF
    PdfPTable table = new PdfPTable(2);

    table.addCell("Operacin");
    table.addCell(operacion);//valor
    table.addCell("Saldo al inicio del ao");
    table.addCell(sInicio);//valor
    table.addCell("Saldo al inicio del ao");
    table.addCell(sFin);//valor
    document.add(table);

    document.close();

    byte[] bytes = baos.toByteArray();

    hsr1.setContentType("application/pdf");
    hsr1.setContentLength(bytes.length);
    hsr1.getOutputStream().write(bytes);
}

From source file:com.sapito.pdf.PDFView.PDFGeneratorContabilidad.java

public void crearBalance(HttpServletResponse hsr1, String aCirculante, String aNCirculante, String tActivos,
        String pasivo) throws Exception {
    Document document = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    document.open();//from   w ww .jav  a  2 s.c o m
    document.addTitle("Sapito PDFs");
    document.addSubject("Pdf de sapito");

    //------------------------ TAIS  ______________________________
    Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg"));
    document.add(tais);

    //---------------------  BODY    ---------------------------------------------------------
    Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png"));
    body.setAlignment(Image.UNDERLYING);
    body.setTransparency(new int[] { 0x00, 0x10 });
    body.setAbsolutePosition(50, 250);
    document.add(body);
    //-------------------------------------------------------------------------------------------
    Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg"));
    footer.setAbsolutePosition(50, 20);
    document.add(footer);
    //----------------------  TITLE ---------------------------
    String titulo = "Balance General"; //Cambiar el titulo del PDF aqui
    Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK);
    Chunk c = new Chunk(titulo + " \n ", f);
    c.setBackground(BaseColor.WHITE);
    Paragraph title = new Paragraph(c);
    title.setAlignment(Element.ALIGN_CENTER);
    //-------------------------  CONTENIDO -------------------------------------------------------
    document.add(title); //Titulo del PDF
    PdfPTable table = new PdfPTable(2);

    table.addCell("Activo circulante");
    table.addCell(aCirculante);//valor
    table.addCell("Activo no circulante");
    table.addCell(aNCirculante);//valor
    table.addCell("total activos");
    table.addCell(tActivos);//valor
    table.addCell("pasivo");
    table.addCell(pasivo);//valor
    document.add(table);

    document.close();

    byte[] bytes = baos.toByteArray();

    hsr1.setContentType("application/pdf");
    hsr1.setContentLength(bytes.length);
    hsr1.getOutputStream().write(bytes);
}

From source file:com.sapito.pdf.PDFView.PDFGeneratorDireccion.java

public void crearPDFFactura(Map<String, Object> model, HttpServletResponse hsr1, List<Producto> tipo)
        throws Exception {
    Document document = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(document, baos);

    document.open();/*from  w  w  w  .  j  av  a 2 s  .c  o  m*/
    document.addTitle("Sapito PDFs");
    document.addSubject("Pdf de sapito");
    Font font1 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 30);
    font1.setColor(BaseColor.BLACK);
    Font font2 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 24);
    font2.setColor(BaseColor.BLACK);
    document.add(new Paragraph("TAILS 2015", font1));
    document.add(new Paragraph("Reportes Direccin\n", font2));

    //------------------------ TAIS  ______________________________
    Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg"));
    document.add(tais);

    //---------------------  BODY    ---------------------------------------------------------
    Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png"));
    body.setAlignment(Image.UNDERLYING);
    body.setTransparency(new int[] { 0x00, 0x10 });
    body.setAbsolutePosition(50, 250);
    document.add(body);
    //-------------------------------------------------------------------------------------------
    Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg"));
    footer.setAbsolutePosition(50, 20);
    document.add(footer);
    //----------------------  TITLE ---------------------------
    String titulo = "Reporte de Ventas"; //Cambiar el titulo del PDF aqui
    Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK);
    Chunk c = new Chunk(titulo + " \n ", f);
    c.setBackground(BaseColor.WHITE);
    Paragraph title = new Paragraph(c);
    title.setAlignment(Element.ALIGN_CENTER);
    //-------------------------  CONTENIDO -------------------------------------------------------
    document.add(title); //Titulo del PDF

    TextoPdf x = (TextoPdf) model.get("todoTexto");
    document.add(new Paragraph(x.getTodoTexto()));

    PdfPTable table3 = new PdfPTable(3);
    table3.setWidthPercentage(100.0f);
    table3.setWidths(new float[] { 2.0f, 2.0f, 2.0f });
    table3.setSpacingBefore(10);

    // define font for table header row
    Font font = FontFactory.getFont(FontFactory.COURIER_BOLD);
    font.setColor(BaseColor.WHITE);

    // define table header cell
    PdfPCell cell = new PdfPCell();
    cell.setBackgroundColor(BaseColor.BLUE);
    cell.setPadding(5);

    // write table header 
    cell.setPhrase(new Phrase("Nombre", font));
    table3.addCell(cell);
    cell.setPhrase(new Phrase("Categoria", font));
    table3.addCell(cell);
    cell.setPhrase(new Phrase("Marca", font));
    table3.addCell(cell);
    Depreciacion dep = new Depreciacion();
    for (int i = 0; i < tipo.size(); i++) {

        //a = dep.getResultado();
        //b = dep.getValorADep();
        table3.addCell(tipo.get(i).getNombreProducto());
        table3.addCell(tipo.get(i).getCategoria());
        table3.addCell(tipo.get(i).getMarca());

    }
    //        String bla = a + " ";
    //        String bl = b + " ";
    //        table3.addCell(bla);
    //        table3.addCell(bl);
    document.add(table3);

    //-------------------------- FIN CONTENIDO -----------------
    document.close();

    byte[] bytes = baos.toByteArray();

    hsr1.setContentType("application/pdf");
    hsr1.setContentLength(bytes.length);
    hsr1.getOutputStream().write(bytes);
}