Package com.itextpdf.text.pdf.parser
Class TextMarginFinder
- java.lang.Object
-
- com.itextpdf.text.pdf.parser.TextMarginFinder
-
- All Implemented Interfaces:
RenderListener
public class TextMarginFinder extends java.lang.Object implements RenderListener
Allows you to find the rectangle that contains all the text in a page.- Since:
- 5.0.2
-
-
Field Summary
Fields Modifier and Type Field Description private Rectangle2D.Float
textRectangle
-
Constructor Summary
Constructors Constructor Description TextMarginFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginTextBlock()
Called when a new text block is beginning (i.e.void
endTextBlock()
Called when a text block has ended (i.e.float
getHeight()
Gets the height of the text block.float
getLlx()
Getter for the left margin.float
getLly()
Getter for the bottom margin.float
getUrx()
Getter for the right margin.float
getUry()
Getter for the top margin.float
getWidth()
Gets the width of the text block.void
renderImage(ImageRenderInfo renderInfo)
Called when image should be renderedvoid
renderText(TextRenderInfo renderInfo)
Method invokes by the PdfContentStreamProcessor.
-
-
-
Field Detail
-
textRectangle
private Rectangle2D.Float textRectangle
-
-
Method Detail
-
renderText
public void renderText(TextRenderInfo renderInfo)
Method invokes by the PdfContentStreamProcessor. Passes a TextRenderInfo for every text chunk that is encountered. We'll use this object to obtain coordinates.- Specified by:
renderText
in interfaceRenderListener
- Parameters:
renderInfo
- information specifying what to render- See Also:
RenderListener.renderText(com.itextpdf.text.pdf.parser.TextRenderInfo)
-
getLlx
public float getLlx()
Getter for the left margin.- Returns:
- the X position of the left margin
-
getLly
public float getLly()
Getter for the bottom margin.- Returns:
- the Y position of the bottom margin
-
getUrx
public float getUrx()
Getter for the right margin.- Returns:
- the X position of the right margin
-
getUry
public float getUry()
Getter for the top margin.- Returns:
- the Y position of the top margin
-
getWidth
public float getWidth()
Gets the width of the text block.- Returns:
- a width
-
getHeight
public float getHeight()
Gets the height of the text block.- Returns:
- a height
-
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
- See Also:
RenderListener.beginTextBlock()
-
endTextBlock
public void endTextBlock()
Description copied from interface:RenderListener
Called when a text block has ended (i.e. ET)- Specified by:
endTextBlock
in interfaceRenderListener
- See Also:
RenderListener.endTextBlock()
-
renderImage
public void renderImage(ImageRenderInfo renderInfo)
Description copied from interface:RenderListener
Called when image should be rendered- Specified by:
renderImage
in interfaceRenderListener
- Parameters:
renderInfo
- information specifying what to render- See Also:
RenderListener.renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo)
-
-