Skip to main content
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:

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.

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

Visual Components are currently only supported for Windows.

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

NameDescription
CleanRemoves all types of blocks and separators from the layout.
CopyFromInitializes properties of the current object with values of similar properties of another object.
LoadFromFileRestores the object contents from a file on disk.
LoadFromMemory <Note> Windows only. </Note>Restores the object contents from the global memory.
SaveToArraySaves the object contents as an array of bytes.
SaveToFileSaves the object contents into a file on disk.
SaveToMemory <Note> Windows only. </Note>Saves the object contents into the global memory.
SaveToStreamSaves the object contents into the stream.

Windows

Layout

Linux and macOS

LayoutLinuxMac Object Diagram

Output parameter

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

Samples

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];
  ...
 }
}
The object is used in the following code samples:

See also

Working with Layout and Blocks LayoutBlocks Working with Properties