#1
Posted
:
Friday, December 7, 2018 2:26:58 PM(UTC)
Groups: Registered
Posts: 9
I took the OMR demo code and added it to some existing OCR code from our production environment.
After adding the OMR demo code I'm getting an "Invalid Data File" exception when executing the line indicated below. I am able to
// Start by unlocking OMR - we need to pass the license and the license key to LeadTools
UnlockSupport(license, license_key);
using (RasterCodecs codecs = new RasterCodecs())
{
//We want to load all pages since it could be a multipage masterform / filled form
codecs.Options.Load.AllPages = true;
//Make sure to load any documents as 300x300 DPI for best accuracy
codecs.Options.RasterizeDocument.Load.XResolution = 300;
codecs.Options.RasterizeDocument.Load.YResolution = 300;
//Set the directory of the Master Form Repository
string masterFormRepository = @"C:\Users\Public\Documents\LEADTOOLS Images\Forms\MasterForm Sets\OMR";
//set the directory of the filled forms
string filledFormDirectory = @"C:\Users\Public\Documents\LEADTOOLS Images\Forms\Forms to be Recognized\OMR";
//Startup the OCR Engine
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Professional, false))
{
ocrEngine.Startup(codecs, null, null, "C:\\LEADTOOLS 19\\Bin\\Common\\OcrProfessionalRuntime64");
//Create the repository initialize the AutoFormsEngine and load each form
IMasterFormsRepository repository = new DiskMasterFormsRepository(codecs, masterFormRepository);
****exception thrown on this line ------> using (AutoFormsEngine engine = new AutoFormsEngine(repository, ocrEngine, null, AutoFormsRecognitionManager.Default | AutoFormsRecognitionManager.Ocr, 30, 80, false))
{
foreach (var file in Directory.EnumerateFiles(filledFormDirectory))
{
Console.WriteLine("Processing file " + Path.GetFileName(file));
using (RasterImage image = codecs.Load(file))
{
//Run the recognition
AutoFormsRunResult runResult = engine.Run(image, null, null, null);
Console.WriteLine("Form Processed using " + runResult.RecognitionResult.MasterForm.Name);
//Process the results - this will just display all OMR fields found and output True or False to the console
if (runResult != null)
foreach (FormPage formPage in runResult.FormFields)
foreach (FormField field in formPage)
if ((field as OmrFormField) != null)
Console.WriteLine(field.Name + ": " + ((field.Result as OmrFormFieldResult)?.Text == "1").ToString());
}
Console.WriteLine("*****************************");
}
}
}
Console.WriteLine("Done processing");
Console.ReadLine();
}
The master forms in the repository were created with V20 of leadtools but the code is using V19 dlls, etc. - the application is a LeadTools V19 app. Do I need to recreate the Master Form using the V19 Master Form Editor or is there something else that is incorrect?
We have a V19 license that does NOT include OMR, but we have an OMR eval license that is loaded successfully as part of the code above.
Thanks in advance,
Bob
#2
Posted
:
Friday, December 7, 2018 4:25:09 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello Bob,
We changed how we store master forms from v19 to v20. And while v20 can still open the older v19 files, v19 doesn't have forward compatibility unfortunately. My recommendation would be to recreate the master forms using the master forms editor in v19. I'd also recommend moving/deleting the templates from the folder so none of the v20-style data files interfere.
If you're still having issues after recreating the forms using v19, please let me know.
Thanks,
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#3
Posted
:
Friday, December 7, 2018 4:47:27 PM(UTC)
Groups: Registered
Posts: 9
Thanks much Anthony - that was my first guess, but just couldn't find the answer anywhere.
Bob
#4
Posted
:
Friday, December 7, 2018 5:24:06 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello Bob,
Unfortunately this change doesn't appear to be documented publicly, but as a general rule things should only be considered backwards compatible. As I said before, this should fix the issue, but if you run into anything else just let me know.
Thanks,
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#5
Posted
:
Monday, December 10, 2018 4:14:42 PM(UTC)
Groups: Registered
Posts: 9
Hi Anthony,
I've copied the Leadtools V19 directory from our server to my laptop. I'm trying to get the Master Forms Editor (64 bit) started so that I can recreate the master forms, but it's complaining about the license file. When I try to run C:\leadtools 19\Shortcuts\Forms Recognition & Processing\.NET Class Libraries\Forms (Structured & Unstructured)\Forms Recognition & Processing\Master Forms Editor\Master Forms Editor 64-bit I'm getting a pop-up with the following error: "Your license file is missing, invalid or expired" - There's more text but probably not worth typing. Where does the license file need to be placed so that I can run the forms editor? Also, does the license file need to be named something specific?
Thanks again,
Bob
#6
Posted
:
Tuesday, December 11, 2018 11:08:13 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello,
Unfortunately, after your evaluation period has ended, you must manually configure the license information. If you want to configure the license without rebuilding the demo, you can simply create a Leadtools.dll.config file within C:\LEADTOOLS 19\Bin\Dotnet4\Win32 (or x64 depending on the architecture) using the following instructions:
https://www.leadtools.com/help/leadtools/v19/dh/to/leadtoolsconfiglicense.htmlThe other option is to rebuild the demo from source after updating the LIC/KEY information within the Common/UnlockSupport.cs file of the demo.
If updating your license is still displaying the error, please let me know.
Thanks,
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#7
Posted
:
Tuesday, December 11, 2018 12:51:08 PM(UTC)
Groups: Registered
Posts: 9
Hi Anthony,
Thanks much - I had a Leadtools.dll.config, but the LeadtoolsLicenses section was empty double quotes. Setting the key and value solved the problem. Much appreciated - Great Support!
Thanks again,
Bob
#8
Posted
:
Tuesday, December 11, 2018 1:28:30 PM(UTC)
Groups: Registered
Posts: 9
Hi Anthony,
Getting closer. I'm able to get the Master Form Editor to start, but after selecting the master form and image file to create a new master form I get an error saying "Could not find any LEADTOOLS OCR engine on this machine. This demo cannot start without OCR capabilities"
I'd guess that there is another config file that needs to be updated to point to the location of the runtime engine but I'm unable to find the answer.
Thanks again,
Bob
#9
Posted
:
Tuesday, December 11, 2018 4:08:08 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello Bob,
I believe by default the SDK looks in: @"..\..\..\Common\OcrProfessionalRuntime" (with "64" at the end if running as 64-bit) relative to the EXE. If you're seeing that error you will most likely need to reconfigure the demo, and build it again. Below is a brief list of the modifications you'll need to make:
- Project location: C:\LEADTOOLS 19\Examples\DotNet\CS\MasterFormsEditor
- License information: Common\UnlockSupport.cs lines 18 through 20
- OCR runtime path: Common\OcrEngineSelectDialog.cs line 274
- Path for 32-bit: @"C:\LEADTOOLS 19\Bin\Common\OcrProfessionalRuntime"
- Path for 64-bit: @"C:\LEADTOOLS 19\Bin\Common\OcrProfessionalRuntime64"
After building the project again, you should be able to run CSMasterFormsEditor.exe within the output directory (or through Visual Studio of course).
Thanks,
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
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.