> ## 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.

# Layout Object (ILayout Interface)

This object exposes methods and properties for working with the image layout. The Layout object serves as a root for blocks. Its attributes are width and height. These parameters are set equal to the corresponding parameters of the black-and-white page of the image for which the Layout object is defined. This is done automatically when the Layout object is analyzed or recognized.

The Layout object is a persistent object. This means that the object's current state can be written to persistent storage. Later, the object can be re-created by reading the object's state from persistent storage. The following methods provide persistence of the object:

* Linux and macOS: [SaveToFile](/fine-reader/engine/api-reference/supplementary-objects-and-methods/savetofile-method) and [LoadFromFile](/fine-reader/engine/api-reference/layout-related-objects/layout/loadfromfile-method)
* Windows: [SaveToFile](/fine-reader/engine/api-reference/supplementary-objects-and-methods/savetofile-method), [LoadFromFile](/fine-reader/engine/api-reference/layout-related-objects/layout/loadfromfile-method), [SaveToMemory](/fine-reader/engine/api-reference/supplementary-objects-and-methods/savetomemory-method), and [LoadFromMemory](/fine-reader/engine/api-reference/layout-related-objects/layout/loadfrommemory-method)

## 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>Block collections</em></p></td></tr><tr><td><p><a name="blackseparators" /><strong>BlackSeparators</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layoutblocks">LayoutBlocks</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>Provides access to the collection of separator and separator group blocks of the layout.</p><p>This property refers to a valid object independently of whether there are any separator blocks in the <strong>Layout</strong> or not. If there are no separators in the <strong>Layout</strong>, the <strong>BlackSeparators</strong> property is empty.</p></td></tr><tr><td><p><a name="blocks" /><strong>Blocks</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layoutblocks">LayoutBlocks</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>Provides access to the collection of blocks of the layout. This collection does not contain the separator and separator group blocks. To access these blocks, use the <strong>BlackSeparators</strong> property.</p><p>This property refers to a valid object independently of whether there are any blocks in <strong>Layout</strong> or not. If there are no blocks in <strong>Layout</strong>, the <strong>Blocks</strong> property is empty. See also <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">Working with read-only object properties</a>.</p><Note>This collection never contains autoanalysis blocks, as this type of blocks is used only in Visual Components.</Note></td></tr><tr><td><p><strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layout/sortedblocks-property">SortedBlocks</a></strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layoutblocks">LayoutBlocks</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 logically ordered collection of the blocks of the layout.</p><p>This collection contains the same blocks that are returned by the <strong>Blocks</strong> property. They are sorted by the position of upper left corner of each block, first in left-to-right, then in top-to-bottom direction. The blocks that are close together will be considered as part of one logical group.</p></td></tr><tr><td><p><a name="visualblocks" /><strong>VisualBlocks</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/layout-related-objects/layoutblocks">LayoutBlocks</a></strong>, <a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties#readonly_properties">read-only</a></p></td><td><Warning>Visual Components are currently only supported for Windows.</Warning><p>Provides access to the collection of blocks visible in Visual Components. This collection can contain blocks of the following types: text, table, raster picture, barcode, autoanalysis. The order of the blocks in this collection is the same as you can see in Visual Components.</p></td></tr><tr><td colspan="3"><p><em>Additional attributes</em></p></td></tr><tr><td><p><a name="height" /><strong>Height</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>Returns the layout height in pixels. It is equal to the height of <strong><a href="/fine-reader/engine/api-reference/image-related-objects/imagedocument">ImageDocument</a></strong> of the corresponding <strong><a href="/fine-reader/engine/api-reference/document-related-objects/frpage">FRPage</a></strong>.</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 layout name.</p></td></tr><tr><td><p><a name="textasstring" /><strong>TextAsString</strong></p></td><td><p><strong><a href="/fine-reader/engine/guided-tour/advanced-techniques/programming-aspects/working-with-properties">BSTR</a></strong>, read-only</p></td><td><p>Writes the text from all text and table blocks to one line. The <strong><a href="/fine-reader/engine/api-reference/layout-related-objects/tablecells">TableCells</a></strong> object determines the order in which text from table cells is written. So the order may not coincide with the table cells order as they go in the image. Text of barcode blocks is not written.</p></td></tr><tr><td><p><a name="pageregion" /><strong>PageRegion</strong></p></td><td><p><strong><a href="/fine-reader/engine/api-reference/supplementary-objects-and-methods/region">Region</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>Stores the bounding region of the blocks of the layout. If there are no blocks, this property returns the empty region.</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 any user-defined information with an object of the <strong>Layout </strong>type.</p></td></tr><tr><td><p><a name="width" /><strong>Width</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>Returns the layout width in pixels. It is equal to the width of <strong><a href="/fine-reader/engine/api-reference/image-related-objects/imagedocument">ImageDocument</a></strong> of the corresponding <strong><a href="/fine-reader/engine/api-reference/document-related-objects/frpage">FRPage</a></strong>.</p></td></tr></tbody></table>

## Methods

| Name                                                                                                                  | Description                                                                                       |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [Clean](/fine-reader/engine/api-reference/layout-related-objects/layout/clean-method)                                 | Removes all types of blocks and separators from the layout.                                       |
| [CopyFrom](/fine-reader/engine/visual-components-reference/supplementary-objects/spellwordcollection/copyfrom-method) | Initializes properties of the current object with values of similar properties of another object. |
| [LoadFromFile](/fine-reader/engine/api-reference/layout-related-objects/layout/loadfromfile-method)                   | Restores the object contents from a file on disk.                                                 |
| [LoadFromMemory](/fine-reader/engine/api-reference/layout-related-objects/layout/loadfrommemory-method)               | Restores the object contents from the global memory. <Note> *Windows only.* </Note>               |
| [SaveToArray](/fine-reader/engine/api-reference/layout-related-objects/layout/savetoarray-method)                     | Saves the object contents as an array of bytes.                                                   |
| [SaveToFile](/fine-reader/engine/api-reference/supplementary-objects-and-methods/savetofile-method)                   | Saves the object contents into a file on disk.                                                    |
| [SaveToMemory](/fine-reader/engine/api-reference/supplementary-objects-and-methods/savetomemory-method)               | Saves the object contents into the global memory. <Note> *Windows only.* </Note>                  |
| [SaveToStream](/fine-reader/engine/api-reference/layout-related-objects/layout/savetostream-method)                   | Saves the object contents into the stream.                                                        |

## Related objects

### Windows

<img src="https://mintcdn.com/abbyy/lsETHFYUFiongXSm/images/fine-reader/engine/layout.gif?s=fae7c3d1b6741051e7ce93e8298de134" alt="Layout" width="488" height="319" data-path="images/fine-reader/engine/layout.gif" />[](/fine-reader/engine/api-reference/document-related-objects/frpage#layout)[](/fine-reader/engine/api-reference/layout-related-objects/autoanalysisblock)[](/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/tableblock)[](/fine-reader/engine/api-reference/layout-related-objects/textblock)[](/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/vectorpictureblock)[](/fine-reader/engine/api-reference/layout-related-objects/rasterpictureblock)[](/fine-reader/engine/api-reference/layout-related-objects/checkmarkblock)[](/fine-reader/engine/api-reference/layout-related-objects/checkmarkgroup)[](/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/tableblock)[](/fine-reader/engine/api-reference/layout-related-objects/textblock)[](/fine-reader/engine/api-reference/layout-related-objects/block)[](/fine-reader/engine/api-reference/layout-related-objects/separatorblock)[](/fine-reader/engine/api-reference/layout-related-objects/separatorgroup)[](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks)[](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks)[](/fine-reader/engine/api-reference/document-related-objects/frpage)[](/fine-reader/engine/api-reference/document-related-objects/frpages)[](/fine-reader/engine/api-reference/document-related-objects/frdocument)

### Linux and macOS

<img src="https://mintcdn.com/abbyy/lsETHFYUFiongXSm/images/fine-reader/engine/layoutlinuxmac.gif?s=b17a4f40c3b3d7c9736d9d77586ec003" alt="LayoutLinuxMac" width="338" height="272" data-path="images/fine-reader/engine/layoutlinuxmac.gif" />[](/fine-reader/engine/api-reference/layout-related-objects/vectorpictureblock)[](/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/tableblock)[](/fine-reader/engine/api-reference/layout-related-objects/textblock)[](/fine-reader/engine/api-reference/layout-related-objects/block)[](/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/separatorblock)[](/fine-reader/engine/api-reference/layout-related-objects/separatorgroup)[](/fine-reader/engine/api-reference/layout-related-objects/layoutblocks)[](/fine-reader/engine/api-reference/document-related-objects/frpage#layout)[](/fine-reader/engine/api-reference/document-related-objects/frpage)[](/fine-reader/engine/api-reference/document-related-objects/frpages)[](/fine-reader/engine/api-reference/document-related-objects/frdocument)

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

## Output parameter

This object is the output parameter of the [CreateLayoutFromStream](/fine-reader/engine/api-reference/engine-object-iengine-interface/creation-methods/createlayoutfromstream-method) method of the [Engine](/fine-reader/engine/api-reference/engine-object-iengine-interface) object.

## Samples

<Accordion title="C# code">
  ```csharp theme={null}
  FREngine.IFRDocument frdoc;
  // Iterates blocks of layout
  for (int iPage = 0; iPage < frDoc.Pages.Count; iPage++)
  {
   FREngine.IFRPage page = frDoc.Pages[iPage];
   FREngine.ILayout layout = page.Layout;
   int blocksCount = layout.Blocks.Count;
   for (int iBlock = 0; iBlock < blocksCount; iBlock++)
   {
    FREngine.IBlock block = layout.Blocks[iBlock];
    ...
   }
  }
  ```
</Accordion>

The object is used in the following code samples:

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

## See also

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

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

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