Examples of Phrase


Examples of com.itextpdf.text.Phrase

  public void align(int col, String alignment) { alignments[col] = alignment;  }

  private int cellcount = 0;
  public void cell(int colspan, String txt, String align) {
    Font f = new Font(fontfamily, fontsize, fontstyle);
    PdfPCell c = new PdfPCell(new Phrase(txt,f));
    int col = cellcount % alignments.length;
    String al = alignments[col];
    if (al != null) {
      //print("align: " + col + " " + al);
      if ("right".equals(al)) c.setHorizontalAlignment(Element.ALIGN_RIGHT);
View Full Code Here

Examples of com.itextpdf.text.Phrase

        tabla = new PdfPTable(headers.length);
        for (int i = 0; i < headers.length; i++) {
          String header = headers[i];
          PdfPCell cell = new PdfPCell();
          cell.setGrayFill(0.9f);
          cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
              FontFamily.HELVETICA, 10, Font.BOLD)));
          tabla.addCell(cell);
        }
        tabla.completeRow();

        while (iteNovedades.hasNext()) {
          BitacoraLN falla = iteNovedades.next();
          PdfPCell cell0 = new PdfPCell();
          PdfPCell cell1 = new PdfPCell();
          PdfPCell cell2 = new PdfPCell();

          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
          String fecha = sdf.format(falla.getFecha());
          cell0.setPhrase(new Phrase(fecha, new Font(
              FontFamily.HELVETICA, 10, Font.NORMAL)));
          cell1.setPhrase(new Phrase(falla.getEquipoNombre(),
              new Font(FontFamily.HELVETICA, 10, Font.NORMAL)));
          cell2.setPhrase(new Phrase(falla.getComentario().getValue(), new Font(
              FontFamily.HELVETICA, 10, Font.NORMAL)));
          tabla.addCell(cell0);
          tabla.addCell(cell1);
          tabla.addCell(cell2);
          tabla.completeRow();
View Full Code Here

Examples of com.itextpdf.text.Phrase

          for (int i = 0; i < headers.length; i++) {
            String header = headers[i];
            PdfPCell cell = new PdfPCell();
            cell.setGrayFill(0.9f);
            cell.setPhrase(new Phrase(header.toUpperCase(),
                new Font(FontFamily.HELVETICA, 10, Font.BOLD)));
            tabla.addCell(cell);
          }
          tabla.completeRow();
          while (iteNovedadesfallas.hasNext()) {

            BitacoraLN bitacora = iteNovedadesfallas.next();
            PdfPCell cell0 = new PdfPCell();
            PdfPCell cell1 = new PdfPCell();
            PdfPCell cell2 = new PdfPCell();
            PdfPCell cell3 = new PdfPCell();
            PdfPCell cell4 = new PdfPCell();
            SimpleDateFormat sdf = new SimpleDateFormat(
                "dd/MM/yyyy");
            String fecha = sdf.format(bitacora.getFecha());
            cell0.setPhrase(new Phrase(fecha, new Font(
                FontFamily.HELVETICA, 8, Font.NORMAL)));
            if (bitacora.getUsuarioNombre() != null) {
              cell1.setPhrase(new Phrase(bitacora
                  .getUsuarioNombre(), new Font(
                  FontFamily.HELVETICA, 8, Font.NORMAL)));
            } else {
              cell1.setPhrase(new Phrase("", new Font(
                  FontFamily.HELVETICA, 8, Font.NORMAL)));
            }
            cell2.setPhrase(new Phrase(bitacora.getTurnoNombre(),
                new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
            cell3.setPhrase(new Phrase(bitacora.getEquipoNombre(),
                new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
            cell4.setPhrase(new Phrase(bitacora.getComentario().getValue(),
                new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
            tabla.addCell(cell0);
            tabla.addCell(cell1);
            tabla.addCell(cell2);
            tabla.addCell(cell3);
View Full Code Here

Examples of com.itextpdf.text.Phrase

       
        for (int i = 0; i < headers.length; i++) {
          String header = headers[i];
          PdfPCell cell = new PdfPCell();
          cell.setGrayFill(0.9f);
          cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
              FontFamily.HELVETICA, 10, Font.BOLD)));
          tabla.addCell(cell);
        }
        tabla.completeRow();

        while (iteFallas.hasNext()) {
          FallaLN falla = iteFallas.next();
          PdfPCell cell0 = new PdfPCell();
          PdfPCell cell1 = new PdfPCell();
          PdfPCell cell2 = new PdfPCell();

          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
          String fecha = sdf.format(falla.getFecha());
          cell0.setPhrase(new Phrase(fecha, new Font(
              FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell1.setPhrase(new Phrase(falla.getEquipoNombre(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell2.setPhrase(new Phrase(falla.getProblema(), new Font(
              FontFamily.HELVETICA, 8, Font.NORMAL)));
          tabla.addCell(cell0);
          tabla.addCell(cell1);
          tabla.addCell(cell2);
          tabla.completeRow();
        }
      } else if (tipo.equals("1")) {// novedad
        if (texto.trim().length() > 0) {
          novedadList = ReporteLNBO.reporteNovedades(fechaini,
              fechater, texto, idEquipo);
        } else {
          novedadList = ReporteLNBO.reporteNovedadesSinTexto(
              fechaini, fechater, idEquipo);
        }
        Iterator<BitacoraLN> iteNovedadesfallas = novedadList
            .iterator();
        String[] headers = new String[] { "Fecha", "Usuario", "Turno",
            "Equipo", "Novedad" };
        tabla = new PdfPTable(headers.length);
        tabla.setWidthPercentage(100);
       
       
        float[] widths = new float[] { 2f, 2f, 1f,2f, 5f };
       
        tabla.setWidths(widths);
       
        for (int i = 0; i < headers.length; i++) {
          String header = headers[i];
          PdfPCell cell = new PdfPCell();
          cell.setGrayFill(0.9f);
          cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
              FontFamily.HELVETICA, 10, Font.BOLD)));
          tabla.addCell(cell);
        }
        tabla.completeRow();
        while (iteNovedadesfallas.hasNext()) {

          BitacoraLN bitacora = iteNovedadesfallas.next();
          PdfPCell cell0 = new PdfPCell();
          PdfPCell cell1 = new PdfPCell();
          PdfPCell cell2 = new PdfPCell();
          PdfPCell cell3 = new PdfPCell();
          PdfPCell cell4 = new PdfPCell();
          SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
          String fecha = sdf.format(bitacora.getFecha());
          cell0.setPhrase(new Phrase(fecha, new Font(
              FontFamily.HELVETICA, 8, Font.NORMAL)));
          if (bitacora.getUsuarioNombre() != null) {
            cell1.setPhrase(new Phrase(bitacora.getUsuarioNombre(),
                new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          } else {
            cell1.setPhrase(new Phrase("", new Font(
                FontFamily.HELVETICA, 8, Font.NORMAL)));
          }
          cell2.setPhrase(new Phrase(bitacora.getTurnoNombre(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell3.setPhrase(new Phrase(bitacora.getEquipoNombre(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          cell4.setPhrase(new Phrase(bitacora.getComentario().getValue(),
              new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
          tabla.addCell(cell0);
          tabla.addCell(cell1);
          tabla.addCell(cell2);
          tabla.addCell(cell3);
View Full Code Here

Examples of com.itextpdf.text.Phrase

        imageCell.setBorder(Rectangle.NO_BORDER);
        head.addCell(imageCell);

        Font catFont = new Font(Font.FontFamily.HELVETICA, 16,
            Font.BOLD);
        textCell = new PdfPCell(new Phrase("Reporte de Novedades: "
            + negocio, catFont));
        textCell.setBorder(Rectangle.NO_BORDER);
        head.addCell(textCell);

        head.setTotalWidth(page.getWidth() - document.leftMargin()
View Full Code Here

Examples of com.itextpdf.text.Phrase

                imageCell.setBorder(Rectangle.NO_BORDER);
                head.addCell(imageCell);

                Font catFont = new Font(Font.FontFamily.HELVETICA, 16,
                  Font.BOLD);
                textCell = new PdfPCell(new Phrase("Reporte de Novedades: " + negocio,catFont));
                textCell.setBorder(Rectangle.NO_BORDER);
                head.addCell(textCell);

                head.setTotalWidth(page.getWidth() - document.leftMargin()
                                - document.rightMargin());
View Full Code Here

Examples of com.lowagie.text.Phrase

            ((Chunk)p.get(k)).getFont().setSize(size);
        }
    }
   
    private Phrase composePhrase(String text, BaseFont ufont, Color color, float fontSize) {
        Phrase phrase = null;
        if (extensionFont == null && (substitutionFonts == null || substitutionFonts.isEmpty()))
            phrase = new Phrase(new Chunk(text, new Font(ufont, fontSize, 0, color)));
        else {
            FontSelector fs = new FontSelector();
            fs.addFont(new Font(ufont, fontSize, 0, color));
            if (extensionFont != null)
                fs.addFont(new Font(extensionFont, fontSize, 0, color));
View Full Code Here

Examples of com.lowagie.text.Phrase

        }
        int rtl = checkRTL(ptext) ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_NO_BIDI;
        if ((options & MULTILINE) == 0) {
            ptext = removeCRLF(text);
        }
        Phrase phrase = composePhrase(ptext, ufont, fcolor, fontSize);
        if ((options & MULTILINE) != 0) {
            float usize = fontSize;
            float width = box.getWidth() - 4 * offsetX - extraMarginLeft;
            float factor = ufont.getFontDescriptor(BaseFont.BBOXURY, 1) - ufont.getFontDescriptor(BaseFont.BBOXLLY, 1);
            ColumnText ct = new ColumnText(null);
            if (usize == 0) {
                usize = h / factor;
                if (usize > 4) {
                    if (usize > 12)
                        usize = 12;
                    float step = Math.max((usize - 4) / 10, 0.2f);
                    ct.setSimpleColumn(0, -h, width, 0);
                    ct.setAlignment(alignment);
                    ct.setRunDirection(rtl);
                    for (; usize > 4; usize -= step) {
                        ct.setYLine(0);
                        changeFontSize(phrase, usize);
                        ct.setText(phrase);
                        ct.setLeading(factor * usize);
                        int status = ct.go(true);
                        if ((status & ColumnText.NO_MORE_COLUMN) == 0)
                            break;
                    }
                }
                if (usize < 4) {
                    usize = 4;
                }
            }
            changeFontSize(phrase, usize);
            ct.setCanvas(app);
            float leading = usize * factor;
            float offsetY = offsetX + h - ufont.getFontDescriptor(BaseFont.BBOXURY, usize);
            ct.setSimpleColumn(extraMarginLeft + 2 * offsetX, -20000, box.getWidth() - 2 * offsetX, offsetY + leading);
            ct.setLeading(leading);
            ct.setAlignment(alignment);
            ct.setRunDirection(rtl);
            ct.setText(phrase);
            ct.go();
        }
        else {
            float usize = fontSize;
            if (usize == 0) {
                float maxCalculatedSize = h / (ufont.getFontDescriptor(BaseFont.BBOXURX, 1) - ufont.getFontDescriptor(BaseFont.BBOXLLY, 1));
                changeFontSize(phrase, 1);
                float wd = ColumnText.getWidth(phrase, rtl, 0);
                if (wd == 0)
                    usize = maxCalculatedSize;
                else
                    usize = (box.getWidth() - extraMarginLeft - 4 * offsetX) / wd;
                if (usize > maxCalculatedSize)
                    usize = maxCalculatedSize;
                if (usize < 4)
                    usize = 4;
            }
            changeFontSize(phrase, usize);
            float offsetY = offX + ((box.getHeight() - 2*offX) - ufont.getFontDescriptor(BaseFont.ASCENT, usize)) / 2;
            if (offsetY < offX)
                offsetY = offX;
            if (offsetY - offX < -ufont.getFontDescriptor(BaseFont.DESCENT, usize)) {
                float ny = -ufont.getFontDescriptor(BaseFont.DESCENT, usize) + offX;
                float dy = box.getHeight() - offX - ufont.getFontDescriptor(BaseFont.ASCENT, usize);
                offsetY = Math.min(ny, Math.max(offsetY, dy));
            }
            if ((options & COMB) != 0 && maxCharacterLength > 0) {
                int textLen = Math.min(maxCharacterLength, ptext.length());
                int position = 0;
                if (alignment == Element.ALIGN_RIGHT) {
                    position = maxCharacterLength - textLen;
                }
                else if (alignment == Element.ALIGN_CENTER) {
                    position = (maxCharacterLength - textLen) / 2;
                }
                float step = (box.getWidth() - extraMarginLeft) / maxCharacterLength;
                float start = step / 2 + position * step;
                if (textColor == null)
                    app.setGrayFill(0);
                else
                    app.setColorFill(textColor);
                app.beginText();
                for (int k = 0; k < phrase.size(); ++k) {
                    Chunk ck = (Chunk)phrase.get(k);
                    BaseFont bf = ck.getFont().getBaseFont();
                    app.setFontAndSize(bf, usize);
                    StringBuffer sb = ck.append("");
                    for (int j = 0; j < sb.length(); ++j) {
                        String c = sb.substring(j, j + 1);
View Full Code Here

Examples of com.lowagie.text.Phrase

        float yp = offsetX + h - ufont.getFontDescriptor(BaseFont.BBOXURY, usize);
        for (int idx = first; idx < last; ++idx, yp -= leading) {
            String ptext = choices[idx];
            int rtl = checkRTL(ptext) ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_NO_BIDI;
            ptext = removeCRLF(ptext);
            Phrase phrase = composePhrase(ptext, ufont, (idx == topChoice) ? GrayColor.GRAYWHITE : fcolor, usize);
            ColumnText.showTextAligned(app, Element.ALIGN_LEFT, phrase, xp, yp, 0, rtl, 0);
        }
        app.restoreState();
        app.endVariableText();
        return app;
View Full Code Here

Examples of com.lowagie.text.Phrase

           
            float moveTextX = l.indentLeft() - indentLeft() + indentation.indentLeft + indentation.listIndentLeft + indentation.sectionIndentLeft;
            text.moveText(moveTextX, -l.height());
            // is the line preceded by a symbol?
            if (l.listSymbol() != null) {
                ColumnText.showTextAligned(graphics, Element.ALIGN_LEFT, new Phrase(l.listSymbol()), text.getXTLM() - l.listIndent(), text.getYTLM(), 0);
            }
           
            currentValues[0] = currentFont;
           
            writeLineToContent(l, text, graphics, currentValues, writer.getSpaceCharRatio());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.