Using the Engine object

Language:
EN
Product-Line:
FlexiCapture Engine
Version:
9.x, 10, 11
Platform:
Windows
KB-Type:
Frequently Asked Questions
KB-Topic:
Recognition, Programming Aspects
Category:
Integration, Recognition

What should I do if I have got problems creating the Engine object in C#.NET?

You must make sure to specify [STAThread] (single-thread apartment model) as an attribute on your app's main function:

[STAThread] 
public static void Main() 
{
  ...
}

How to work with read-only object properties in raw C++?

Certain ABBYY FineReader Engine objects (for example, Blocks, etc.) have read-only object properties. Such properties cannot be changed directly in raw C++. If you want to change such a property, you need to pass a reference to the property object to a new variable, and then use this variable to change it. Below you can see a C++ sample for the Blocks property which is represented by a read-only collection:

ILayout* pLayout = 0;
IBlocksCollection* pBlocksCollection = 0;
IBlock* pBlock = 0;
...
// The pBlocksCollection variable receives a reference to the 
// blocks collection from Layout 
pLayout->get_Blocks( &pBlocksCollection );
// Add one more element to the blocks collection 
pBlocksCollection->Add( pBlock ); 
...

Is it possible to run and use Engine object in several threads?

No, it is impossible. The Engine object is singleton, so only one object of this type may be created in a single instance of the application that uses ABBYY FineReader Engine. The methods of all ABBYY FineReader Engine objects should be called only from the thread in which Engine object was created.

More details can be found in the documentation chapter: Using ABBYY FineReader Engine.

Is it possible to create and run the Engine object on a multi-processor system?

Yes, it is possible. But there can be only one Engine object in each process. A second call of GetEngineObject within the same process will return the reference to the existing object. Therefore, you should create a separate Engine object for each process by calling the GetEngineObject function.

More details can be found in the documentation chapter: Using ABBYY FineReader Engine.

What should I do if the "Engine deinitialization failed" exception is thrown during deinitialization of the Engine object?

This exception is thrown if not all the objects which were created and used by the application have been deleted before the Engine object deinitialization. If all the objects have been deleted the exception may be caused by the scavenger operation.

If the application is developed in Visual Basic .Net

In this environment all objects with the Nothing value are not deleted, they are only marked for deletion. The exact moment when the garbage collector deletes the object is not known. Therefore, you should call the following methods before Engine object deinitialization so that the garbage collector deletes the object:

    GC.Collect()
    GC.WaitForPendingFinalizers() 

If the application is developed in Delphi

More details can be found in the documentation chapter: Using ABBYY FineReader Engine in Delphi.

You can use the StartLogging method of the Engine object to get a list of objects that have not been deleted.

How can I create a log file to keep track of all errors, warnings and method calls of ABBYY FineReader Engine?

To do this, you need to call the StartLogging method of the Engine object. As input parameters, specify the log file name and the Boolean variable which determines whether method calls messages should be logged or not. Once you have called this method, all messages will be logged. To stop logging, call the StopLogging method of the Engine object.

What should I do if the Engine object cannot be deinitialized in Delphi?

More details can be found in the documentation chapter: Using ABBYY FineReader Engine in Delphi.

FAQ Overview

This website uses cookies which enable you to see pages or use other functions of our websites. You can turn off such cookies in your browser’s settings. If you continue to use these pages, you consent to the use of cookies.
  • No tags, yet