Package com.itextpdf.pdfocr
Class TextInfo
java.lang.Object
com.itextpdf.pdfocr.TextInfo
This class describes how recognized text is positioned on the image providing bbox for each text item (could be a line or a word).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.itextpdf.kernel.geom.RectangleGets bbox coordinates.Retrieves structure tree item for the text item.Gets the text orientation.getText()Gets text element.voidsetBboxRect(com.itextpdf.kernel.geom.Rectangle bbox) Sets text bbox.voidsetLogicalStructureTreeItem(LogicalStructureTreeItem logicalStructureTreeItem) Sets logical structure tree parent item for the text info.voidsetOrientation(TextOrientation orientation) Sets the text orientation.voidSets text element.
-
Constructor Details
-
TextInfo
public TextInfo()Creates a newTextInfoinstance. -
TextInfo
Creates a newTextInfoinstance from existing one.- Parameters:
-
textInfo- to create from
-
TextInfo
Creates a newTextInfoinstance.- Parameters:
-
text- any text -
bbox-Rectangledescribing text bbox
-
TextInfo
Creates a newTextInfoinstance.- Parameters:
-
text- any text -
bbox-Rectangledescribing text bbox -
orientation- orientation of the text
-
-
Method Details
-
getText
Gets text element.- Returns:
- String
-
setText
Sets text element.- Parameters:
-
newText- retrieved text
-
getBboxRect
public com.itextpdf.kernel.geom.Rectangle getBboxRect()Gets bbox coordinates.- Returns:
-
Rectangledescribing text bbox
-
setBboxRect
public void setBboxRect(com.itextpdf.kernel.geom.Rectangle bbox) Sets text bbox.- Parameters:
-
bbox-Rectangledescribing text bbox
-
getOrientation
Gets the text orientation.- Returns:
-
TextOrientationdescribing the orientation of the text (i.e. rotation)
-
setOrientation
Sets the text orientation.- Parameters:
-
orientation-TextOrientationdescribing the orientation of the text (i.e. rotation)
-
getLogicalStructureTreeItem
Retrieves structure tree item for the text item.- Returns:
- structure tree item.
-
setLogicalStructureTreeItem
Sets logical structure tree parent item for the text info. It allows to organize text chunks into logical hierarchy, e.g. specify document paragraphs, tables, etc.If LogicalStructureTreeItem is set, then the list of
TextInfos inIOcrEngine.doImageOcr(java.io.File)return value is expected to be in logical order.- Parameters:
-
logicalStructureTreeItem- structure tree item.
-