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: an area in the global memory or a disk file. Later, the object can be re-created by reading the object's state from persistent storage. The following methods provide persistence of the object: SaveToFile, LoadFromFile, SaveToMemory, and LoadFromMemory.

Properties

Name Type Description
Application Engine, read-only Returns the Engine object.
Block collections
BlackSeparators LayoutBlocks, read-only

Provides access to the collection of separator and separator group blocks of the layout.

This property refers to a valid object independently of whether there are any separator blocks in the Layout or not. If there are no separators in the Layout, the BlackSeparators property is empty.

Blocks LayoutBlocks, read-only

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 BlackSeparators property.

This property refers to a valid object independently of whether there are any blocks in Layout or not. If there are no blocks in Layout, the Blocks property is empty. See also Working with read-only object properties.

Note: This collection never contains autoanalysis blocks, as this type of blocks is used only in Visual Components.

SortedBlocks LayoutBlocks, read-only

Returns the logically ordered collection of the blocks of the layout.

This collection contains the same blocks that are returned by the Blocks 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.

VisualBlocks LayoutBlocks, read-only

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.

Additional attributes
Height int, read-only Returns the layout height in pixels. It is equal to the height of ImageDocument of the corresponding FRPage.
Name BSTR Stores the layout name.
TextAsString BSTR, read-only Writes the text from all text and table blocks to one line. The TableCells 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.
PageRegion Region, read-only Stores the bounding region of the blocks of the layout. If there are no blocks, this property returns the empty region.
UserProperty VARIANT Allows you to associate any user-defined information with an object of the Layout type.
Width int, read-only Returns the layout width in pixels. It is equal to the width of ImageDocument of the corresponding FRPage.

Methods

Name Description
Clean Removes all types of blocks and separators from the layout.
CopyFrom Initializes properties of the current object with values of similar properties of another object.
LoadFromFile Restores the object contents from a file on disk.
LoadFromMemory Restores the object contents from the global memory.
SaveToArray Saves the object contents as an array of bytes.
SaveToFile Saves the object contents into a file on disk.
SaveToMemory Saves the object contents into the global memory.
SaveToStream Saves the object contents into the stream.

Related objects

Object Diagram

Output parameter

This object is the output parameter of the CreateLayoutFromStream method of the Engine object.

Samples

C# code

The object is used in the following code samples: CustomLanguage, RecognizedTextProcessing; and demo tools: Camera OCR, Engine Predefined Processing Profiles, Image Preprocessing.

See also

Working with Layout and Blocks

LayoutBlocks

Working with Properties

9/17/2024 3:14:40 PM

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.