Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Creating an OCR Engine Instance

The OcrEngineManager class and its methods are your entry to using the Leadtools.Forms.Ocr class library.

You use the OcrEngineManager.CreateEngine method to create an instance of the IOcrEngine interface. Afterwards, you can use the properties and methods of this interface to perform the various OCR tasks required.

There are two things to consider when creating an IOcrEngine instance:


OCR Engine Type

LEADTOOLS for .NET class library supports multiple OCR engines. All the engines supported implement the same interfaces defined in Leadtools.Forms.Ocr.dll. As a result, your application code does not need to change when you switch between the engines.

The first parameters to the OcrEngineManager.CreateEngine method (engineType) is a value of the OcrEngineType enumeration to specifiy the name of the OCR engine to load. Internally, the framework will use Assembly.Load to load the corresponding assembly and create the objects that implements the various public interfaces (for example, IOcrEngine).

Currently, LEADTOOLS for .NET class library supports the following engines:

EngineDescription
OcrEngineType.Plus

LEADTOOLS OCR Plus engine. The OCR library inside Leadtools.Forms.Ocr.Plus.dll is loaded.

OcrEngineType.Professional

LEADTOOLS OCR Professional engine. The OCR library inside Leadtools.Forms.Ocr.Professional.dll is loaded.

OcrEngineType.Advantage

LEADTOOLS OCR Advantage engine. The OCR library inside Leadtools.Forms.Ocr.Advantage.dll is loaded.

OcrEngineType.Arabic

LEADTOOLS OCR Arabic engine. The OCR library inside Leadtools.Forms.Ocr.Arabic.dll is loaded.


Usage of the LEADTOOLS Thunk Server

Note: The description below applies for the LEADTOOLS Plus, Professional and Arabic engines only. The LEADTOOLS Advantage engine supports multi-threading natively and does not require the use of a "thunk server".

The various OCR engines provided by LEADTOOLS are not thread safe by default. If you are planning on using a single instance of IOcrEngine in your application then this is not a problem.

However, if your application is planning on using multiple threads for OCR or your application is server-based, then it is recommended that you communicate with the internal OCR engine using the LEADTOOLS Thunk Server. The Thunk Server will load each instance of the internal OCR engine in a separate process and will insure proper thread/process safety and cleanup without the expense of a performance hit.

To use the Thunk Server, pass true to the second parameter of the OcrEngineManager.CreateEngine method (useThunkServer). Otherwise; pass false.

In either case, LEADTOOLS for .NET OCR class library is designed to use standard .NET interfaces to perform the various OCR functions. These interfaces hide the internal workings of the OCR engines and its loading mechanism. Your application code should not change if you switch the Thunk Server on or off.

Once you obtained an instance of the OCR engine, the next step is starting up the engine using the IOcrEngine.Startup method. For more information, refer to Starting and Shutting Down the OCR Engine.

See Also