Search Results for

    Show / Hide Table of Contents

    Class OcrResult.Block

    Represents a block of text containing zero or more paragraphs.

    Inheritance
    System.Object
    OcrResult.OcrResultElement
    OcrResult.OcrResultTextElement
    OcrResult.Block
    Implements
    IronSoftware.Abstractions.Pdf.IDocumentTextObject
    IronSoftware.Abstractions.Pdf.IBoundedPdfDocumentObject
    IronSoftware.Abstractions.Pdf.IPdfDocumentObject
    IronSoftware.Abstractions.IDocumentObject
    IronSoftware.Abstractions.IBounded
    IronSoftware.ITransformable
    IronSoftware.Abstractions.IColored
    System.ICloneable
    Inherited Members
    OcrResult.OcrResultTextElement.ToString()
    OcrResult.OcrResultTextElement.Clone()
    OcrResult.OcrResultTextElement.TextDirection
    OcrResult.OcrResultTextElement.Text
    OcrResult.OcrResultTextElement.Confidence
    OcrResult.OcrResultTextElement.PageIndex
    OcrResult.OcrResultTextElement.PdfDocumentId
    OcrResult.OcrResultTextElement.ObjNum
    OcrResult.OcrResultTextElement.Contents
    OcrResult.OcrResultTextElement.Left
    OcrResult.OcrResultTextElement.Right
    OcrResult.OcrResultTextElement.Top
    OcrResult.OcrResultTextElement.Bottom
    OcrResult.OcrResultTextElement.Color
    OcrResult.OcrResultTextElement.BoundingBox
    OcrResult.OcrResultTextElement.Scale
    OcrResult.OcrResultTextElement.Translate
    OcrResult.OcrResultTextElement.Matrix
    OcrResult.OcrResultElement.ToBitmap(OcrInput)
    OcrResult.OcrResultElement.Width
    OcrResult.OcrResultElement.Height
    OcrResult.OcrResultElement.X
    OcrResult.OcrResultElement.Y
    OcrResult.OcrResultElement.Location
    Namespace: IronOcr
    Assembly: IronOcr.dll
    Syntax
    public class Block : OcrResult.OcrResultTextElement

    Grouping recognized text into the largest layout regions on a page runs through OcrResult.Block, a block holding zero or more paragraphs. It is the coarsest text element below the page itself, so it is where you start when you want output organized by column or region before drilling into paragraphs, lines, and words.

    You obtain blocks by walking an OcrResult from IronTesseract.Read: read the Blocks on a page, then move down through each block's structure. The block carries the inherited Text and Confidence from OcrResult.OcrResultTextElement, plus BlockNumber, a unique one-based ID within the result, and BlockType, a string naming the kind of region the engine detected.

    To descend the tree, a block exposes four arrays in order of appearance: Paragraphs, Lines, Words, and Characters. Read Paragraphs when you want the next structural level, or jump straight to Words or Characters when you only need the flattened content of the block. The inherited geometry locates the block on the page when you need to crop or draw it.

    The working with OCR results how-to walks the result tree from blocks down to words, and the results objects example reads block-level structure from a scan.

    Properties

    BlockNumber

    A unique ID for this Block within its OcrResult object. The first block will be numbered 1.

    Declaration
    public int BlockNumber { get; }
    Property Value
    Type Description
    System.Int32

    BlockType

    A string representation of the type of block.

    See https://github.com/charlesw/tesseract/blob/master/src/Tesseract/PolyBlockType.cs

    Declaration
    public string BlockType { get; }
    Property Value
    Type Description
    System.String

    Characters

    Every character of text within this block - in order.

    Declaration
    public OcrResult.Character[] Characters { get; }
    Property Value
    Type Description
    OcrResult.Character[]

    Lines

    Every line of text within this block.

    Declaration
    public OcrResult.Line[] Lines { get; }
    Property Value
    Type Description
    OcrResult.Line[]

    Paragraphs

    Every paragraph of text within this block.

    Declaration
    public OcrResult.Paragraph[] Paragraphs { get; }
    Property Value
    Type Description
    OcrResult.Paragraph[]

    Words

    Every word of text within this block - in order.

    Declaration
    public OcrResult.Word[] Words { get; }
    Property Value
    Type Description
    OcrResult.Word[]

    Implements

    IronSoftware.Abstractions.Pdf.IDocumentTextObject
    IronSoftware.Abstractions.Pdf.IBoundedPdfDocumentObject
    IronSoftware.Abstractions.Pdf.IPdfDocumentObject
    IronSoftware.Abstractions.IDocumentObject
    IronSoftware.Abstractions.IBounded
    IronSoftware.ITransformable
    IronSoftware.Abstractions.IColored
    System.ICloneable

    Inherited members

    ToString()
    Clone()
    TextDirection
    Text
    Confidence
    PageIndex
    PdfDocumentId
    ObjNum
    Contents
    Left
    Right
    Top
    Bottom
    Color
    BoundingBox
    Scale
    Translate
    Matrix
    ToBitmap(OcrInput)
    Width
    Height
    X
    Y
    Location
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget