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



Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, April 27, 2017 12:41:47 PM(UTC)


Groups: Registered, Tech Support, Administrators
Posts: 153

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

Some LEADTOOLS operations contain callbacks which reports information regarding the state of the operation. In addition, these operations offer a way to preemptively terminate the operation in question. For example, OcrDocument.AutoZone() and OcrDocument.Recognize() both implement the OcrProgressCallback event.

This event is raised internally and provides data relevant to the progress of the operation.

Note all these properties are read-only save one: Status. This value is of the OcrProgressStatus enumeration type and has two values--Continue and Abort.

The default value is Continue which instructs the operation to proceed normally. However, this can be changed to Abort to instruct the operation to cease as soon as possible.


IOcrEngine engine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
IOcrDocument document = engine.DocumentManager.CreateDocument();
document.Pages.AddPages("input.tiff", 1, -1, null);


private void ocr_callback(IOcrProgressData data)
    data.Status = OcrProgressStatus.Abort;

Do note this does not halt the operation immediately, but rather when it is convenient for the operation to do so. As a general rule, the operation stops after the current page. Note that when an operation is completed this way, any existing result of the operation is discarded, so using this to only perform a specific number of pages in a document is infeasible. This can be used to either force a timeout for long operations, or to accommodate a "Cancel" button exposed to the end-user via the project's UI.

For more information on callbacks used by LEADTOOLS operations and ways to implement them, see this forum post.

Edited by moderator Friday, October 18, 2019 4:41:48 PM(UTC)  | Reason: Updating links and code to v20

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-2023, Yet Another Forum.NET
This page was generated in 0.044 seconds.