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.FloattextRectangle
-
Constructor Summary
Constructors Constructor Description TextMarginFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginTextBlock()Called when a new text block is beginning (i.e.voidendTextBlock()Called when a text block has ended (i.e.floatgetHeight()Gets the height of the text block.floatgetLlx()Getter for the left margin.floatgetLly()Getter for the bottom margin.floatgetUrx()Getter for the right margin.floatgetUry()Getter for the top margin.floatgetWidth()Gets the width of the text block.voidrenderImage(ImageRenderInfo renderInfo)Called when image should be renderedvoidrenderText(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:
renderTextin 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:RenderListenerCalled when a new text block is beginning (i.e. BT)- Specified by:
beginTextBlockin interfaceRenderListener- See Also:
RenderListener.beginTextBlock()
-
endTextBlock
public void endTextBlock()
Description copied from interface:RenderListenerCalled when a text block has ended (i.e. ET)- Specified by:
endTextBlockin interfaceRenderListener- See Also:
RenderListener.endTextBlock()
-
renderImage
public void renderImage(ImageRenderInfo renderInfo)
Description copied from interface:RenderListenerCalled when image should be rendered- Specified by:
renderImagein interfaceRenderListener- Parameters:
renderInfo- information specifying what to render- See Also:
RenderListener.renderImage(com.itextpdf.text.pdf.parser.ImageRenderInfo)
-
-