Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfGState


    {
      final double[] mx = new double[6];
      inverse.getMatrix(mx);
      if (currentFillGState != 255)
      {
        PdfGState gs = fillGState[255];
        if (gs == null)
        {
          gs = new PdfGState();
          gs.setFillOpacity(1);
          fillGState[255] = gs;
        }
        cb.setGState(gs);
      }

      cb.addImage(image, (float) mx[0], (float) mx[1], (float) mx[2], (float) mx[3], (float) mx[4], (float) mx[5]);
    }
    catch (Exception ex)
    {
      PdfGraphics2D.logger.error("Failed to draw the image: ", ex);
      // throw new IllegalArgumentException("Failed to draw the image");
    }
    finally
    {
      if (currentFillGState != 255)
      {
        final PdfGState gs = fillGState[currentFillGState];
        cb.setGState(gs);
      }
    }
    return true;
  }
View Full Code Here


      if (fill)
      {
        if (alpha != currentFillGState)
        {
          currentFillGState = alpha;
          PdfGState gs = fillGState[alpha];
          if (gs == null)
          {
            gs = new PdfGState();
            gs.setFillOpacity((float) alpha / 255.00f);
            fillGState[alpha] = gs;
          }
          cb.setGState(gs);
        }
        cb.setColorFill(color);
      }
      else
      {
        if (alpha != currentStrokeGState)
        {
          currentStrokeGState = alpha;
          PdfGState gs = strokeGState[alpha];
          if (gs == null)
          {
            gs = new PdfGState();
            gs.setStrokeOpacity((float) alpha / 255.0f);
            strokeGState[alpha] = gs;
          }
          cb.setGState(gs);
        }
        cb.setColorStroke(color);
View Full Code Here

   */
  public void drawImage(Image img, Rectangle rect, Rectangle clipRect, float opacity) {
    try {
      template.saveState();
      // opacity
      PdfGState state = new PdfGState();
      state.setFillOpacity(opacity);
      state.setBlendMode(PdfGState.BM_NORMAL);
      template.setGState(state);
      // clipping code
      if (clipRect != null) {
        template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(),
            clipRect.getHeight());
View Full Code Here

    return rect.getBottom() + f * rect.getHeight();
  }

  private void setStroke(Color color, float linewidth, float[] dashArray) {
    // Color and transparency
    PdfGState state = new PdfGState();
    state.setStrokeOpacity(color.getAlpha());
    state.setBlendMode(PdfGState.BM_NORMAL);
    template.setGState(state);
    template.setColorStroke(color);
    // linewidth
    template.setLineWidth(linewidth);
    if (dashArray != null) {
View Full Code Here

    }
  }

  private void setFill(Color color) {
    // Color and transparency
    PdfGState state = new PdfGState();
    state.setFillOpacity(color.getAlpha() / 255f);
    state.setBlendMode(PdfGState.BM_NORMAL);
    template.setGState(state);
    template.setColorFill(color);
  }
View Full Code Here

    {
      final double[] mx = new double[6];
      inverse.getMatrix(mx);
      if (currentFillGState != 255)
      {
        PdfGState gs = fillGState[255];
        if (gs == null)
        {
          gs = new PdfGState();
          gs.setFillOpacity(1);
          fillGState[255] = gs;
        }
        cb.setGState(gs);
      }

      cb.addImage(image, (float) mx[0], (float) mx[1], (float) mx[2], (float) mx[3], (float) mx[4], (float) mx[5]);
    }
    catch (Exception ex)
    {
      PdfGraphics2D.logger.error("Failed to draw the image: ", ex);
      // throw new IllegalArgumentException("Failed to draw the image");
    }
    finally
    {
      if (currentFillGState != 255)
      {
        final PdfGState gs = fillGState[currentFillGState];
        cb.setGState(gs);
      }
    }
    return true;
  }
View Full Code Here

      if (fill)
      {
        if (alpha != currentFillGState)
        {
          currentFillGState = alpha;
          PdfGState gs = fillGState[alpha];
          if (gs == null)
          {
            gs = new PdfGState();
            gs.setFillOpacity((float) alpha / 255.00f);
            fillGState[alpha] = gs;
          }
          cb.setGState(gs);
        }
        cb.setColorFill(color);
      }
      else
      {
        if (alpha != currentStrokeGState)
        {
          currentStrokeGState = alpha;
          PdfGState gs = strokeGState[alpha];
          if (gs == null)
          {
            gs = new PdfGState();
            gs.setStrokeOpacity((float) alpha / 255.0f);
            strokeGState[alpha] = gs;
          }
          cb.setGState(gs);
        }
        cb.setColorStroke(color);
View Full Code Here

            BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI,
                                              false);
            PdfReader reader = new PdfReader(((File) getValue("srcfile"))
                                             .getAbsolutePath());
            int pagecount = reader.getNumberOfPages();
            PdfGState gs1 = new PdfGState();
            gs1.setFillOpacity(opacity);
            String text = (String) getValue("watermark");
            PdfStamper stamp = new PdfStamper(reader, new FileOutputStream(
                    (File) getValue("destfile")));
            float txtwidth = bf.getWidthPoint(text, fontsize);
            for (int i = 1; i <= pagecount; i++) {
View Full Code Here

                    document.add(img);

                    BaseFont bf = BaseFont.createFont("Helvetica",
                            BaseFont.WINANSI,
                            false);
                    PdfGState gs1 = new PdfGState();
                    gs1.setBlendMode(PdfGState.BM_OVERLAY);
                    PdfContentByte cb = writer.getDirectContent();
                    cb.saveState();
                    cb.setGState(gs1);
                    cb.beginText();
                    cb.setFontAndSize(bf, 40);
View Full Code Here

            BaseFont bf = BaseFont.createFont("Helvetica",
                     BaseFont.WINANSI,
                     false);

            PdfGState gs1 = new PdfGState();
            gs1.setBlendMode(PdfGState.BM_OVERLAY);
            PdfContentByte cb = writer.getDirectContent();
            cb.saveState();
            cb.setGState(gs1);
            cb.beginText();
            cb.setFontAndSize(bf, 40);
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.PdfGState

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.