Example usage for com.lowagie.text Font BOLD

List of usage examples for com.lowagie.text Font BOLD

Introduction

In this page you can find the example usage for com.lowagie.text Font BOLD.

Prototype

int BOLD

To view the source code for com.lowagie.text Font BOLD.

Click Source Link

Document

this is a possible style.

Usage

From source file:com.slamd.report.PDFReportGenerator.java

License:Open Source License

/**
 * Performs the appropriate action necessary when starting a new page.  In
 * this case, we will write the SLAMD header to the top of the page.
 *
 * @param  writer    The writer used to write the PDF document.
 * @param  document  The PDF document being written.
 *//*from  w w w .java 2  s . c  o  m*/
public void onStartPage(PdfWriter writer, Document document) {
    try {
        PdfPTable table = new PdfPTable(3);
        table.setWidthPercentage(100);

        PdfPCell blueCell = new PdfPCell(new Phrase(" \n "));
        blueCell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        blueCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        blueCell.setBackgroundColor(new Color(0x59, 0x4F, 0xBF));
        blueCell.setBorderWidth(inchesToPoints(1.0 / 16));
        blueCell.setBorderColor(new Color(0xFF, 0xFF, 0xFF));
        blueCell.setPadding(inchesToPoints(1.0 / 16));
        table.addCell(blueCell);

        Phrase titlePhrase = new Phrase("SLAMD Generated Report",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, new Color(0x59, 0x4F, 0xBF)));
        PdfPCell yellowCell = new PdfPCell(titlePhrase);
        yellowCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        yellowCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        yellowCell.setBackgroundColor(new Color(0xFB, 0xE2, 0x49));
        yellowCell.setBorderWidth(inchesToPoints(1.0 / 16));
        yellowCell.setBorderColor(new Color(0xFF, 0xFF, 0xFF));
        yellowCell.setPadding(inchesToPoints(1.0 / 16));
        table.addCell(yellowCell);

        Phrase versionPhrase = new Phrase("Version " + DynamicConstants.SLAMD_VERSION,
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, new Color(0xFF, 0xFF, 0xFF)));
        PdfPCell redCell = new PdfPCell(versionPhrase);
        redCell.setHorizontalAlignment(Cell.ALIGN_RIGHT);
        redCell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
        redCell.setBackgroundColor(new Color(0xD1, 0x21, 0x24));
        redCell.setBorderWidth(inchesToPoints(1.0 / 16));
        redCell.setBorderColor(new Color(0xFF, 0xFF, 0xFF));
        redCell.setPadding(inchesToPoints(1.0 / 16));
        table.addCell(redCell);

        document.add(table);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.songbook.pc.exporter.PdfExporter.java

License:Open Source License

public PdfExporter(SongNodeLoader loader) {
    this.loader = loader;

    // Load fonts
    FontFactory.registerDirectories();/*from w ww.  j  a v a  2s.c om*/
    BaseFont timesFont = null;
    try {
        timesFont = BaseFont.createFont("C:/Windows/Fonts/times.ttf", BaseFont.CP1250, true);
        logger.info("Embedded TTF fonts from C:/Windows/Fonts");
    } catch (Exception ex) {
        try {
            timesFont = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1250, true);
            logger.info("Embedded default fonts");
        } catch (Exception ex1) {
            logger.error("Failed to load fonts ...");
        }
    }

    // Initialize fonts
    if (timesFont != null) {
        songTitleFont = new Font(timesFont, 14f, Font.BOLD);
        textFont = new Font(timesFont, 11f, Font.NORMAL);
        chordFont = FontFactory.getFont(FontFactory.HELVETICA, BaseFont.CP1250, 11f, Font.BOLD);
    } else {
        songTitleFont = null;
        textFont = null;
        chordFont = null;
    }

    verseSpacing = new Paragraph(" ");
    verseSpacing.setLeading(5f, 0.5f);
}

From source file:com.stratelia.webactiv.almanach.control.AlmanachPdfGenerator.java

License:Open Source License

private static void createFirstPage(AlmanachSessionController almanach, Document document)
        throws AlmanachException {
    try {/*from ww w . jav a 2 s . c  o  m*/
        Font masterFont = new Font(Font.HELVETICA, 40, Font.BOLD, new Color(0, 0, 0));
        Paragraph masterTitle = new Paragraph("\n\n\n\n" + almanach.getComponentLabel(), masterFont);

        masterTitle.setAlignment(Element.ALIGN_CENTER);

        Font secondFont = new Font(Font.HELVETICA, 14, Font.NORMAL, new Color(0, 0, 0));
        Paragraph secondTitle = new Paragraph(almanach.getString("editeLe") + " "
                + DateUtil.getOutputDate(new Date(), almanach.getLanguage()) + almanach.getString("Silverpeas"),
                secondFont);

        secondTitle.setAlignment(Element.ALIGN_CENTER);

        document.add(masterTitle);
        document.add(secondTitle);
    } catch (DocumentException e) {
        throw new AlmanachException("AlmanachPdfGenerator.createFirstPage()", SilverpeasException.ERROR,
                "almanach.EX_CANT_CREATE_FIRST_PAGE", e);
    }
}

From source file:com.stratelia.webactiv.almanach.control.AlmanachPdfGenerator.java

License:Open Source License

private static void generateAlmanach(Chapter chapter, AlmanachSessionController almanach,
        List<DisplayableEventOccurrence> occurrences, String mode) throws AlmanachException {

    boolean monthScope = AlmanachPdfGenerator.PDF_MONTH_EVENTSONLY.equals(mode)
            || AlmanachPdfGenerator.PDF_MONTH_ALLDAYS.equals(mode);
    boolean yearScope = AlmanachPdfGenerator.PDF_YEAR_EVENTSONLY.equals(mode);

    int currentDay = -1;
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(almanach.getCurrentDay());
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    int currentMonth = calendar.get(Calendar.MONTH);
    int currentYear = calendar.get(Calendar.YEAR);

    if (yearScope) {
        // start from begin of current year
        calendar.set(Calendar.MONTH, 0);
    }/*from   w  w  w.  j a v  a  2  s.  c  om*/

    // for each day of the current month
    while ((monthScope && currentMonth == calendar.get(Calendar.MONTH))
            || (yearScope && currentYear == calendar.get(Calendar.YEAR))) {
        Section section = null;
        if (AlmanachPdfGenerator.PDF_MONTH_ALLDAYS.equals(mode)) {
            section = chapter.addSection(generateParagraph(calendar, almanach), 0);
        }

        Font titleTextFont = new Font(Font.BOLD, 12, Font.SYMBOL, new Color(0, 0, 0));

        // get the events of the current day
        for (DisplayableEventOccurrence occurrence : occurrences) {
            EventDetail event = occurrence.getEventDetail();
            String theDay = DateUtil.date2SQLDate(calendar.getTime());
            String startDay = DateUtil.date2SQLDate(occurrence.getStartDate().asDate());
            String startHour = event.getStartHour();
            String endHour = event.getEndHour();

            if (startDay.compareTo(theDay) > 0) {
                continue;
            }

            String endDay = startDay;
            if (event.getEndDate() != null) {
                endDay = DateUtil.date2SQLDate(occurrence.getEndDate().asDate());
            }

            if (endDay.compareTo(theDay) < 0) {
                continue;
            }

            if (calendar.get(Calendar.DAY_OF_MONTH) != currentDay) {
                if (AlmanachPdfGenerator.PDF_MONTH_EVENTSONLY.equals(mode)
                        || AlmanachPdfGenerator.PDF_YEAR_EVENTSONLY.equals(mode)) {
                    section = chapter.addSection(generateParagraph(calendar, almanach), 0);
                }
                currentDay = calendar.get(Calendar.DAY_OF_MONTH);
            }

            Font textFont;
            if (event.getPriority() == 0) {
                textFont = new Font(Font.HELVETICA, 10, Font.NORMAL, new Color(0, 0, 0));
            } else {
                textFont = new Font(Font.HELVETICA, 10, Font.BOLD, new Color(0, 0, 0));
            }

            String eventTitle = event.getTitle();
            if (startDay.compareTo(theDay) == 0 && startHour != null && startHour.length() != 0) {
                eventTitle += " (" + startHour;
                if (endDay.compareTo(theDay) == 0 && endHour != null && endHour.length() != 0) {
                    eventTitle += "-" + endHour;
                }
                eventTitle += ")";
            }

            section.add(new Paragraph(eventTitle, titleTextFont));
            if (StringUtil.isDefined(event.getPlace())) {
                section.add(new Paragraph(event.getPlace(), titleTextFont));
            }
            if (StringUtil.isDefined(event.getDescription(almanach.getLanguage()))) {
                section.add(new Paragraph(event.getDescription(almanach.getLanguage()), textFont));
            }
            section.add(new Paragraph("\n"));

        } // end for
        calendar.add(Calendar.DAY_OF_MONTH, 1);
    }
}

From source file:com.stratelia.webactiv.kmelia.control.Callback.java

License:Open Source License

@Override
public void handleStartTag(Tag t, MutableAttributeSet a, int pos) throws KmeliaRuntimeException {
    SilverTrace.info("kmelia", "Callback.handleStartTag", "root.MSG_ENTRY_METHOD", "t = " + t.toString());
    if (TABLE.equals(t)) {
        try {/*from w  ww. j  a  v  a2  s  .co  m*/
            tbl = new Table(Integer.parseInt(columns.get(++current_table)));
            tbl.setBorderWidth(0);
            tbl.setAlignment(Element.ALIGN_LEFT);
            attribute = a.getAttribute(Attribute.WIDTH);
            if (attribute != null) {
                attribute_value = attribute.toString();
                if ("%".equals(attribute_value.substring(attribute_value.length() - 1))) {
                    tbl.setWidth(
                            (Integer.parseInt(attribute_value.substring(0, attribute_value.length() - 1))));
                }
            }
            attribute = a.getAttribute(Attribute.CELLPADDING);
            if (attribute != null) {
                attribute_value = attribute.toString();
                tbl.setSpacing(Integer.parseInt(attribute_value));
            }
            attribute = a.getAttribute(Attribute.CELLSPACING);
            if (attribute != null) {
                attribute_value = attribute.toString();
                tbl.setPadding(Integer.parseInt(attribute_value));
            }
        } catch (Exception ex) {
            throw new KmeliaRuntimeException("Callback.handleStartTag", SilverpeasRuntimeException.WARNING,
                    "kmelia.EX_CANNOT_SHOW_PDF_GENERATION", ex);
        }
    } else if (TD.equals(t)) {
        try {
            if (cl == null) {
                cl = new Cell();
                cl.setBorderWidth(0);
            }
            is_was_text = false;
        } catch (Exception ex) {
            throw new KmeliaRuntimeException("Callback.handleStartTag", SilverpeasRuntimeException.WARNING,
                    "kmelia.EX_CANNOT_SHOW_PDF_GENERATION", ex);
        }
    } else if (H1.equals(t)) {
        font_size = Font.DEFAULTSIZE + 1;
    } else if (H2.equals(t)) {
        font_size = Font.DEFAULTSIZE + 2;
    } else if (H3.equals(t)) {
        font_size = Font.DEFAULTSIZE + 3;
    } else if (H4.equals(t)) {
        font_size = Font.DEFAULTSIZE + 4;
    } else if (H5.equals(t)) {
        font_size = Font.DEFAULTSIZE + 5;
    } else if (H6.equals(t)) {
        font_size = Font.DEFAULTSIZE + 6;
    } else if (FONT.equals(t)) {
        attribute = a.getAttribute(Attribute.SIZE);
        if (attribute != null) {
            font_size = Integer.parseInt(attribute.toString()) + Font.DEFAULTSIZE - 1;
        }
    } else if (t.equals(B)) {
        font_properties = font_properties | Font.BOLD;
    } else if (t.equals(I)) {
        font_properties = font_properties | Font.ITALIC;
    } else if (t.equals(U)) {
        // current PDF package doesn't support it
    }
}

From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java

License:Open Source License

/**
 * Method declaration/*from   www.j  a v  a  2s. c  o  m*/
 * @param document
 * @param langue
 * @throws NewsEditoException
 * @see
 */
public static void createFirstPage(Document document, String langue) throws NewsEditoException {
    try {
        ResourceLocator message = new ResourceLocator(
                "com.stratelia.webactiv.newsEdito.multilang.newsEditoBundle", langue);

        Font masterFont = new Font(Font.HELVETICA, 40, Font.BOLD, new Color(0, 0, 0));
        Paragraph masterTitle = new Paragraph("\n\n\n\n" + message.getString("journalEditorial"), masterFont);

        masterTitle.setAlignment(Element.ALIGN_CENTER);

        Font secondFont = new Font(Font.HELVETICA, 20, Font.NORMAL, new Color(0, 0, 0));
        Paragraph secondTitle = new Paragraph(
                message.getString("editeLe") + " " + DateUtil.getOutputDate(new Date(), langue), secondFont);

        secondTitle.setAlignment(Element.ALIGN_CENTER);

        document.add(masterTitle);
        document.add(secondTitle);
    } catch (Exception e) {
        throw new NewsEditoException("PdfGenerator.createFirstPage", NewsEditoException.WARNING,
                "NewsEdito.EX_PROBLEM_TO_GENERATE_PAGE_ONE", e);
    }

}

From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java

License:Open Source License

/**
 * Method declaration//from  w  ww.j av  a2 s . com
 * @param section
 * @param complete
 * @see
 */
public static void addPublication(Section section, CompletePublication complete) {
    Font publicationFont = new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 64, 64));

    try {
        Paragraph pub = new Paragraph(complete.getPublicationDetail().getName(), publicationFont);
        Section subsection = section.addSection(pub, 0);

        if (complete.getPublicationDetail().getDescription() != null) {
            subsection.add(new Paragraph(complete.getPublicationDetail().getDescription()));
        }
        if ((complete.getInfoDetail() != null) && (complete.getModelDetail() != null)) {
            String toParse = complete.getModelDetail().getHtmlDisplayer();

            Iterator<InfoTextDetail> textIterator = complete.getInfoDetail().getInfoTextList().iterator();
            Iterator<InfoImageDetail> imageIterator = complete.getInfoDetail().getInfoImageList().iterator();

            int posit = toParse.indexOf("%WA");
            InfoTextDetail textDetail = null;
            Paragraph text = null;
            InfoImageDetail imageDetail = null;
            Image img = null;

            while (posit != -1) {
                if (posit > 0) {
                    toParse = toParse.substring(posit);
                }
                if (toParse.startsWith("%WATXTDATA%")) {
                    if (textIterator.hasNext()) {
                        textDetail = textIterator.next();
                        text = new Paragraph(textDetail.getContent());

                        subsection.add(text);
                    }
                    toParse = toParse.substring(11);
                } else if (toParse.startsWith("%WAIMGDATA%")) {
                    if (imageIterator.hasNext()) {
                        imageDetail = imageIterator.next();
                        String imagePath = FileRepositoryManager
                                .getAbsolutePath(imageDetail.getPK().getComponentName()) + getImagePath()
                                + File.separator + imageDetail.getPhysicalName();
                        SilverTrace.info("NewsEdito", "PDFGenerator.addPublication", "root.MSG_PARAM_VALUE",
                                "imagePath = " + imagePath);
                        img = Image.getInstance(imagePath);

                        subsection.add(img);
                    }
                    toParse = toParse.substring(11);
                }

                // et on recommence
                posit = toParse.indexOf("%WA");
            }
        }

    } catch (Exception e) {
        SilverTrace.warn("NewsEdito", "PdfGenerator.addPublication", "NewsEdito.EX_NO_PUBLI_ADDED");
    }
}

From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java

License:Open Source License

/**
 * Method declaration// www  . ja va  2  s. c o  m
 * @param document
 * @param archiveDetail
 * @param publicationBm
 * @param langue
 * @see
 */
public static void addEditorial(Document document, NodeDetail archiveDetail, PublicationBm publicationBm,
        String langue) throws NewsEditoException {

    SilverTrace.info("NewsEdito", "PdfGenerator.addEditorial", "NewsEdito.MSG_ENTRY_METHOD");

    try {
        ResourceLocator message = new ResourceLocator(
                "com.stratelia.webactiv.newsEdito.multilang.newsEditoBundle", langue);
        Collection<PublicationDetail> pubList = publicationBm.getDetailsByFatherPK(archiveDetail.getNodePK());
        Iterator<PublicationDetail> i = pubList.iterator();

        if (i.hasNext()) {
            try {

                Font publicationFont = new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 64, 64));
                Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255));

                Paragraph cTitle = new Paragraph(message.getString("editorial"), titleFont);
                Chapter chapter = new Chapter(cTitle, 0);

                chapter.setNumberDepth(0);

                PublicationDetail detail = null;
                Paragraph name = null;
                Section subsection = null;
                Image img = null;
                while (i.hasNext()) {

                    detail = i.next();
                    name = new Paragraph(detail.getName(), publicationFont);
                    subsection = chapter.addSection(name, 0);

                    subsection.setNumberDepth(0);

                    if (detail.getDescription() != null) {
                        subsection.add(new Paragraph(detail.getDescription()));

                    }
                    if (detail.getImage() != null) {

                        String imagePath = FileRepositoryManager
                                .getAbsolutePath(detail.getPK().getComponentName()) + getImagePath()
                                + File.separator + detail.getImage();
                        try {
                            SilverTrace.info("NewsEdito", "PDFGenerator.addEditorial", "root.MSG_PARAM_VALUE",
                                    "imagePath = " + imagePath);
                            img = Image.getInstance(imagePath);
                        } catch (Exception e) {
                            SilverTrace.info("NewsEdito", "PDFGenerator.addEditorial",
                                    "NewsEdito.MSG_CANNOT_RETRIEVE_IMAGE", "imagePath = " + imagePath);
                        }
                        if (img == null) {
                            SilverTrace.info("NewsEdito", "PdfGenerator.addEditorial",
                                    "NewsEdito.MSG_CANNOT_RETRIEVE_IMAGE");
                        } else {
                            subsection.add(img);
                        }
                    }
                }
                document.add(chapter);

            } catch (DocumentException de) {
                SilverTrace.warn("NewsEdito", "PdfGenerator.addEditorial", "NewsEdito.EX_NO_EDITO_ADDED");
            }

        }
    } catch (Exception e) {
        throw new NewsEditoException("PdfGenerator.addEditorial", NewsEditoException.WARNING,
                "NewsEdito.EX_PROBLEM_TO_ADD_EDITO", e);
    }

}

From source file:com.tmathmeyer.sentinel.ui.views.day.DayCalendar.java

License:Open Source License

private void generateDay() {
    this.holder.removeAll();
    this.removeAll();
    this.add(scroll, BorderLayout.CENTER);

    JLabel dayTitle = new JLabel(time.toString(titleFmt));
    dayTitle.setFont(new java.awt.Font("DejaVu Sans", Font.BOLD, 25));
    dayTitle.setHorizontalAlignment(SwingConstants.CENTER);
    this.add(dayTitle, BorderLayout.NORTH);

    this.displayableList = getVisibleDisplayables();

    this.current = new DayPanel();
    this.current.setEvents(
            getDisplayablesInInterval(time.withMillisOfDay(0), time.plusDays(1).withMillisOfDay(0)), time);
    this.current.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Colors.BORDER));

    this.holder.add(new DayGridLabel(), BorderLayout.WEST);
    this.holder.add(this.current, BorderLayout.CENTER);

    // notify mini-calendar to change
    MainPanel.getInstance().miniMove(time);
}

From source file:com.tsp.gespro.bo.DegustacionBO.java

/**
 * Representacin impresa PDF//www  .  j  a  v a  2s. c  om
 */
public ByteArrayOutputStream toPdf(UsuarioBO user) throws Exception {

    SimpleDateFormat fecha = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat hora = new SimpleDateFormat("HH:mm:ss");
    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    PdfITextUtil obj = new PdfITextUtil();

    //Tamao de documento (Tamao Carta)
    com.lowagie.text.Document doc = new com.lowagie.text.Document(PageSize.LETTER);

    //Definicin de Fuentes a usar
    Font letraOcho = new Font(Font.HELVETICA, 8, Font.NORMAL);
    Font letraOchoBold = new Font(Font.HELVETICA, 8, Font.BOLD);
    Font letraNueve = new Font(Font.HELVETICA, 9, Font.NORMAL);
    Font letraNueveBold = new Font(Font.HELVETICA, 9, Font.BOLD);
    Font letraNueveBoldRojo = new Font(Font.TIMES_ROMAN, 9, Font.BOLD, Color.red);
    Font letraNueveBoldAzul = new Font(Font.TIMES_ROMAN, 9, Font.BOLD, Color.blue);
    Font letraOchoVerde = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL, Color.green);
    Font letra14Bold = new Font(Font.HELVETICA, 14, Font.BOLD);

    String msgError = "";

    File fileImageLogo = null;
    try {
        if (user != null)
            fileImageLogo = new ImagenPersonalBO(this.conn)
                    .getFileImagenPersonalByEmpresa(user.getUser().getIdEmpresa());
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    try {
        //Preparamos writer de PDF
        PdfWriter writer = PdfWriter.getInstance(doc, baos);
        EventPDF eventPDF = new EventPDF(doc, user, ReportBO.DEGUSTACION_REPRESENTACION_IMPRESA, fileImageLogo);
        writer.setPageEvent(eventPDF);

        //Ajustamos margenes de pgina
        //doc.setMargins(50, 50, 120, 50);
        //doc.setMargins(20, 20, 80, 20);
        doc.setMargins(10, 10, 150, 40);

        //Iniciamos documento
        doc.open();

        //Creamos tabla principal
        PdfPTable mainTable = new PdfPTable(1);
        mainTable.setTotalWidth(550);
        mainTable.setLockedWidth(true);

        //CONTENIDO -------------

        //SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        //Cabecera (Datos Generales)---------------------
        PdfPTable tAux = new PdfPTable(1);

        Cliente clienteDto = null;
        DatosUsuario datosUsuarioVendedor = null;

        try {
            if (this.degustacion.getIdCliente() > 0)
                clienteDto = new ClienteBO(this.degustacion.getIdCliente(), this.conn).getCliente();
            if (this.degustacion.getIdUsuario() > 0)
                datosUsuarioVendedor = new UsuarioBO(this.degustacion.getIdUsuario()).getDatosUsuario();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        //Datos informativos generales
        PdfPTable tInfoGeneral = new PdfPTable(1);
        tInfoGeneral.setTotalWidth(160);
        tInfoGeneral.setLockedWidth(true);

        obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "ID Degustacin",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueveBoldRojo, "" + this.degustacion.getIdDegustacion(),
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);

        obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "Fecha Degustacin",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueve,
                DateManage.dateToStringEspanol(this.degustacion.getFechaApertura()),
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueveBold, Color.lightGray, "Promotor",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);
        obj.agregaCelda(tInfoGeneral, letraNueve,
                datosUsuarioVendedor != null
                        ? (datosUsuarioVendedor.getNombre() + " " + datosUsuarioVendedor.getApellidoPat())
                        : "Sin vendedor asignado",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 1);

        //Pintamos datos informativos Generales en la esquina superior derecha
        PdfContentByte cb = writer.getDirectContent();
        tInfoGeneral.writeSelectedRows(0, -1, doc.right() - 180, doc.top() + 100, cb);

        //Datos de Cliente/Prospecto
        PdfPTable tCliente = new PdfPTable(2);
        tCliente.setTotalWidth(550);
        tCliente.setLockedWidth(true);

        obj.agregaCelda(tCliente, letraNueveBold, Color.lightGray, "Cliente",
                new boolean[] { false, false, false, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0,
                new int[0], 2);

        tAux = new PdfPTable(1);
        tAux.setTotalWidth(275);
        tAux.setLockedWidth(true);

        try {
            obj.agregaCelda(tAux, letraOcho,
                    "Nombre Comercial: " + (clienteDto != null ? clienteDto.getNombreComercial() : ""),
                    new boolean[] { false, true, false, false }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0,
                    new int[0], 1);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        obj.agregaTabla(tCliente, tAux, new boolean[] { false, false, false, false }, Element.ALIGN_LEFT,
                Element.ALIGN_TOP, 0, new int[0], 1);

        obj.agregaCelda(tCliente, letraOcho,
                "" + "DOMICILIO: \n" + (clienteDto != null ? "Calle: " + clienteDto.getCalle() : "") + " "
                        + (clienteDto != null ? clienteDto.getNumero() : "") + " "
                        + (clienteDto != null ? clienteDto.getNumeroInterior() : "")
                        + (clienteDto != null ? " Col: " + clienteDto.getColonia() : "")
                        + (clienteDto != null ? " \nDeleg./Municipio: " + clienteDto.getMunicipio() : "")
                        + (clienteDto != null ? " Estado: " + clienteDto.getEstado() : "")
                        + (clienteDto != null ? " \nC.P. " + clienteDto.getCodigoPostal() : ""),
                new boolean[] { false, true, false, true }, Element.ALIGN_LEFT, Element.ALIGN_TOP, 0,
                new int[0], 1);

        obj.agregaTabla(mainTable, tCliente, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER,
                Element.ALIGN_TOP, 0, new int[0], 1);

        //FIN Cabecera (Datos Generales)-----------------

        //DOBLE SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        int colsDetalles = 6;
        PdfPTable tDetalles = new PdfPTable(colsDetalles);//6);
        tDetalles.setTotalWidth(550);
        tDetalles.setWidths(new int[] { 200, 70, 70, 70, 70, 70 });
        tDetalles.setLockedWidth(true);

        /*CABECERA*/
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Producto Degustado",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Hr Inicio",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Hr Termino",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Inventario Inicial",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Inventario Final",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);
        obj.agregaCelda(tDetalles, letraNueveBold, Color.lightGray, "Piezas Degustadas",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 1);

        /*FIN DE CABECERA*/
        Degustacion[] degustacionDtos = new Degustacion[0];
        try {
            degustacionDtos = this.findDegustaciones(this.degustacion.getIdDegustacion(),
                    this.degustacion.getIdEmpresa(), -1, -1, "");
        } catch (Exception e) {
        }

        //Listado de Productos
        for (Degustacion item : degustacionDtos) {

            if (item != null) {

                Concepto conceptoDto = null;

                try {
                    ConceptoBO conceptoBO = new ConceptoBO(item.getIdConcepto(), this.conn);
                    conceptoDto = conceptoBO.getConcepto();
                } catch (Exception e) {
                }

                //Producto
                obj.agregaCelda(tDetalles, letraOcho, null, conceptoDto.getNombreDesencriptado(),
                        new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP,
                        15, new int[] { 5, 5, 5, 5 }, 1);

                //Inicio
                obj.agregaCelda(tDetalles, letraOcho, null, hora.format(item.getFechaApertura()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED, Element.ALIGN_TOP,
                        15, new int[] { 5, 5, 5, 5 }, 1);

                //Termino
                obj.agregaCelda(tDetalles, letraOcho, null, hora.format(item.getFechaCierre()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

                //Inv inicial 
                obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidad()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

                //inv final 
                obj.agregaCelda(tDetalles, letraOcho, null, "" + (item.getCantidadCierre()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

                //Piezas 
                obj.agregaCelda(tDetalles, letraOcho, null,
                        "" + (item.getCantidad() - item.getCantidadCierre()),
                        new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP, 15,
                        new int[] { 5, 5, 5, 5 }, 1);

            }
        }

        obj.agregaTabla(mainTable, tDetalles, new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_TOP, 0, new int[0], 1);

        //DOBLE SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        /*prods Vendidos durante degustacion*/

        PdfPTable tVenta = new PdfPTable(4);
        tVenta.setTotalWidth(550);
        tVenta.setWidths(new int[] { 70, 140, 170, 120 });
        tVenta.setLockedWidth(true);

        obj.agregaCelda(tVenta, letraNueveBold, Color.lightGray, "Producto Vendido durante Degutacin",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 4);

        Productosvendidos[] pedidoProductoDto = new Productosvendidos[0];

        String filtroBusqueda = " ID_PEDIDO IN ( SELECT ID_PEDIDO FROM sgfens_pedido WHERE ID_EMPRESA = '"
                + this.degustacion.getIdEmpresa() + "' AND ID_TIPO_PEDIDO = 2 AND ID_USUARIO_VENDEDOR = "
                + this.degustacion.getIdUsuario() + " AND " + " ID_ESTATUS_PEDIDO<>2 AND FECHA_PEDIDO BETWEEN '"
                + this.degustacion.getFechaApertura() + "'  AND '" + this.degustacion.getFechaCierre() + "') ";

        try {
            pedidoProductoDto = new ProductosvendidosDaoImpl().findByDynamicWhere(filtroBusqueda, null);
        } catch (Exception e) {
        }

        if (pedidoProductoDto.length > 0) {

            obj.agregaCelda(tVenta, letraOchoBold, null, "Cdigo", new boolean[] { true, true, true, true },
                    Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1);
            obj.agregaCelda(tVenta, letraOchoBold, null, "Nombre", new boolean[] { true, true, true, true },
                    Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15, new int[] { 5, 5, 5, 5 }, 1);
            obj.agregaCelda(tVenta, letraOchoBold, null, "Descripcin",
                    new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                    new int[] { 5, 5, 5, 5 }, 1);
            obj.agregaCelda(tVenta, letraOchoBold, null, "Unidades Vendidas",
                    new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                    new int[] { 5, 5, 5, 5 }, 1);

            for (Productosvendidos pedidoProd : pedidoProductoDto) {

                if (pedidoProd != null) {

                    Concepto conceptoDto = null;
                    try {
                        ConceptoBO conceptoBO = new ConceptoBO(pedidoProd.getIdConcepto(), this.conn);
                        conceptoDto = conceptoBO.getConcepto();
                    } catch (Exception e) {
                    }

                    //Cdigo
                    obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getIdentificacion(),
                            new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED,
                            Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1);

                    //Nombre
                    obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getNombreDesencriptado(),
                            new boolean[] { true, true, true, true }, Element.ALIGN_JUSTIFIED,
                            Element.ALIGN_TOP, 15, new int[] { 5, 5, 5, 5 }, 1);

                    //Descripcin
                    obj.agregaCelda(tVenta, letraOcho, null, conceptoDto.getDescripcion(),
                            new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP,
                            15, new int[] { 5, 5, 5, 5 }, 1);

                    //Unidades Vendidas 
                    obj.agregaCelda(tVenta, letraOcho, null, "" + (pedidoProd.getCantidad()),
                            new boolean[] { true, true, true, true }, Element.ALIGN_RIGHT, Element.ALIGN_TOP,
                            15, new int[] { 5, 5, 5, 5 }, 1);

                }

            }
        } else {

            obj.agregaCelda(tVenta, letraOcho, null, "No se registrarn datos.",
                    new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                    new int[] { 5, 5, 5, 5 }, 4);

        }

        obj.agregaTabla(mainTable, tVenta, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER,
                Element.ALIGN_TOP, 0, new int[0], 1);

        //DOBLE SALTO DE L?NEA
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);
        obj.agregaCelda(mainTable, letraOcho, null, " ", new boolean[] { false, false, false, false },
                Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 0, new int[0], 1);

        /*Comentarios Adicionales*/
        PdfPTable tComenst = new PdfPTable(1);
        tComenst.setTotalWidth(550);
        tComenst.setWidths(new int[] { 550 });
        tComenst.setLockedWidth(true);

        obj.agregaCelda(tComenst, letraNueveBold, Color.lightGray, "Comentarios",
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 2);

        obj.agregaCelda(tComenst, letraOcho, null, this.degustacion.getComentariosCierre(),
                new boolean[] { true, true, true, true }, Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 15,
                new int[] { 5, 5, 5, 5 }, 2);

        obj.agregaTabla(mainTable, tComenst, new boolean[] { true, true, true, true }, Element.ALIGN_CENTER,
                Element.ALIGN_TOP, 0, new int[0], 1);

        //FIN DE CONTENIDO --------

        //Aadimos tabla principal construida al documento
        doc.add(mainTable);
        mainTable.flushContent();

    } catch (Exception ex) {
        msgError = "No se ha podido generar la representacin impresa de la Degustacion en formato PDF:<br/>"
                + ex.toString();
    } finally {
        if (doc.isOpen())
            doc.close();
    }

    if (!msgError.equals("")) {
        throw new Exception(msgError);
    }

    return baos;

}