Package com.itextpdf.text

Examples of com.itextpdf.text.BaseColor


        String libPath = URLDecoder.decode(new File(Utilities.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent(), "UTF-8");
        return (new File(libPath)).getParent();
    }

    public static BaseColor getColor(String c) {
        return new BaseColor(Color.decode(c).getRGB());
    }
View Full Code Here


   * @param cell
   * @param canvases
   * @since  2.1.6  extra parameter currentMaxHeight
   */
  public void writeBorderAndBackground(float xPos, float yPos, float currentMaxHeight, PdfPCell cell, PdfContentByte[] canvases) {
    BaseColor background = cell.getBackgroundColor();
    if (background != null || cell.hasBorders()) {
      // Add xPos resp. yPos to the cell's coordinates for absolute coordinates
      float right = cell.getRight() + xPos;
      float top = cell.getTop() + yPos;
      float left = cell.getLeft() + xPos;
View Full Code Here

      if (tmpWidth > 0) percentage = tmpWidth;
      if (!width.endsWith("%"))
        percentage = 100; // Treat a pixel width as 100% for now.
    }
    // line color
    BaseColor lineColor = null;
    // alignment
    int align = HtmlUtilities.alignmentValue(attrs.get(HtmlTags.ALIGN));
    return new LineSeparator(lineWidth, percentage, lineColor, align, offset);
  }
View Full Code Here

      } else if (key.equals(HtmlTags.TEXTDECORATION)) {
        String ss = prop.getProperty(key).trim().toLowerCase();
        if (ss.equals(HtmlTags.UNDERLINE))
          h.put(HtmlTags.U, null);
      } else if (key.equals(HtmlTags.COLOR)) {
        BaseColor c = HtmlUtilities.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(HtmlTags.COLOR, hs);
        }
View Full Code Here

            if (chunk.font().compareTo(currentFont) != 0) {
                currentFont = chunk.font();
                text.setFontAndSize(currentFont.getFont(), currentFont.size());
            }
            BaseColor color = chunk.color();
            Float charSpace = (Float)chunk.getAttribute(Chunk.CHAR_SPACING);
            // no char space setting means "leave it as is".
            if (charSpace != null && !curCharSpace.equals(charSpace)) {
              curCharSpace = charSpace.floatValue();
              text.setCharacterSpacing(curCharSpace);
View Full Code Here

                    else if (operator.equals("rg")) {
                        if (stack.size() >= 3) {
                            float red = new Float(stack.get(stack.size() - 3)).floatValue();
                            float green = new Float(stack.get(stack.size() - 2)).floatValue();
                            float blue = new Float(stack.get(stack.size() - 1)).floatValue();
                            ret[DA_COLOR] = new BaseColor(red, green, blue);
                        }
                    }
                    else if (operator.equals("k")) {
                        if (stack.size() >= 4) {
                            float cyan = new Float(stack.get(stack.size() - 4)).floatValue();
View Full Code Here

        }
        //rotation, border and background color
        PdfDictionary mk = merged.getAsDict(PdfName.MK);
        if (mk != null) {
            PdfArray ar = mk.getAsArray(PdfName.BC);
            BaseColor border = getMKColor(ar);
            tx.setBorderColor(border);
            if (border != null)
                tx.setBorderWidth(1);
            ar = mk.getAsArray(PdfName.BG);
            tx.setBackgroundColor(getMKColor(ar));
View Full Code Here

            return null;
        switch (ar.size()) {
            case 1:
                return new GrayColor(ar.getAsNumber(0).floatValue());
            case 3:
                return new BaseColor(ExtendedColor.normalize(ar.getAsNumber(0).floatValue()), ExtendedColor.normalize(ar.getAsNumber(1).floatValue()), ExtendedColor.normalize(ar.getAsNumber(2).floatValue()));
            case 4:
                return new CMYKColor(ar.getAsNumber(0).floatValue(), ar.getAsNumber(1).floatValue(), ar.getAsNumber(2).floatValue(), ar.getAsNumber(3).floatValue());
            default:
                return null;
        }
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( Integer.valueOf( 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

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.