The ABBYY FineReader Engine application programming interface conforms to the COM standard and can be easily used in C/C++, .NET, Delphi, Java or any development tool supporting COM components. The Engine can be adapted for use in scripting languages like VBS, JS, Perl.
This section describes the main aspects of using ABBYY FineReader Engine in applications written in different programming languages and provides references to articles that discuss related topics.
Loading, initialization, and deinitialization
It is prohibited to initialize and deinitialize ABBYY FineReader Engine at the entry points of other DLLs, and also in constructors and destructors of static and global objects implemented in DLLs, because they are called at the DLL entry points. This restriction is due to the fact that the Win32 LoadLibrary and FreeLibrary functions are not re-entrant. A user should initialize and deinitialize ABBYY FineReader Engine elsewhere, for example, in WinMain function of an EXE module.
During initialization, ABBYY FineReader Engine will reset the LC_CTYPE setting of msvcrt.dll to the operating system defaults. This fact should be taken into account if your application depends upon the msvcrt.dll locale-dependent services.
The "Engine deinitialization failed" exception can be thrown during the deinitialization of the Engine object if not all of the objects which were created and used by the application have been deleted before the Engine object deinitialization. If you work with programming languages which do not have garbage collection (for example, C++), you must either use smart pointer classes (see the samples in C++ (COM)) or release objects that were created by creation methods when they are no longer needed. If all the objects have been deleted, the exception may be caused by the garbage collector operation. If the application is developed in Visual Basic .NET, 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 the deinitialization of the Engine object so that the garbage collector deletes the object:
If you are using the log (it can be turned on with the StartLogging method of the Engine object), the message "Warning: DeinitializeEngine() has detected external references to FREngine objects. It can indicate a leak if programming platform without automatic garbage collection is used." can also appear in this situation. Even if you are explicitly calling the garbage collector (GC.Collect), it does not always mean that the objects are deleted immediately. When working in the environments with garbage collectors, you can disregard this message.
When working in the environments without garbage collection (such as C++), these exception and message can indicate a problem in your source code. Some objects can be incorrectly handled, causing a memory leak. However, after Engine deinitialization, all FineReader Engine objects will be deleted in any case, so the memory leak can occur in the client part of the code, i.e., if you create your own wrappers for the FineReader Engine objects and fail to release them before the deinitialization.
Consider using the TotalObjectsCount property of the Engine object, which returns the number of unreleased objects and can help you track down the memory leak.
Also in this section
The detailed description of loading and unloading ABBYY FineReader Engine.
Peculiarities of using in server applications.
Information about error handling.
Describes how to handle errors that may occur during export to PDF/XPS format.
The interfaces of ABBYY FineReader Engine objects have various properties and methods. The way the properties are handled in different languages is discussed in this article.
There are three major types of collections in ABBYY FineReader Engine. See how to work with these collections in this section.
Some of the objects in ABBYY FineReader Engine are so-called "connectable objects." Here you can find useful recommendations on working with such objects.
The detailed description of how to use FineReader Engine in a scripting language.
The description of the initialization and deinitialization procedure in Delphi.
The description of how to use FineReader Engine in Java.
Peculiarities of Java programming for all platforms.
The description of how to use FineReader Engine in .NET Core.
Loading and unloading FineReader Engine in C (Objective-C).
Peculiarities of Visual Components usage in different versions of Microsoft Visual Studio.