Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Attached is a very simple OCR demo showing how easy it is to OCR a document using LEADTOOLS. It is using C# and v19 of LEADTOOLS.
The relevant code is as follows:
Code: private void DoOCR(string inputFile, string outputFile, DocumentFormat format)
{
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
{
ocrEngine.Startup(null, null, null, null);
ocrEngine.AutoRecognizeManager.Run(inputFile, outputFile, format, null, null);
}
}
Here is a screenshot of the demo running:

Attached below is an updated version of this project for LEADTOOLS v20
Alterations in the DLLs
Removed v19 DLLs:
Leadtools.Forms.dll
Leadtools.Forms.DocumentWriters.dll
Leadtools.Forms.Ocr.dll
Leadtools.Forms.Ocr.Advantage.dll
Added v20 DLLs:
Leadtools.Document.Writer.dll
Leadtools.Ocr.dll
Leadtools.Ocr.LEADEngine.dll
Edited by user 6 years ago
| Reason: Not specified
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

Groups: Registered, Tech Support, Administrators
Posts: 89
Was thanked: 4 time(s) in 4 post(s)
With the release of the LEADTOOLS v20 SDK there have been a few changes to our OCR Engines.
We now have the
LEAD OCR Engine and the
OmniPage OCR Engine.
Which have replaced the Advantage and the Professional OCR Engines.
It is also important to note that when developing a x64 application you will need to reference the OmniPage Runtime specifically for x64 bit applications.
In the below examples I have how to call and startup the ocrEngine for the LEAD Engine and the OmniPage Engine. The examples for the C# sample application are a 32-bit application and the example for the VB ocrEngine startup are in 64-bit. This way you can see the necessity to reference the OcrOmniPageRuntime64 specifically.
Additionally, at the bottom of this post are working examples of both of the OcrEngine.Startup applications that are shown below.
You will need to simply comment out the engine that you are not working with.
C#Code: static void Main(string[] args)
{
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
string engine = "";
string licenseFilePath = @"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC";
string keyFilePath = File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.key");
RasterSupport.SetLicense(licenseFilePath, keyFilePath);
ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime");
engine = "LEAD";
ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.OmniPage, false);
ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrOmniPageRuntime");
engine = "OmniPage";
Console.WriteLine(engine + " OCR engine has been started successfully");
Console.ReadKey();
ocrEngine.Dispose();
Console.WriteLine("OCR engine has been destroyed");
Console.ReadKey();
}
VBCode:Sub Main()
Dim engine As String = ""
Dim MY_LIC_FILE = System.IO.File.ReadAllBytes("C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC")
Dim MY_DEV_KEY As String = "input key string here"
RasterSupport.SetLicense(MY_LIC_FILE, MY_DEV_KEY)
Dim ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, False)
ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime")
engine = "LEAD"
Dim ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.OmniPage, False)
ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS 20\Bin\Common\OcrOmniPageRuntime64")
engine = "OmniPage"
Console.WriteLine(engine + " OCR engine has been started successfully")
Console.ReadKey()
ocrEngine.Dispose()
End Sub
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.