Visual Basic (Declaration) | |
---|---|
Public MustInherit NotInheritable Class OcrEngineManager |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public static class OcrEngineManager |
C++/CLI | |
---|---|
public ref class OcrEngineManager abstract sealed |
This example will show how to use the IOcrEngine in a multi-threaded application. It will simultaneously convert four TIF files into PDF.
For an example on how to use the IOcrEngine in a single-threaded application, refer to IOcrEngine example.
Visual Basic | Copy Code |
---|---|
Private Structure MyThraedData |
C# | Copy Code |
---|---|
private struct MyThraedData |
The OcrEngineManager and its methods are your entry to using the Leadtools.Forms.Ocr class library.
This class provides the methods you need to create an object of the IOcrEngine interface. Afterwards, you can use the properties and methods of this interface to perform your OCR tasks.
Based on the engine type passed to the "CreateEngine" methods, the OcrEngineManager will load the OCR engine defined in one of the supporting assemblies and return an interface to IOcrEngine. Use this interface and its included types to start using the Leadtools.Forms.Ocr class library. For more information about the engine types, refer to OcrEngineType
The CreateEngine method lets you create an instance of IOcrEngine, loading the corresponding Leadtools.Forms.Ocr.[EngineName].dll assembly in a specific manner as follows:
The CreateEngine method uses the .NET 2.0 Assembly.Load method to load an assembly. You cannot unload this assembly once it has been successfully loaded. If the useThunkServer parameter to CreateEngine is set to true, the internal engine DLL's are loaded using the LEADTOOLS Thunk Server. For more information, refer to LEADTOOLS OCR Thunk Server.
Your application requirements determine how to call "CreateEngine", as follows:
If your application is going to use a single instance of IOcrEngine; pass false to useThunkServer. This is the most common behavior. If your application is going to use multiple threads for OCR, pass true to useThunkServer. The various OCR engines provided by LEADTOOLS are not thread safe. Passing true causes the LEADTOOLS Thunk Server to load the internal OCR engine in a separate process and unload it when the thread procedure terminates, ensuring thread safety and cleanup. If your application is server-based, pass true to useThunkServer. Server-based applications usually use a separate thread for each "connection". Creating the OCR engine in a separate process ensures proper thread/process safety and cleanup. IMPORTANT: The above discussion is for the LEADTOOLS Plus and Professional engines only (the LEADTOOLS Advantage engine supports multi-threading). To ensure thread safety and cleanup, use the LEADTOOLS Thunk Server to load the internal OCR engine in a separate process and unload it when the thread procedure terminates. If your application is server-based, pass true to useThunkServer. Server-based applications usuallly use a separate thread for each "connection". Creating the OCR engine in a separate process ensures proper thread/process safety and cleanup. IMPORTANT: The above discussion is for the LEADTOOLS Plus and Professional engines only. The LEADTOOLS Advantage engine supports multi-threading and x64 platform natively and does not require the use of a "thunk server".
Either way, you use the LEADTOOLS OCR class library various interfaces, classes and structures in the same manner. Your application code should not be affected by the way you created the engine.
System.Object
Leadtools.Forms.Ocr.OcrEngineManager
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family