Class TextInfo

java.lang.Object
com.itextpdf.pdfocr.TextInfo

public class TextInfo extends Object
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 Details

    • TextInfo

      public TextInfo()
      Creates a new TextInfo instance.
    • TextInfo

      public TextInfo (TextInfo textInfo)
      Creates a new TextInfo instance from existing one.
      Parameters:
      textInfo - to create from
    • TextInfo

      public TextInfo (String text, com.itextpdf.kernel.geom.Rectangle bbox)
      Creates a new TextInfo instance.
      Parameters:
      text - any text
      bbox - Rectangle describing text bbox
  • Method Details

    • getText

      public String getText()
      Gets text element.
      Returns:
      String
    • setText

      public void setText (String newText)
      Sets text element.
      Parameters:
      newText - retrieved text
    • getBboxRect

      public com.itextpdf.kernel.geom.Rectangle getBboxRect()
      Gets bbox coordinates.
      Returns:
      Rectangle describing text bbox
    • setBboxRect

      public void setBboxRect (com.itextpdf.kernel.geom.Rectangle bbox)
      Sets text bbox.
      Parameters:
      bbox - Rectangle describing text bbox
    • getLogicalStructureTreeItem

      public LogicalStructureTreeItem getLogicalStructureTreeItem()
      Retrieves structure tree item for the text item.
      Returns:
      structure tree item.
    • setLogicalStructureTreeItem

      public void setLogicalStructureTreeItem (LogicalStructureTreeItem logicalStructureTreeItem)
      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 in IOcrEngine.doImageOcr(java.io.File) return value is expected to be in logical order.

      Parameters:
      logicalStructureTreeItem - structure tree item.