#1
Posted
:
Friday, August 25, 2017 11:33:34 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
This tutorial shows how to implement the BankCheckReader in Visual Studio.
1. Start Visual Studio.
2. Choose File -> New -> Project from the menu
3. Choose "Console Application" in the templates list.
4. Type "CheckReaderDemo" in the project name field. Change the Location if desired by clicking the Browse button. Then choose OK.
5. In the "Solution Explorer" window, right-click on the "References" folder, and select "Add Reference..." from the context menu. In the Add Reference dialog box, select the ".NET" tab and browse to the "C:\LEADTOOLS 19\Bin\DotNet\Win32" folder (or "C:\LEADTOOLS 19\Bin\DotNet4\Win32" if you are going to use .NET 4) and select the following DLLs:
- Leadtools.dll
- Leadtools.Codecs.dll
- Leadtools.Codecs.Cmp.dll
- Leadtools.Forms.Commands.dll
- Leadtools.Forms.DocumentWriters.dll
- Leadtools.Forms.Ocr.dll
- Leadtools.Forms.Ocr.Advantage.dll
Click the Select button and then press the OK button to add the above DLLs to the application.
6. Add the following lines of code at the beginning of the Program.cs file:
Code:
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.Commands;
using Leadtools.Forms.Ocr;
7. In the Main() method, add the following initialization code, changing the placeholder values to the actual location and value of the license and developer key.
Code:
string MY_LICENSE_FILE = "d:\\temp\\TestLic.lic";
string MY_DEVELOPER_KEY = "xyz123abc";
RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DEVELOPER_KEY);
string chequePath = @"C:\Users\Public\Documents\LEADTOOLS Images\BankCheck.jpg";
RasterCodecs codecs = new RasterCodecs();
RasterImage image;
BankCheckReader chequeReader = new BankCheckReader();
8. Add the following lines of code to load and read the check image.
Code:
using (IOcrEngine engine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
{
engine.Startup(codecs, null, null, null);
chequeReader.OcrEngine = engine;
chequeReader.ProcessImage(image);
engine.Shutdown();
}
9. Add the following lines of code to display the results to the console.
Code:
foreach (KeyValuePair<string, BankCheckField> kvp in chequeReader.Results)
{
Console.WriteLine(kvp.Key + "\t\t" + kvp.Value.Text);
}
10. Finally, add the following lines of code for clean-up.
Code:
image.Dispose();
codecs.Dispose();
Console.ReadLine();
11. Build, run, and test the program. The detected information will be printed in the console window. Press Enter to close and exit the program.
Nick Crook
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.