Package com.itextpdf.text

Examples of com.itextpdf.text.BaseColor


     */
    public void drawButton(float llx, float lly, float urx, float ury, String text, BaseFont bf, float size) {
        if (llx > urx) { float x = llx; llx = urx; urx = x; }
        if (lly > ury) { float y = lly; lly = ury; ury = y; }
        // black rectangle not filled
        setColorStroke(new BaseColor(0x00, 0x00, 0x00));
        setLineWidth(1);
        setLineCap(0);
        rectangle(llx, lly, urx - llx, ury - lly);
        stroke();
        // silver rectangle filled
        setLineWidth(1);
        setLineCap(0);
        setColorFill(new BaseColor(0xC0, 0xC0, 0xC0));
        rectangle(llx + 0.5f, lly + 0.5f, urx - llx - 1f, ury -lly - 1f);
        fill();
        // white lines
        setColorStroke(new BaseColor(0xFF, 0xFF, 0xFF));
        setLineWidth(1);
        setLineCap(0);
        moveTo(llx + 1f, lly + 1f);
        lineTo(llx + 1f, ury - 1f);
        lineTo(urx - 1f, ury - 1f);
        stroke();
        // dark grey lines
        setColorStroke(new BaseColor(0xA0, 0xA0, 0xA0));
        setLineWidth(1);
        setLineCap(0);
        moveTo(llx + 1f, lly + 1f);
        lineTo(urx - 1f, lly + 1f);
        lineTo(urx - 1f, ury - 1f);
View Full Code Here


        else if ((options & MULTILINE) == 0)
            ptext = removeCRLF(text);
        else
          ptext = text; //fixed by Kazuya Ujihara (ujihara.jp)
        BaseFont ufont = getRealFont();
        BaseColor fcolor = textColor == null ? GrayColor.GRAYBLACK : textColor;
        int rtl = checkRTL(ptext) ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_NO_BIDI;
        float usize = fontSize;
        Phrase phrase = composePhrase(ptext, ufont, fcolor, usize);
        if ((options & MULTILINE) != 0) {
            float width = box.getWidth() - 4 * offsetX - extraMarginLeft;
View Full Code Here

        topFirst = first;
        app.saveState();
        app.rectangle(offsetX, offsetX, box.getWidth() - 2 * offsetX, box.getHeight() - 2 * offsetX);
        app.clip();
        app.newPath();
        BaseColor fcolor = textColor == null ? GrayColor.GRAYBLACK : textColor;


        // background boxes for selected value[s]
        app.setColorFill(new BaseColor(10, 36, 106));
        for (int curVal = 0; curVal < choiceSelections.size(); ++curVal) {
          int curChoice = (choiceSelections.get( curVal )).intValue();
          // only draw selections within our display range... not strictly necessary with
          // that clipping rect from above, but it certainly doesn't hurt either
          if (curChoice >= first && curChoice <= last) {
            app.rectangle(offsetX, offsetX + h - (curChoice - first + 1) * leading, box.getWidth() - 2 * offsetX, leading);
            app.fill();
          }
        }
        float xp = offsetX * 2;
        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);
            // highlight selected values against their (presumably) darker background
            BaseColor textCol = choiceSelections.contains( new Integer( idx )) ? GrayColor.GRAYWHITE : fcolor;
            Phrase phrase = composePhrase(ptext, ufont, textCol, usize);
            ColumnText.showTextAligned(app, Element.ALIGN_LEFT, phrase, xp, yp, 0, rtl, 0);
        }
        app.restoreState();
        app.endVariableText();
View Full Code Here

      style |= Font.STRIKETHRU;
    String value = props.getProperty(ElementTags.SIZE);
    float size = 12;
    if (value != null)
      size = Float.parseFloat(value);
    BaseColor color = Markup.decodeColor(props.getProperty("color"));
    String encoding = props.getProperty("encoding");
    if (encoding == null)
      encoding = BaseFont.WINANSI;
    return fontImp.getFont(face, encoding, true, size, style, color);
  }
View Full Code Here

      } else if (key.equals(Markup.CSS_KEY_TEXTDECORATION)) {
        String ss = prop.getProperty(key).trim().toLowerCase();
        if (ss.equals(Markup.CSS_VALUE_UNDERLINE))
          h.put("u", null);
      } else if (key.equals(Markup.CSS_KEY_COLOR)) {
        BaseColor c = Markup.decodeColor(prop.getProperty(key));
        if (c != null) {
          int hh = c.getRGB();
          String hs = Integer.toHexString(hh);
          hs = "000000" + hs;
          hs = "#" + hs.substring(hs.length() - 6);
          h.put("color", hs);
        }
View Full Code Here

      } else if (key.equals(Markup.CSS_KEY_TEXTDECORATION)) {
        String ss = prop.getProperty(key).trim().toLowerCase();
        if (ss.equals(Markup.CSS_VALUE_UNDERLINE))
          h.put("u", null);
      } else if (key.equals(Markup.CSS_KEY_COLOR)) {
        BaseColor c = Markup.decodeColor(prop.getProperty(key));
        if (c != null) {
          int hh = c.getRGB();
          String hs = Integer.toHexString(hh);
          hs = "000000" + hs;
          hs = "#" + hs.substring(hs.length() - 6);
          h.put("color", hs);
        }
View Full Code Here

    if (name.startsWith("#")) {
      if (name.length() == 4) {
        c[0] = Integer.parseInt(name.substring(1, 2), 16) * 16;
        c[1] = Integer.parseInt(name.substring(2, 3), 16) * 16;
        c[2] = Integer.parseInt(name.substring(3), 16) * 16;
        return new BaseColor(c[0], c[1], c[2], c[3]);
      }
      if (name.length() == 7) {
        c[0] = Integer.parseInt(name.substring(1, 3), 16);
        c[1] = Integer.parseInt(name.substring(3, 5), 16);
        c[2] = Integer.parseInt(name.substring(5), 16);
        return new BaseColor(c[0], c[1], c[2], c[3]);
      }
      throw new IllegalArgumentException(MessageLocalization.getComposedMessage("unknown.color.format.must.be.rgb.or.rrggbb"));
    }
        else if (name.startsWith("rgb(")) {
            StringTokenizer tok = new StringTokenizer(name, "rgb(), \t\r\n\f");
            for (int k = 0; k < 3; ++k) {
                String v = tok.nextToken();
                if (v.endsWith("%"))
                    c[k] = Integer.parseInt(v.substring(0, v.length() - 1)) * 255 / 100;
                else
                    c[k] = Integer.parseInt(v);
                if (c[k] < 0)
                    c[k] = 0;
                else if (c[k] > 255)
                    c[k] = 255;
            }
            return new BaseColor(c[0], c[1], c[2], c[3]);
        }
    name = name.toLowerCase();
    if (!NAMES.containsKey(name))
      throw new IllegalArgumentException("Color '" + name
          + "' not found.");
    c = NAMES.get(name);
    return new BaseColor(c[0], c[1], c[2], c[3]);
  }
View Full Code Here

    {
        tablePDF = new PdfPTable(this.model.getNumberOfColumns());
        tablePDF.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
        tablePDF.setWidthPercentage(100);

        smallFont = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.NORMAL, new BaseColor(0, 0, 0));

    }
View Full Code Here

     * Obtain the font used to render text in the table; Meant to be overriden if a different font is desired.
     * @return The font used to render text in the table.
     */
    protected Font getTableFont()
    {
        return FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL, new BaseColor(0x00, 0x00, 0x00));
    }
View Full Code Here

     * Obtain the caption font; Meant to be overriden if a different style is desired.
     * @return The caption font.
     */
    protected Font getCaptionFont()
    {
        return FontFactory.getFont(FontFactory.HELVETICA, 17, Font.BOLD, new BaseColor(0x00, 0x00, 0x00));
    }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.BaseColor

Copyright © 2018 www.massapicom. 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.