> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Block Object (IBlock Interface)

This object represents a single block. When recognizing a page, ABBYY FineReader Engine first analyzes its layout and detects blocks of various types on the page. Blocks determine how the image areas are recognized and contain recognized information after recognition.

Each block on the page belongs to one of the nine types: text, table, raster picture, vector picture, barcode, checkmark, checkmarks group, separator, and separators group. The type of the block is defined by the Type property. The Block object exposes methods which typecast it to the one of its child objects and thereby provide access to the extended attributes of a block of specific type.

The position of the block on an image is defined by its region (the Region property) and the layer to which the block belongs (the BlockLayerType property).

<Warning>
  The block you obtain from the layout of an [FRPage](/fine-reader/engine/api-reference/document-related-objects/frpage) will become invalid after a call to any of the methods that perform layout analysis (such as [Analyze](/fine-reader/engine/api-reference/document-related-objects/frdocument/analyze-method) or [Process](/fine-reader/engine/api-reference/document-related-objects/frdocument/process-method) ) for this page or the document it belongs to. After analysis, find the block you require in the new layout and continue working with the new Block object.
</Warning>

## Properties

<table><thead><tr><th><p><strong>Name</strong></p></th><th><p><strong>Type</strong></p></th><th><p><strong>Description</strong></p></th></tr></thead><tbody><tr><td><p><strong>Application</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/engine-object-iengine-interface">Engine</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><p>Returns the <strong>Engine</strong> object.</p></td></tr><tr><td colspan="3"><p><em>Main attributes</em></p></td></tr><tr><td><p><a name="region" /><strong>Region</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/supplementary-objects-and-methods/region">Region</a></strong></p></td><td><p>Provides access to the block <a href="/fine-reader/engine/api-reference/supplementary-objects-and-methods/region#region">region</a>. A region is a collection of rectangles. Unlike other types of blocks, a table block may have no more than one rectangle in its region, that is why an attempt to assign a region with more than one rectangle to a table block will result in an error. The region is defined by coordinates of its rectangles (in pixels) upon the deskewed <a href="/fine-reader/engine/guided-tour/advanced-techniques/working-with-images#black-and-white">black-and-white</a> plane of the corresponding image.</p><Note>The property returns a constant object. To change the block region, you must at first obtain an intermediate Region object using the <a href="/fine-reader/engine/api-reference/engine-object-iengine-interface/creation-methods/createlessobjectgreater-methods">IEngine::CreateRegion</a> method, change the necessary parameters, and then assign the obtained object to the property.</Note></td></tr><tr><td><p><a name="type" /><strong>Type</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/enumerations/blocktypeenum">BlockTypeEnum</a></strong>, read-only</p></td><td><p>ABBYY FineReader Engine uses the following types of blocks: text, table, raster picture, vector picture, barcode, checkmark, checkmarks group, separator, separators group, and autoanalysis. (Autoanalysis blocks are used only in Visual Components). Each type of block has its own specific properties.</p><p>The block type is defined during creation and cannot be changed. If you need to change the block type, you will have to delete the block and create another block of the necessary type in exactly the same place:</p><ol><li value="1">Create a <strong><a href="/fine-reader/engine/api-reference/supplementary-objects-and-methods/region">Region</a></strong> object using the <strong><a href="/fine-reader/engine/api-reference/engine-object-iengine-interface/creation-methods/createlessobjectgreater-methods">IEngine::CreateRegion</a></strong> method and copy the region of the block you need to replace with the help of the <strong><a href="/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/copyfrom-method">IRegion::CopyFrom</a></strong> method.</li><li value="2">Delete the old block from the layout by calling the <strong><a href="/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/deleteat-method">ILayoutBlocks::DeleteAt</a></strong> method.</li><li value="3">Create a new block of the required type and add it into the collection of layout blocks using the <strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layoutblocks/addnew-method">AddNew</a></strong> method of the <strong>LayoutBlocks</strong> object. Pass the <strong>Region</strong> you copied from the old block as one of the required parameters.</li></ol></td></tr><tr><td colspan="3"><p><em>Additional attributes</em></p></td></tr><tr><td><p><a name="backgroundcolor" /><strong>BackgroundColor</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">int</a></strong>, read-only</p></td><td><p>Specifies the background color of the block.</p><Note>The int value is calculated from the RGB triplet using the formula: ( red value ) + (256 x green value ) + (65536 x blue value ), where red value is the first triplet component, green value is the second triplet component, blue value is the third triplet component. For example, the int value of the color white equals 16777215.</Note><p>By default, the value of this property is -1, which means that the color is transparent.</p></td></tr><tr><td><p><a name="blocklayertype" /><strong>BlockLayerType</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/enumerations/blocklayertypeenum">BlockLayerTypeEnum</a></strong>, read-only</p></td><td><p>Specifies the layer of the block: background, foreground, or hidden. Blocks may be overlaid, for example, a text block may lay over a background picture block.</p><Note>For <a href="/fine-reader/engine/api-reference/layout-related-objects/rasterpictureblock">RasterPictureBlock</a> and <a href="/fine-reader/engine/api-reference/layout-related-objects/vectorpictureblock">VectorPictureBlock</a> , you can change layer using the <a href="/fine-reader/engine/api-reference/layout-related-objects/vectorpictureblock/setblocklayertype-method">SetBlockLayerType</a> method.</Note><p>By default, the value of this property is BLT\_Foreground.</p></td></tr><tr><td><p><a name="description" /><strong>Description</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">BSTR</a></strong></p></td><td><p>Stores the description of the block.</p><p>By default, the value of this property is an empty string.</p></td></tr><tr><td><p><a name="name" /><strong>Name</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">BSTR</a></strong></p></td><td><p>Stores the name of the block. It may be an arbitrary string.</p><p>By default, the value of this property is an empty string.</p></td></tr><tr><td><p><strong><a href="/fine-reader/engine/api-reference/language-related-objects/baselanguage/userproperty-property">UserProperty</a></strong></p></td><td><p><strong>VARIANT</strong></p></td><td><p>Allows you to associate some user-defined information of any type with an object of the <strong>Block </strong>type.</p></td></tr></tbody></table>

## Methods

| Name                                                                                                                     | Description                                                                                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [GetAsBarcodeBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getasbarcodeblock-method)             | Returns the block as the [BarcodeBlock](/fine-reader/engine/api-reference/layout-related-objects/barcodeblock) object. If the block is not a barcode block, NULL is returned.                    |
| [GetAsCheckmarkBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getascheckmarkblock-method)         | Returns the block as the [CheckmarkBlock](/fine-reader/engine/api-reference/layout-related-objects/checkmarkblock) object. If the block is not a checkmark block, NULL is returned.              |
| [GetAsCheckmarkGroup](/fine-reader/engine/api-reference/layout-related-objects/block/getascheckmarkgroup-method)         | Returns the block as the [CheckmarkGroup](/fine-reader/engine/api-reference/layout-related-objects/checkmarkgroup) object. If the block is not a checkmark group block, NULL is returned.        |
| [GetAsRasterPictureBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getasrasterpictureblock-method) | Returns the block as the [RasterPictureBlock](/fine-reader/engine/api-reference/layout-related-objects/rasterpictureblock) object. If the block is not a raster picture block, NULL is returned. |
| [GetAsSeparatorBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getasseparatorblock-method)         | Returns the block as the [SeparatorBlock](/fine-reader/engine/api-reference/layout-related-objects/separatorblock) object. If the block is not a separator block, NULL is returned.              |
| [GetAsSeparatorGroup](/fine-reader/engine/api-reference/layout-related-objects/block/getasseparatorgroup-method)         | Returns the block as the [SeparatorGroup](/fine-reader/engine/api-reference/layout-related-objects/separatorgroup) object. If the block is not a separator group block, NULL is returned.        |
| [GetAsTableBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getastableblock-method)                 | Returns the block as the [TableBlock](/fine-reader/engine/api-reference/layout-related-objects/tableblock) object. If the block is not a table block, NULL is returned.                          |
| [GetAsTextBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getastextblock-method)                   | Returns the block as the [TextBlock](/fine-reader/engine/api-reference/layout-related-objects/textblock) object. If the block is not a text block, NULL is returned.                             |
| [GetAsVectorPictureBlock](/fine-reader/engine/api-reference/layout-related-objects/block/getasvectorpictureblock-method) | Returns the block as the [VectorPictureBlock](/fine-reader/engine/api-reference/layout-related-objects/vectorpictureblock) object. If the block is not a vector picture block, NULL is returned. |
| [Move](/fine-reader/engine/api-reference/layout-related-objects/block/move-method)                                       | Offsets block region by some vector.                                                                                                                                                             |

## Related objects

### Windows

<img src="https://mintcdn.com/abbyy/6udH-pkk8zkVafYH/images/fine-reader/engine/block.gif?s=3581d9bc2321cc7885447b625469f683" alt="Block" width="369" height="322" data-path="images/fine-reader/engine/block.gif" />[](/fine-reader/engine/api-reference/layout-related-objects/tablecell#block)[](/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/element-property)[](/fine-reader/engine/api-reference/layout-related-objects/autoanalysisblock)[](/fine-reader/engine/api-reference/layout-related-objects/vectorpictureblock)[](/fine-reader/engine/api-reference/supplementary-objects-and-methods/region)[](/fine-reader/engine/api-reference/layout-related-objects/textblock)[](/fine-reader/engine/api-reference/layout-related-objects/tableblock)[](/fine-reader/engine/api-reference/layout-related-objects/separatorgroup)[](/fine-reader/engine/api-reference/layout-related-objects/separatorblock)[](/fine-reader/engine/api-reference/layout-related-objects/rasterpictureblock)[](/fine-reader/engine/api-reference/layout-related-objects/checkmarkgroup)[](/fine-reader/engine/api-reference/layout-related-objects/checkmarkblock)[](/fine-reader/engine/api-reference/layout-related-objects/barcodeblock)[](/fine-reader/engine/api-reference/layout-related-objects/tablecell)[](/fine-reader/engine/api-reference/layout-related-objects/layout)[](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks)

### Linux and macOS

<img src="https://mintcdn.com/abbyy/6udH-pkk8zkVafYH/images/fine-reader/engine/blocklinuxmac.gif?s=413e3a9762d2d4bc7966f82713401e6e" alt="BlockLinuxMac" width="369" height="306" data-path="images/fine-reader/engine/blocklinuxmac.gif" />[](/fine-reader/engine/api-reference/layout-related-objects/checkmarkgroup)[](/fine-reader/engine/api-reference/layout-related-objects/checkmarkblock)[](/fine-reader/engine/api-reference/layout-related-objects/tablecell#block)[](/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/element-property)[](/fine-reader/engine/api-reference/supplementary-objects-and-methods/region)[](/fine-reader/engine/api-reference/layout-related-objects/tablecell)[](/fine-reader/engine/api-reference/layout-related-objects/vectorpictureblock)[](/fine-reader/engine/api-reference/layout-related-objects/textblock)[](/fine-reader/engine/api-reference/layout-related-objects/tableblock)[](/fine-reader/engine/api-reference/layout-related-objects/separatorgroup)[](/fine-reader/engine/api-reference/layout-related-objects/separatorblock)[](/fine-reader/engine/api-reference/layout-related-objects/rasterpictureblock)[](/fine-reader/engine/api-reference/layout-related-objects/barcodeblock)[](/fine-reader/engine/api-reference/layout-related-objects/block)[](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks)[](/fine-reader/engine/api-reference/layout-related-objects/layout)

[Object Diagram](/fine-reader/engine/api-reference/object-diagram)

## Output parameter

This object is the output parameter of the [Item](/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/item-method), [AddNew](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks/addnew-method) methods of the [LayoutBlocks](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks) object.

## Samples

<Accordion title="C# code">
  ```csharp theme={null}
  int picturesCount = 0;
  int suspiciousCharsCount = 0;
  int totalCharsCount = 0;
  int barcodesCount = 0;
  // Calculates the number of characters, suspicious characters, pictures and barcodes in a text
  void computeStatisticsForBlock(FREngine.IBlock block)
  {
   if (block.Type == FREngine.BlockTypeEnum.BT_Table)
   {
    FREngine.ITableBlock tableBlock = block.GetAsTableBlock();
    for (int iCell = 0; iCell < tableBlock.Cells.Count; iCell++)
    {
     computeStatisticsForBlock(tableBlock.Cells[iCell].Block);
    }
   }
   else if (block.Type == FREngine.BlockTypeEnum.BT_Text)
   {
    FREngine.ITextBlock textBlock = block.GetAsTextBlock();
    int paragraphsCount = textBlock.Text.Paragraphs.Count;
    for (int iPar = 0; iPar < paragraphsCount; iPar++)
    {
     FREngine.IParagraph par = textBlock.Text.Paragraphs[iPar];
     string text = par.Text;
     totalCharsCount += text.Length;
     FREngine.ICharParams charParams = engine.CreateCharParams();
     for (int iChar = 0; iChar < text.Length; iChar++)
     {
      par.GetCharParams(iChar, charParams);
      if (charParams.IsSuspicious)
      {
       suspiciousCharsCount++;
      }
     }
    }
   }
   else if (block.Type == FREngine.BlockTypeEnum.BT_RasterPicture || block.Type == FREngine.BlockTypeEnum.BT_VectorPicture)
   {
    picturesCount++;
   }
   else if (block.Type == FREngine.BlockTypeEnum.BT_Barcode)
   {
    barcodesCount++;
   }
  }
  ```
</Accordion>

The object is used in the following code samples:

* Linux: [CustomLanguage](/fine-reader/engine/guided-tour/samples#customlanguage), [CommandLineInterface](/fine-reader/engine/guided-tour/samples#commandlineinterface)

* Windows: [CustomLanguage](/fine-reader/engine/guided-tour/samples#customlanguage), [CommandLineInterface](/fine-reader/engine/guided-tour/samples#commandlineinterface), [RecognizedTextProcessing](/fine-reader/engine/guided-tour/samples#recognizedtextprocessing); and demo tool: [Engine Predefined Processing Profiles](/fine-reader/engine/guided-tour/samples#engine_predefined_processing_profiles).

## See also

[LayoutBlocks](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks)

[Working with Layout and Blocks](/fine-reader/engine/guided-tour/advanced-techniques/working-with-layout-and-blocks)

[Working with Properties](/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties)
