Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, March 7, 2018 3:57:26 PM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 161

Was thanked: 9 time(s) in 9 post(s)

The call to OcrEngine.Startup() accepts four parameters. Typically, the call is made as such:


ocrEngine.Startup(null, null, null, null)

This call uses default options. However, these fields can be customized based on development needs. We have information on the call and its parameters in our online documentation. This post serves as an overview and explanation.

The four parameters are:

  • An instance of RasterCodecs
  • An instance of DocumentWriter
  • A string representing the work directory
  • A string representing the startup parameters

How is the RasterCodecs instance used?
If "null" is specified, a RasterCodecs instance is created internally by the engine, although some properties of the object are modified to facilitate recognition. Specifically, the XResolution and YResolution are set to 300, and the DisplayDepth is set to auto-detect. These settings are typically recommended when loading a document for OCR. A custom instance of RasterCodecs can be used as this parameter, however, it is recommended to set the XResolution and YResolution values as stated.


rasterCodecsInstance.Options.RasterizeDocument.Load.XResolution = 300 
rasterCodecsInstance.Options.RasterizeDocument.Load.YResolution = 300 
rasterCodecsInstance.Options.Pdf.Load.DisplayDepth = 0

Note that an internally created instance of RasterCodecs will be automatically disposed of by the engine, however, one passed as a parameter will not.

How is the DocumentWriter instance used?
If "null" is specified, a DocumentWriter instance is created internally by the engine. This internally generated DocumentWriter uses default values and is disposed of automatically. An initialized DocumentWriter with custom values can be passed in and used instead if the default values are insufficient.

What is the work directory?
The IOcrEngine creates multiple temporary files during the recognition and document generation process. The work directory specifies where those files should be created. If "null" is specified, then the engine uses %TEMP%, which is the temporary folder of the current logged in user. Note that while the engine does remove temporary files after the operation is complete, if the engine does not shut down properly, these files may persist. By specifying a directory, an application can ensure any extraneous temp files are removed and that the application has access rights to the folder.

What does the startup parameters represent?
The startup parameters represents the path on disk to the OCR engine runtime files. If "null" is used, the default path based on the selected OCR engine is used.

For OcrEngineType.LEAD:

Note using the default path can facilitate development of proof-of-concepts on development machines where the SDK is installed. It's highly recommended this path be changed before deployment to accommodate the directory structure generated by your application instead of creating a new folder structure just to accommodate this value.

What are the runtime files?
The runtime files are required by the OCR engine and need to be included with the application. If the runtime files are not present in the directory specified by the startup parameters, the engine will throw an exception. We have more information specifically for OCR files, including those specific to each engine type, included in our documentation on OCR Files to be Included with your Application.

Edited by moderator Wednesday, December 27, 2023 3:09:06 PM(UTC)  | Reason: Updated

Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.084 seconds.