Class PdfCleanUpRenderListener

java.lang.Object
com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRenderListener
All Implemented Interfaces:
ExtRenderListener, RenderListener

class PdfCleanUpRenderListener extends Object implements ExtRenderListener
  • Field Details

    • CLEANED_AREA_FILL_COLOR

      private static final Color CLEANED_AREA_FILL_COLOR
    • pdfStamper

      private PdfStamper pdfStamper
    • filter

      private PdfCleanUpRegionFilter filter
    • chunks

      private List<PdfCleanUpContentChunk> chunks
    • contextStack

      private Stack<PdfCleanUpContext> contextStack
    • strNumber

      private int strNumber
    • unfilteredCurrentPath

      private Path unfilteredCurrentPath
    • currentStrokePath

      private Path currentStrokePath
    • currentFillPath

      private Path currentFillPath
    • newClippingPath

      private Path newClippingPath
    • clipPath

      private boolean clipPath
    • clippingRule

      private int clippingRule
  • Constructor Details

  • Method Details

    • renderText

      public void renderText(TextRenderInfo renderInfo)
      Description copied from interface: RenderListener
      Called when text should be rendered
      Specified by:
      renderText in interface RenderListener
      Parameters:
      renderInfo - information specifying what to render
    • renderImage

      public void renderImage(ImageRenderInfo renderInfo)
      Description copied from interface: RenderListener
      Called when image should be rendered
      Specified by:
      renderImage in interface RenderListener
      Parameters:
      renderInfo - information specifying what to render
    • beginTextBlock

      public void beginTextBlock()
      Description copied from interface: RenderListener
      Called when a new text block is beginning (i.e. BT)
      Specified by:
      beginTextBlock in interface RenderListener
    • endTextBlock

      public void endTextBlock()
      Description copied from interface: RenderListener
      Called when a text block has ended (i.e. ET)
      Specified by:
      endTextBlock in interface RenderListener
    • modifyPath

      public void modifyPath(PathConstructionRenderInfo renderInfo)
      Description copied from interface: ExtRenderListener
      Called when the current path is being modified. E.g. new segment is being added, new subpath is being started etc.
      Specified by:
      modifyPath in interface ExtRenderListener
      Parameters:
      renderInfo - Contains information about the path segment being added to the current path.
    • renderPath

      public Path renderPath(PathPaintingRenderInfo renderInfo)
      Description copied from interface: ExtRenderListener
      Called when the current path should be rendered.
      Specified by:
      renderPath in interface ExtRenderListener
      Parameters:
      renderInfo - Contains information about the current path which should be rendered.
      Returns:
      The path which can be used as a new clipping path.
    • clipPath

      public void clipPath(int rule)
      Description copied from interface: ExtRenderListener
      Called when the current path should be set as a new clipping path.
      Specified by:
      clipPath in interface ExtRenderListener
      Parameters:
      rule - Either PathPaintingRenderInfo.EVEN_ODD_RULE or PathPaintingRenderInfo.NONZERO_WINDING_RULE
    • isClipped

      public boolean isClipped()
    • setClipped

      public void setClipped(boolean clipPath)
    • getClippingRule

      public int getClippingRule()
    • getCurrentStrokePath

      public Path getCurrentStrokePath()
    • getCurrentFillPath

      public Path getCurrentFillPath()
    • getNewClipPath

      public Path getNewClipPath()
    • getChunks

      public List<PdfCleanUpContentChunk> getChunks()
    • getContext

      public PdfCleanUpContext getContext()
    • registerNewContext

      public void registerNewContext(PdfDictionary resources, PdfContentByte canvas)
    • popContext

      public void popContext()
    • clearChunks

      public void clearChunks()
    • getImageAreasToBeCleaned

      private List<Rectangle> getImageAreasToBeCleaned(ImageRenderInfo renderInfo)
      Returns:
      null if the image is not allowed (either it is fully covered or ctm == null). List of covered image areas otherwise.
    • processImage

      private byte[] processImage(byte[] imageBytes, List<Rectangle> areasToBeCleaned)
    • cleanImage

      private void cleanImage(BufferedImage image, List<Rectangle> areasToBeCleaned)
    • getJPGBytes

      private byte[] getJPGBytes(BufferedImage image)
    • filterCurrentPath

      private Path filterCurrentPath(Matrix ctm, boolean stroke, int fillingRule, float lineWidth, int lineCapStyle, int lineJoinStyle, float miterLimit, LineDashPattern lineDashPattern)
      Parameters:
      fillingRule - If the path is contour, pass any value.
    • closeOutputStream

      private void closeOutputStream(OutputStream os)