Package com.itextpdf.text.pdf.pdfcleanup
Class PdfCleanUpRenderListener
java.lang.Object
com.itextpdf.text.pdf.pdfcleanup.PdfCleanUpRenderListener
- All Implemented Interfaces:
ExtRenderListener
,RenderListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<PdfCleanUpContentChunk>
private static final Color
private boolean
private int
private Stack<PdfCleanUpContext>
private Path
private Path
private PdfCleanUpRegionFilter
private Path
private PdfStamper
private int
private Path
-
Constructor Summary
ConstructorsConstructorDescriptionPdfCleanUpRenderListener
(PdfStamper pdfStamper, PdfCleanUpRegionFilter filter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when a new text block is beginning (i.e.private void
cleanImage
(BufferedImage image, List<Rectangle> areasToBeCleaned) void
void
clipPath
(int rule) Called when the current path should be set as a new clipping path.private void
void
Called when a text block has ended (i.e.private Path
filterCurrentPath
(Matrix ctm, boolean stroke, int fillingRule, float lineWidth, int lineCapStyle, int lineJoinStyle, float miterLimit, LineDashPattern lineDashPattern) int
getImageAreasToBeCleaned
(ImageRenderInfo renderInfo) private byte[]
getJPGBytes
(BufferedImage image) boolean
void
modifyPath
(PathConstructionRenderInfo renderInfo) Called when the current path is being modified.void
private byte[]
processImage
(byte[] imageBytes, List<Rectangle> areasToBeCleaned) void
registerNewContext
(PdfDictionary resources, PdfContentByte canvas) void
renderImage
(ImageRenderInfo renderInfo) Called when image should be renderedrenderPath
(PathPaintingRenderInfo renderInfo) Called when the current path should be rendered.void
renderText
(TextRenderInfo renderInfo) Called when text should be renderedvoid
setClipped
(boolean clipPath)
-
Field Details
-
CLEANED_AREA_FILL_COLOR
-
pdfStamper
-
filter
-
chunks
-
contextStack
-
strNumber
private int strNumber -
unfilteredCurrentPath
-
currentStrokePath
-
currentFillPath
-
newClippingPath
-
clipPath
private boolean clipPath -
clippingRule
private int clippingRule
-
-
Constructor Details
-
PdfCleanUpRenderListener
-
-
Method Details
-
renderText
Description copied from interface:RenderListener
Called when text should be rendered- Specified by:
renderText
in interfaceRenderListener
- Parameters:
renderInfo
- information specifying what to render
-
renderImage
Description copied from interface:RenderListener
Called when image should be rendered- Specified by:
renderImage
in interfaceRenderListener
- 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 interfaceRenderListener
-
endTextBlock
public void endTextBlock()Description copied from interface:RenderListener
Called when a text block has ended (i.e. ET)- Specified by:
endTextBlock
in interfaceRenderListener
-
modifyPath
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 interfaceExtRenderListener
- Parameters:
renderInfo
- Contains information about the path segment being added to the current path.
-
renderPath
Description copied from interface:ExtRenderListener
Called when the current path should be rendered.- Specified by:
renderPath
in interfaceExtRenderListener
- 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 interfaceExtRenderListener
- Parameters:
rule
- EitherPathPaintingRenderInfo.EVEN_ODD_RULE
orPathPaintingRenderInfo.NONZERO_WINDING_RULE
-
isClipped
public boolean isClipped() -
setClipped
public void setClipped(boolean clipPath) -
getClippingRule
public int getClippingRule() -
getCurrentStrokePath
-
getCurrentFillPath
-
getNewClipPath
-
getChunks
-
getContext
-
registerNewContext
-
popContext
public void popContext() -
clearChunks
public void clearChunks() -
getImageAreasToBeCleaned
- Returns:
- null if the image is not allowed (either it is fully covered or ctm == null). List of covered image areas otherwise.
-
processImage
-
cleanImage
-
getJPGBytes
-
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
-