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 Colorprivate booleanprivate intprivate Stack<PdfCleanUpContext> private Pathprivate Pathprivate PdfCleanUpRegionFilterprivate Pathprivate PdfStamperprivate intprivate Path -
Constructor Summary
ConstructorsConstructorDescriptionPdfCleanUpRenderListener(PdfStamper pdfStamper, PdfCleanUpRegionFilter filter) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when a new text block is beginning (i.e.private voidcleanImage(BufferedImage image, List<Rectangle> areasToBeCleaned) voidvoidclipPath(int rule) Called when the current path should be set as a new clipping path.private voidvoidCalled when a text block has ended (i.e.private PathfilterCurrentPath(Matrix ctm, boolean stroke, int fillingRule, float lineWidth, int lineCapStyle, int lineJoinStyle, float miterLimit, LineDashPattern lineDashPattern) intgetImageAreasToBeCleaned(ImageRenderInfo renderInfo) private byte[]getJPGBytes(BufferedImage image) booleanvoidmodifyPath(PathConstructionRenderInfo renderInfo) Called when the current path is being modified.voidprivate byte[]processImage(byte[] imageBytes, List<Rectangle> areasToBeCleaned) voidregisterNewContext(PdfDictionary resources, PdfContentByte canvas) voidrenderImage(ImageRenderInfo renderInfo) Called when image should be renderedrenderPath(PathPaintingRenderInfo renderInfo) Called when the current path should be rendered.voidrenderText(TextRenderInfo renderInfo) Called when text should be renderedvoidsetClipped(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:RenderListenerCalled when text should be rendered- Specified by:
renderTextin interfaceRenderListener- Parameters:
renderInfo- information specifying what to render
-
renderImage
Description copied from interface:RenderListenerCalled when image should be rendered- Specified by:
renderImagein interfaceRenderListener- Parameters:
renderInfo- information specifying what to render
-
beginTextBlock
public void beginTextBlock()Description copied from interface:RenderListenerCalled when a new text block is beginning (i.e. BT)- Specified by:
beginTextBlockin interfaceRenderListener
-
endTextBlock
public void endTextBlock()Description copied from interface:RenderListenerCalled when a text block has ended (i.e. ET)- Specified by:
endTextBlockin interfaceRenderListener
-
modifyPath
Description copied from interface:ExtRenderListenerCalled when the current path is being modified. E.g. new segment is being added, new subpath is being started etc.- Specified by:
modifyPathin interfaceExtRenderListener- Parameters:
renderInfo- Contains information about the path segment being added to the current path.
-
renderPath
Description copied from interface:ExtRenderListenerCalled when the current path should be rendered.- Specified by:
renderPathin 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:ExtRenderListenerCalled when the current path should be set as a new clipping path.- Specified by:
clipPathin interfaceExtRenderListener- Parameters:
rule- EitherPathPaintingRenderInfo.EVEN_ODD_RULEorPathPaintingRenderInfo.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
-