Example usage for com.lowagie.text Font HELVETICA

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

Introduction

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

Prototype

int HELVETICA

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

Click Source Link

Document

a possible value of a font family.

Usage

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

License:Open Source License

/**
 * Method declaration/*from  ww  w  . j a  v  a  2s. c om*/
 * @param document
 * @param title
 * @param titleCount
 * @param publicationBm
 * @return
 * @throws NewsEditoException
 * @see
 */
public static Section addTitle(Document document, NodeDetail title, int titleCount, PublicationBm publicationBm)
        throws NewsEditoException {

    // we define some fonts
    Font titleFont = new Font(Font.HELVETICA, 24, Font.NORMAL, new Color(255, 255, 255));

    Paragraph cTitle = new Paragraph(title.getName(), titleFont);
    Chapter chapter = new Chapter(cTitle, titleCount);

    if (title.getDescription() != null) {
        chapter.add(new Paragraph(title.getDescription()));

    }
    try {
        addPublications(chapter, title, publicationBm);
        document.add(chapter);
    } catch (Exception e) {
        throw new NewsEditoException("PdfGenerator.addTitle", NewsEditoException.WARNING,
                "NewsEdito.EX_NO_TITLE_ADDED", e);
    }

    return chapter;
}

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

License:Open Source License

/**
 * Method declaration//w  w w  . j  a  v a 2 s.c o  m
 * @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//from  ww w.  j a va2s.  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.sumeet.kraiglist.pdfview.PdfReportView.java

@Override
protected void buildPdfDocument(Map<String, Object> model, Document pdfdoc, PdfWriter pdfwriter,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    HttpSession session = request.getSession();
    String name = (String) session.getAttribute("firstname");
    if (name == null) {
        name = "";
    }/*from  w w w .  ja  v  a  2  s . c  om*/

    Font font_helvetica_12_normal_black = new Font(Font.HELVETICA, 12, Font.NORMAL, Color.BLACK);
    Font font_courier_16_italic_blue = new Font(Font.COURIER, 10, Font.ITALIC, Color.BLUE);
    Font font_courier_16_italic_red = new Font(Font.COURIER, 16, Font.ITALIC, Color.BLUE);
    Font font_times_16_bold_green = new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, Color.BLACK);

    Paragraph prg0 = new Paragraph(
            "                                             Terms of Use of MyNEU KRAIGLIST",
            font_helvetica_12_normal_black);
    Paragraph prg1 = new Paragraph(
            "____________________________________________________________________________________________________________",
            font_courier_16_italic_red);
    Paragraph prg2 = new Paragraph("");
    Chunk c1 = new Chunk("Hello " + name + ",", font_courier_16_italic_blue);
    Paragraph prg3 = new Paragraph("PRODUCT SALES : "
            + "The GSI Products listed on this Site are offered for sale solely pursuant to GSIs standard terms and conditions of sale applicable"
            + "to such products. The terms and conditions are accessible for viewing by clicking on the link on each product line home page."
            + "GSI objects to and rejects any other terms that may be proposed by any customer or potential customer. No offers to sell or purchase"
            + "GSI products are valid and binding on GSI unless and until specifically accepted, in writing, by GSI.",
            font_times_16_bold_green);
    //Phrase phr2 = new Phrase("Phrase 2", font_helvetica_16_normal_blue);
    Paragraph prg4 = new Paragraph("");
    Paragraph prg5 = new Paragraph("LICENSE TO USE THIS SITE : "
            + "We at the GSI Group Inc. and its subsidiaries (GSI) are happy to have you as a visitor. We have established the following"
            + "terms and conditions, including our Privacy Statement, as a requirement for visitors using our site. In order to use our site, you"
            + "must agree to these terms and conditions (Terms). BY CHOOSING TO ACCESS AND USE THIS SITE, YOU ARE EXPRESSLY"
            + "AGREEING TO BE LEGALLY BOUND BY THESE TERMS. IF YOU DO NOT AGREE, DO NOT USE OR VIEW THE SITE."
            + "These Terms apply only to the use of this Site and do not supercede any other contractual agreement between you and GSI."
            + "Use of Materials: Upon your agreement to the Terms, GSI grants you the right to view the site and to download materials from"
            + "this site for your personal, non-commercial use. You are not authorized to use the materials for any other purpose. If you do"
            + "download or otherwise reproduce the materials from this Site, you must reproduce all of GSIs proprietary markings, such as"
            + "copyright and trademark notices, in the same form and manner as the original."
            + "Private Pages: Some parts of this Site are not available to the general public, but only to certain business associates of GSI."
            + "These sections may only be accessed by authorized entities and are controlled by password-protected access. If you are not"
            + "authorized to use these sections, then you agree that you will not attempt to gain access. If you are authorized, then by accessing"
            + "those areas, you expressly agree to the supplemental terms that are posted as part of the access process."
            + "No Harmful Use: In exchange for our permission to use this Site, you agree that you will not do anything to harm the functioning"
            + "or content of the Site. You will not attempt to upload, insert or change any information or image to or on this Site, except for providing"
            + "information where prompted by the Site. You agree that you will not take any action that imposes an unreasonably or disproportionately"
            + "large load on the Site or interferes with its functioning. You also agree that you will not use any false identity"
            + "when interacting with the Site, or do anything that is fraudulent, obscene, libelous or legally prohibited."
            + "You may not use any deep-link, page-scrape, robot, spider or any other automatic device, program, algorithm or methodology"
            + "or any similar or equivalent manual process to access, acquire, copy or monitor any portion of the Site or any of its content,"
            + "or in any way reproduce or circumvent the navigational structure or presentation of the Site."
            + "INDEMNITY: YOU AGREE THAT YOU WILL DEFEND, INDEMNIFY AND HOLD HARMLESS GSI, ITS CUSTOMERS, SUPPLIERS"
            + "AND JOINT VENTURE PARTNERS AND THEIR RESPECTIVE EMPLOYEES, OFFICERS, DIRECTORS, CONTRACTORS,"
            + "VENDORS, ASSIGNEES AND AGENTS FOR AND AGAINST ANY COSTS, CLAIMS, DAMAGES, LOSSES, OR"
            + "OTHER LIABILITIES ARISING FROM YOUR USE OF THE SITE IN BREACH OF THESE TERMS OR IN VIOLATION OF THE"
            + "LAW. IF GSI TAKES ANY LEGAL ACTION AGAINST YOU AS A RESULT OF YOUR VIOLATION OF THESE TERMS, YOU"
            + "AGREE THAT YOU WILL BE RESPONSIBLE FOR AND WILL PAY ALL OF GSIS LEGAL FEES IN CONNECTION WITH"
            + "SUCH ACTION. ", font_times_16_bold_green);

    pdfdoc.add(c1);
    pdfdoc.add(prg0);
    pdfdoc.add(prg1);
    pdfdoc.add(prg2);
    pdfdoc.add(prg3);
    pdfdoc.add(prg4);
    pdfdoc.add(prg5);

}

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

/**
 * Representacin impresa PDF/*w  w  w.j  av a 2  s  . c o m*/
 */
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;

}

From source file:desktopbugtracker.export.PdfFont.java

License:Open Source License

public static Font forTitleProject() {
    return new Font(Font.HELVETICA, 36, Font.NORMAL);
}

From source file:desktopbugtracker.export.PdfFont.java

License:Open Source License

public static Font forTitleBug() {
    return new Font(Font.HELVETICA, 20, Font.NORMAL);
}

From source file:desktopbugtracker.export.PdfFont.java

License:Open Source License

public static Font bold() {
    return new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.BOLD);
}

From source file:dinamica.AbstractPDFOutput.java

License:LGPL

/**
 * Receives a byte buffer that should be filled with resulting PDF.
 * @param data Data module that provides recordsets to this output module
 * @param buf Buffer to print PDF, then used to send to browser
 * @throws Throwable/*from w  ww.  ja  va  2  s  .c  om*/
 */
protected void createPDF(GenericTransaction data, ByteArrayOutputStream buf) throws Throwable {

    //pdf objects
    Document doc = new Document();
    PdfWriter docWriter = PdfWriter.getInstance(doc, buf);

    //header
    HeaderFooter header = new HeaderFooter(new Phrase(getHeader()), false);
    header.setBorder(Rectangle.BOTTOM);
    header.setAlignment(Rectangle.ALIGN_CENTER);
    doc.setHeader(header);

    //footer
    HeaderFooter footer = new HeaderFooter(new Phrase(getFooter()), true);
    footer.setBorder(Rectangle.TOP);
    footer.setAlignment(Rectangle.ALIGN_RIGHT);
    doc.setFooter(footer);

    //pagesize
    doc.setPageSize(PageSize.LETTER);

    doc.open();

    //title
    Paragraph t = new Paragraph(getReportTitle(), new Font(Font.HELVETICA, 18f));
    t.setAlignment(Rectangle.ALIGN_CENTER);
    doc.add(t);

    //paragraph
    Paragraph p = new Paragraph("Hello World");
    p.setAlignment(Rectangle.ALIGN_CENTER);
    doc.add(p);

    doc.close();
    docWriter.close();

}

From source file:domain.reports.menu.PDFReportMenu.java

License:LGPL

@Override
protected void createPDF(GenericTransaction data, ByteArrayOutputStream buf) throws Throwable {

    //inicializar documento: tamano de pagina, orientacion, margenes
    Document doc = new Document();
    PdfWriter docWriter = PdfWriter.getInstance(doc, buf);
    doc.setPageSize(PageSize.LETTER.rotate());
    doc.setMargins(30, 30, 30, 40);//  w  w w. j  av a  2 s .co m

    doc.open();

    //crear fonts por defecto
    tblHeaderFont = new Font(Font.HELVETICA, 10f, Font.BOLD);
    tblBodyFont = new Font(Font.HELVETICA, 10f, Font.NORMAL);

    //definir pie de pagina del lado izquierdo
    String footerText = this.getFooter(); //read it from config.xml or web.xml
    String reportDate = StringUtil.formatDate(new java.util.Date(), "dd-MM-yyyy HH:mm");

    //crear template (objeto interno de IText) y manejador de evento 
    //para imprimir el pie de pagina
    bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
    cb = docWriter.getDirectContent();
    tpl = cb.createTemplate(20, 14);
    docWriter.setPageEvent(new PDFPageEvents(footerText, pageXofY, tpl, bf, cb, reportDate));

    //titulo - lo lee de config.xml por defecto
    reportTitle = getReportTitle();
    Paragraph t = new Paragraph(reportTitle, new Font(Font.HELVETICA, 14f, Font.BOLD));
    t.setAlignment(Rectangle.ALIGN_RIGHT);
    doc.add(t);

    //logo
    img = Image.getInstance(getImage(this.getServerBaseURL() + logoPath, false));
    img.scalePercent(100);
    float imgY = doc.top() - img.getHeight();
    float imgX = doc.left();
    img.setAbsolutePosition(imgX, imgY);
    doc.add(img);

    //blank line
    doc.add(new Paragraph(" "));
    //blank line
    doc.add(new Paragraph(" "));
    //blank line
    doc.add(new Paragraph(" "));

    //for each master record print a master/detail section
    MasterDetailReader dataobj = (MasterDetailReader) data;
    Recordset master = dataobj.getRecordset("master");
    master.top();
    while (master.next()) {
        //blank line
        doc.add(new Paragraph(" "));

        //print master section
        doc.add(getGroupMaster(master));

        //print detail section
        doc.add(getGroupDetail(master, dataobj.getDetail(master)));

    }

    //print grand total
    doc.add(new Paragraph(" "));

    doc.close();
    docWriter.close();

}