Home : Deployment : Deploy a project using OCR
Q10141 - HOWTO: Deploy a project using OCR

Note: This information is specific to DotImage at the time it was written and may change slightly in future versions.

Every OcrEngine has different requirements in terms of how it is deployed.  Atalasoft has tried to formalize this process as much as possible as well as to provide guidelines on the mechanism for deployment.  Licensing is covered in another topic.  This topic covers how to ensure that an OcrEngine will be able to start and will be able to find its own resources.

In your SDK installation, you will find a folder named "OcrResources".  This folder is the general folder for all supported OCR engines.  Within it you will see a structure like this:








In general, most of the handling of loading and locating resources is managed by Atalasoft or by the engine itself and does not require work by the client, but in custom situations, there may be work to be done by the client to handle this.

To sort this out, let's start with a few definitions:

engine resources folder - this is the folder which contains the OCR Engine's resource files
OCR resources folder - the top level folder of all OCR Engine resources, called "OcrResources"
application folder - the folder where your application is installed
assembly folder - the folder which contains the dotImage assembly files (ie, Atalasoft.dotImage.Ocr.dll), this may be the same as the application folder
sdk folder - the folder which contains all the dotImage assembly files as installed as part of the dotImage SDK.  This folder is typically C:\Program Files (x86)\Atalasoft\DotImage <version>\bin
engine module - an engine supplied dll that provides engine functionality

In order to run, some engines have two requirements: an engine module for some portion of OCR functionality and resource files that are used to configure the engine or otherwise provide necessary data or services.  This may include such things as dictionaries, grammar rules, glyph shapes, neural networks and so on.

Engines that require engine modules typically need to have those modules loaded before attempting to construct a class that requires them.  This presents an interesting issue in that the assembly that uses the engine module should contain the knowledge of how to find the engine module, but the engine module needs to be loaded before the module that should be able to find it is loaded.

Atalasoft tries to handle this for you when possible so you don't have to worry about it, but there are some cases where this simply isn't possible.


Options for the Developer

The developer can choose to leave the engine module in the ocr resources folder as shipped.  If this is the case, then the developer must put the OCR resources folder within the assembly folder.  Alternately, the developer can put the OcrResources folder in any location, but it is the developer's responsibility to load the dll.  If the OCR resources folder is not in the assembly folder, the developer is required to pass its location in to the ExperVisionEngine constructor.

The developer can choose to move the engine module out of the ocr resources folder.  In this case, if the engine module is put into the application folder or the assembly folder, then it should be located automatically.  If the engine module is located somewhere else it is the developer's responsibility to locate it and load it.  If the OCR resources folder is within the assembly folder, the developer can pass in null to the engine constructor for the path, otherwise the developer must pass the location in.

GlyphReaderEngine (v3.0 for DotImage 10.3.0 and lower)

NOTE:: This section is referring to GlyphReader v3.0 which is found in DotImage 10.3.0 and older... as of 10.3.1 and newer, we use GlyphReader 4.0 which has a significantly different deployment profile.

The GlyphReaderEngine requires the following resource files:

* GlyphReader.dll
* GlyphReader.ini
* GlyphReaderEngine.exe
* TOCR32.gar
* TOCR32.n3s
* TOCR32.qnp
* TOCR32.teh

They are located by default in SDK folder\OcrResources\GlyphReader\v3.0\

Due to the architecture of the GlyphReader engine, to specify a location other than a default search path such as System32, you'll need to create an instance of the OcrResourceLoader or GlyphReaderLoader in a static constructor before any OCR code is loaded.  This is the case even if the resources are in the assembly folder.  There you can specify an alternate location of the resources if desired.

GlyphReaderLoader loader = new GlyphReaderLoader( "PathToFolderContainingGlyphReaderResources" );

NOTE: When deploying GlyphReader to a Web Application, Web Service, or WCF service you need to load by Reflection.
Please see Q10423 - HOWTO: Load GlyphReaderEngine by Reflection

GlyphReaderEngine (v4.0 for DotImage 10.3.1 and newer)

NOTE:: this section is referring to GlyphReader v4.0 which is found in DotImage 10.3.1 and newer. Please see the section on GlyphReader Engine v3.0 for older versions

The 4.0 GlyphReader engine requires an OcrResources folder with a GlyphReader subdirectory which itself has a v4.0 subdirectory containing the following 3 files and two folders:


the x86 and x64 folders each contain the following files (of the correct "bitness")


You will need to create a folder called OcrResources in your bin directory of your application, and copy the GlyphReader folder from

C:\Program Files (x86)\Atalasoft\DotImage 10.x\bin\OCRResources\

into it (where x is the version of DotImage such as 10.3, 10.4, 10.5 and so on)

You will also need to have a reference in your project to Atalasoft.dotImage.Ocr.GlyphReader.dll, but set the CopyLocal property to false, you then will need to physically place a copy of the correct version (x86/x64 and 2.0/4.0 for bitness and .NET framework respectively) of Atalasoft.dotImage.Ocr.GlyphReader.dll in the OCRResources folder

So, your application's bin folder will have



The TesseractEngine requires its resource files to be pointed at by an environment variable "TESSDATA_PREFIX". Install the "tessdata" folder to a location on the deployment machine and then in your project set the environment variable to the absolute path of "tessdata's" parent folder. You can use this call to accomplish this:

System.Environment.SetEnvironmentVariable("TESSDATA_PREFIX", absolutepath,EnvironmentVariableTarget.User);



The RecoStar engine requires RecoStar Resources which are not distributed with DotImage by default, but which may be downloaded from here:

10.6.1 and newer:

10.6.0 and older:

Once downloaded, you can unzip (it will create a folder called RecoStar with a 7.2 (new as of 10.6.1 and newer... for older versions it will be 5.0) subdirectory and place several files and foders under there) and place the entire RecoStar folder into the default location ( C:\Program Files (x86)\Atalasoft\DotImage 10.x\bin\OCRResources\ )

You'll need a RecoStar Loader as well:

RecoStarLoader loader = new RecoStarLoader( "PathToFolderContainingRecoStar" );

For additional help with RecoStar, please see the following articles:
Q10321 - FIX: RecoStar license errors
Q10325 - HOWTO: How to Evaluate The RecoStar OCR Add-on to DotImage


Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?


Tell us why you rated the content this way. (optional)
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved