Introduction

The LEADTOOLS OCR API provides dynamic link library (DLL) functions to let you:

Add page(s) to the internal OCR list of pages.

Select the language to use in recognizing the OCR pages.

Recognize a variety of documents, including facsimiles, photocopies and documents with complex layouts.

Save the document in any of several text output formats.

Correct certain document characteristics such as noise, darkness, lightness, etc. to get the best possible character recognition.

Manually or automatically detect / select zones for recognition.

Use dictionaries for improving OCR results.

Display document pages, with or without their zones.

The toolkit comes in WIN32 editions so that it can support development of software applications for any of the following environments:

Windows 4.x NT
Windows 95/98/Me
Windows 2000/XP

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.


Example Programs

The following example programs are in separate EXAMPLES subdirectories (such as C:\LEAD14\EXAMPLES\DLL\MFCOCR). The executable files for these examples were compiled with Document/Medical capabilities. To get Document/Medical capabilities, you must buy a LEADTOOLS Document/Medical toolkit. Otherwise, if you recompile the examples, the resulting executable files will not have the Document/Medical capabilities.

Note:

You can run the example programs on your system by clicking the appropriate buttons in online help. If you try to run an example program that is not on your system, an error message will appear.

MFCOCR | MFCOCR Demo is the main OCR example program. It uses pull-down menus to demonstrate most of the LEADTOOLS OCR features in one application.
 | Click here [image] to run the WIN32 version of this example.


Version History

Current version: | 14.5
Last update: | October 20, 2005


Changes from Version 14 to Version 14.5

Version 14.5 of the LEADTOOLS OCR API has not changed from Version 14.


Changes from Version 13 to Version 14

Version 14 of the LEADTOOLS OCR API has been completely re-written since version 13.

LEADTOOLS OCR API now supports UNICODE.

The rest of this topic lists the new functions in version 14.

Starting and Shutting Down

L_DocShutDown

L_DocStartUp

L_DocLoadSettings

L_DocSaveSettings

L_DocSetProgressCB

Pages

L_DocAddPage

L_DocDetectOrientationDegree

L_DocExportPage

L_DocFindDefaultFillMethod

L_DocGetFillMethod

L_DocGetPageCount

L_DocGetPageInfo

L_DocLockPage

L_DocRemovePage

L_DocSetFillMethod

L_DocUnlockPage

L_DocUpdatePage

Zones

L_DocAddZone

L_DocEnableParallelRecognition

L_DocExportZones

L_DocFindZones

L_DocGetZone

L_DocGetZoneCount

L_DocGetZoneOptions

L_DocImportZones

L_DocIsParallelRecognitionEnabled

L_DocRemoveZone

L_DocSetZoneOptions

L_DocUpdateZone

Languages

L_DocGetCharLangsOptions

L_DocFreeLanguages

L_DocGetDefaultSpellLanguages

L_DocGetSelectedLanguages

L_DocIsCharEnabled

L_DocSelectLanguages

L_DocSetCharLangsOptions

User Dictionary

L_DocAddItemToUserDictionary

L_DocGetUserDictionary

L_DocGetUserDictionarySection

L_DocGetUserDictionarySectionItem

L_DocGetUserDictionaryState

L_DocRecognize

L_DocRemoveItemFromUserDictionary

L_DocSetUserDictionary

Recognition

L_DocEnumOutputFileFormats

L_DocFreeRecognizedCharacters

L_DocFreeRecognizedWords

L_DocFreeMemoryResults

L_DocGetHandPrintOptions

L_DocGetMOROptions

L_DocGetOMROptions

L_DocGetRecognitionResultOptions

L_DocGetRecognizedCharacters

L_DocGetRecognizedWords

L_DocGetSpecialChar

L_DocGetStatus

L_DocGetTextFormatInfo

L_DocRecognize

L_DocSaveResultsToFile

L_DocSaveResultsToMemory

L_DocSetHandPrintOptions

L_DocSetMOROptions

L_DocSetOMROptions

L_DocSetRecognizeModuleTradeOff

L_DocGetRecognizeModuleTradeOff

L_DocSetRecognitionResultOptions

L_DocSetRecognizedCharacters

L_DocSetSpecialChar

Drawing Zones and Pages

L_DocDrawPage

L_DocGetPaintZoomFactor

L_DocGetSelectedZone

L_DocRemoveSelectedZone

L_DocSelectZone

L_DocSelectZoneByPoint

L_DocSetActivePage

L_DocSetPaintZoomFactor

L_DocSetSelectedZonePen

L_DocSetZonePen

L_DocZone

Callbacks

ENUMOUTPUTFILEFORMATS

PROGRESSCALLBACK

RECOGNIZESTATUSCALLBACK

VERIFICATIONCALLBACK


Version 13

Version 13 is the first version of the LEADTOOLS OCR API.

The rest of this topic lists the new functions in version 13.

Pages Functions

L_OCRAddPageFromBitmap

L_OCRAddPagesFromBitmapList

L_OCRAddPagesFromFile

L_OCRAddPagesFromMemoryFile

L_OCRProcessPage

L_OCRExportPageAsBitmap

L_OCRExportPagesAsBitmapList

L_OCRExportPagesAsFile

L_OCRExportPagesAsMemoryFile

L_OCRGetPageCount

L_OCRGetPageInfo

L_OCRRemovePage

L_OCRSplitPage

Segments Functions

L_OCRExportSegment

L_OCRFindSegmentTable

L_OCRFreeSegmentInfo

L_OCRGetSegmentInfo

L_OCRSegmentHit

L_OCRSegmentPage

L_OCRSetSegment

L_OCRRecognizeSegment

L_OCRRemoveSegment

Text Verification Functions

L_OCRDlgGetString

L_OCRDlgGetStringLen

L_OCRDlgSetFont

L_OCRDlgSetString

L_OCRPaintVerificationImage

L_OCRRecognize

L_OCRSetVerificationOptions

L_OCRSetVerificationResponse

Training Data Functions

L_OCRSetTrainingData

L_OCRSetTrainingFile

L_OCRGetTrainingData

L_OCRLoadTrainingFile

Language Functions

L_OCRGetLangsInfo

L_OCRSetActiveLanguages

LTOCR Functions

L_OCRGetInfo

L_OCRParseXDoc

L_OCRSetProgressFunction

L_OCRShutDown

L_OCRStartUp

Miscellaneous Functions

L_OCRGetOperatingOptions

L_OCRGetPDFThreshold

L_OCRGetSuggestion

L_OCRSetOperatingOptions

L_OCRSetPDFThreshold

L_OCRSaveDoc


Copyright notice

Copyright Notices

©Copyright LEAD Technologies, Inc. 1991-2005. ALL RIGHTS RESERVED

Portions of the PCDLIB32.DLL, PCDLIB.DLL, LFFPX7.DLL, LFKODAK.DLL, EKFPIXJPEG140.DLL, PDC_SDK.DLL, PROFIRE.DLL, DC120V154_32.DLL, LFDCR14N.DLL, DCSPROBACK.DLL, DCSPRO3SLR.DLL, LFDCS14N.DLL, and LFKDC14N.DLL files contain material that is ©Copyright Eastman Kodak Company, 1996-2001. This software is based in part on the work of the Independent JPEG Group.

Portions of the LFCRW14N.DLL, LTCMP14.DLL, CDSDK.reg, CDSDK.dll, CDRAPCLS.dll, czs_ui.dll, deimg.dll, deImg010.dll, deImg110.dll, deImg153.dll, deimg301.dll, deimg401.dll, deImg404.dll, deimg602.dll, Deimg603.dll, DeImgd60.dll, pscAdimg.dll, pscCllct.dll, pscCStUI.dll, pscDcd.dll, pscDevUI.dll, pscDvlp.dll, Pscl2STI.dll, pscll.dll, pscParse.dll, pscSetup.dll, psdkdll.dll, psdkReg.dll, psParse.dll. file contain material that is © Canon, Inc. 2002

Portions of the LFFPX7.DLL and LFKODAK.DLL files contain material that is ©Copyright Hewlett Packard, 1996.

Portions of the OCR/ICR/OMR Features and the help file for the OCR/ICR/OMR Features are ©Copyright Scansoft, Inc. 1995-2003. ALL RIGHTS RESERVED

Portions of the Barcode Modules contain material that is ©Copyright Axtel Inc., 1999.

Portions of the LEADTOOLS PDF Plug in and the LEADTOOLS Vector Imaging Pro are ©Copyright 1996, 2000 Artifex Software Inc. All rights reserved.

File filters for decoding MrSID ® and DjVu ® formats are provided under a license from Lizardtech, Inc.

The "FlashPix" format uses Microsoft's OLE structured storage.

Portions of the DICOM help files in Medical Imaging product line are reprinted with permission from the National Electrical Manufacturers Association ©Copyright 1998 by the National Electrical Manufacturers Association. All rights including translation into other languages, reserved under the Universal Copyright Convention, the Berne Convention or the Protection of Literacy and Artistic Works, and the International and Pan American Copyright Conventions.

Portions of LEADTOOLS Data Security Add On contain software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/), including cryptographic software written by Eric Young (eay@cryptsoft.com) and by Tim Hudson (tjh@cryptsoft.com). Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. Copyright Tim Hudson 1995-1998 (tjh@cryptsoft.com) All rights reserved.

Portions of LEADTOOLS Data Security Add On contain software based on the MD5 Message Digest Algorithm developed by RSA Data Security, Inc.. Copyright (c) 1991-92 RSA Data Security, Inc. All Rights Reserved.

Portions hereof licensed under US patent 5,327,254 and foreign counterparts.

Portions of the LEADTOOLS ICC Profiles material is © Copyright 2004, International Color Consortium.

Trademarks

LEAD® and LEADTOOLS® are registered trademarks of LEAD Technologies, Inc.
Microsoft, Windows, Windows NT, Visual Basic, Visual FoxPro, and Microsoft Access are either trademarks or registered trademarks of the Microsoft Corporation.
OS/2® is a registered trademark of International Business Machines Corporation.

TextBridge®OCR is a registered trademark of Scansoft, Inc.

ISIS® is a registered trademark of Pixel Translations, Inc.

ScanAhead™ is a trademark of Pixel Translations, Inc.

FlashPix™ is a trademark of Eastman Kodak Company.

All other brand or product names used in this online help are trademarks of their respective holders.

Address and Contact Information

LEAD Technologies, Inc.
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

(704) 332-5532
FAX: (704) 372-8161
E-mail: support@leadtools.com
Technical support: (704) 372-9681 or support@leadtools.com
Home page: http://www.leadtools.com


Programming with LEADTOOLS OCR Functions

The LEADTOOLS OCR features provide functions for incorporating optical character recognition (OCR) technology into an application. OCR is used to process bitmap document images into text. The LEADTOOLS OCR features are based on and use the ScanSoft TextBridge® OCR Engine.

Once the LEADTOOLS OCR API toolkit is installed to the system, the user is ready to begin programming with LEADTOOLS OCR. Please note that the OCR features must be unlocked before the user can actually use the OCR properties, methods, and events. For more information on unlocking LEAD features, refer to Unlocking Special LEAD Features.

LEADTOOLS provides functions to:

recognize and export text, choosing from a variety of text, word processing, database, or spreadsheet file formats.

select the language of documents to be recognized. Choose from English, Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, or Swedish.

segment complex pages manually or automatically into text zones, image zones, table zones, lines, headers and footers.

set accuracy thresholds prior to recognition to control the accuracy of recognition.

learn, save, and load character recognition data for similar documents. The software learns as a result of normal recognition, and acquires additional information by using the OCR’s text verification system.

recognize text from 5 to 72 points in virtually any typeface.

increase recognition accuracy with built-in and user dictionaries.

automatically detect fax, dot matrix, and other degraded documents and compensate accordingly.

process both text and graphics. The recognition software's ability to distinguish halftone graphics from text can provide the basis of a compound document processing system.

save the document in any of 40 formats, including MS Word, MS Excel, Dbase, PDF and WordPerfect.

LEADTOOLS uses an OCR handle to interact with the OCR engine and the internal OCR list of pages. The OCR handle is a communication session between LEADTOOLS OCR and an OCR engine installed on the system. This OCR handle is an internal structure that contains all the necessary information for recognition, getting and setting information, and text verification.

The following is an outline of the general steps involved in recognizing one or more pages.

1. | StartUp the OCR Engine with the L_DocStartUp function. For more information, refer to Starting and Shutting Down the Engine.
2. | Establish an internal OCR document with one or more pages. For more information, refer to Working with Pages.
3. | Establish zones on the page(s), either manually or automatically. (This is optional. A page can be recognized with or without zones.) For more information, refer to Working with Zones.
4. | Set the active languages to be used by the OCR engine. (Optional. The default is English.) For more information, refer to Working with Languages.
5. | Set the spell checking language. (Optional. The default is English.) For more information, refer to Working with Languages.
6. | Set any special recognition module options. This is required only if the page contains zones, created either automatically or manually. For more information, refer to Recognizing Document Pages and An Overview of Recognition Modules.
7. | Provide code for the VERIFICATIONCALLBACK function, if it will be used. (Optional)
8. | Recognize. For more information, refer to Recognizing Document Pages.
9. | Save recognition results, if desired. The results can be saved to either a file or to memory. For more information, refer to Recognizing Document Pages.
10. | Shut down the OCR engine when finished. For more information, refer to Starting and Shutting Down the Engine.

Note:

where steps 3, 4, 5, 6, and 7 can pretty much be done in any order, as long as they are carried out after starting up the OCR engine and before recognizing a page.


Unlocking Special LEAD Features

LEAD offers a variety of features, such as Document support, Medical support, Vector support, etc., which are only available in certain toolkits and are locked. To use these features you must:

purchase a toolkit that supports the desired feature(s).

print the applicable runtime agreement from the help file. For information on the runtime agreements, go to Topic Selection and click on the LEAD Licensing button.

complete the Transmittal document and fax it and the runtime agreement to LEAD's Licensing Department at 704 – 372 – 3789. (To view the transmittal document you must have Adobe® Acrobat® installed.)

if prepaid licenses are desired, include the order form with payment information. You can fax this along with the Transmittal form and the runtime agreement. (To view the order form you must have Adobe® Acrobat® installed.)

once we have received the signed agreement, we will send instructions for eliminating the license dialogs and the key(s) necessary for unlocking the appropriate features.

when you have received the instructions and the key(s) call the L_UnlockSupport function with the appropriate key.

For example, if you have purchased the LEADTOOLS Document Imaging toolkit:

print the Document Imaging Agreement (or the Document Imaging with OCR Agreement if you have also purchased the LEADTOOLS OCR Module).

complete the Transmittal document and fax it and the Document Imaging Agreement (or the Document Imaging with OCR Agreement) to LEAD's Licensing Department.

if you want prepaid licenses, print a copy of the order form, fill it out and send the order form and payment information to LEAD.

once we have received the signed Document Imaging Agreement (or Document Imaging with OCR Agreement), we will send the instructions for eliminating the license dialogs and any necessary keys.

when you receive the instructions and the key(s), call L_UnlockSupport (L_SUPPORT_DOCUMENT, "Document Key") to unlock the Document features. Please note that "Document Key" represents the actual key you will receive from LEAD. Also note that if you also purchased the LEADTOOLS OCR Module, the OCR features will have to be unlocked separately, using the appropriate key.

For information on products and the features available in each product, or for information on licensing, refer to Topic Selection.

To determine if a certain feature is locked, call the L_IsSupportLocked function.


Starting and Shutting Down the Engine

To begin using the LEADTOOLS OCR document toolkit, the user must initialize an OCR document handle. This handle provides the user with access to the OCR engine and the internal OCR document list of pages. Calling the L_DocStartUp function initializes the handle. Each call to the L_DocStartUp function will create an OCR document handle of type L_HDOC. This handle is passed to many of the other LEADTOOLS OCR Document API functions, so this function must be called before calling other LEADTOOLS OCR functions.

Once the L_DocStartUp function has been called, you may opt to load engine settings saved in a file into the engine. To load saved settings from a file, call L_DocLoadSettings. To save engine settings into a file for later use, call L_DocSaveSettings. Please note that you must call L_DocStartUp before you can call L_DocSaveSettings. If you call L_DocSaveSettings after calling L_DocStartUp, but before you have set any engine settings, the settings files will contain the default engine settings.

While working with the OCR engine, you can receive progress notifications for all processes performed by the OCR engine if you set a PROGRESSCALLBACK function using L_DocSetProgressCB.

When the OCR document handle is no longer needed, the user must free the handle by calling L_DocShutDown. At this point the OCR document handle becomes invalid. Before recognizing any more pages, the user must establish a new OCR document handle by calling L_DocStartUp.


An Overview of Recognition Modules

Automatic recognition module

Specifies that the Engine will try to automatically select the most suitable recognition module for the zone. This is determined just before recognition, according to the zone's filling method and, if necessary, other settings, most typically the Character Set.

MTX omnifont recognition module

This recognition module recognizes machine printed text; i.e. from printed publications, laser or ink-jet printers and electric typewriters. Output from mechanical typewriters in good condition may also be acceptable. It should also be used for Letter or Near Letter Quality output from dot-matrix printers, and can also be used for Draft Quality.

Only images with the following resolution ranges are supported: 90-110, 160-240, 280-320, 400, 600.This module does not process images larger than 6600 pixels in either width or height, that is it can safely handle A3 size (11.69" x 16.54") both portrait and landscape images with 300 dpi resolution. At larger resolution the supported image size is smaller.

The maximum number of zones defined on an image that this module can handle is 64.

MOR multi-lingual omnifont recognition module

This module recognizes machine printed text; i.e. from printed publications, laser or ink-jet printers and electric typewriters. Output from mechanical typewriters in good condition may also be acceptable. It should also be used for Letter or Near Letter Quality (NLQ, LQ) output from dot-matrix printers. There are two ways of modifying incoming images to make them more suitable for this omnifont recognition module:

Standard mode Fax output. (200 x 100 dpi). This switch doubles the pixels in the image’s vertical direction. Faxes sent in Fine Mode (200 x 200 dpi) are preferable. However, if faxes are sent in Fine Mode, then the Standard mode Fax Output should not be used.

Draft 24-pin dot-matrix output. Use the FILL_DRAFTDOT24 filling method to have the character contours smoothed. Again, NLQ or LQ quality output can usually be better recognized without using FILL_DRAFTDOT24.

This module can safely handle A3 size (11.69" x 16.54") both portrait and landscape images with 300 dpi resolution.

The maximum number of zones defined on an image that this module can handle is 500.

DOT Matrix (DOT 9-pin draft dot-matrix recognition module)

This module is designed for ONLY draft-quality 9-pin dot-matrix texts. For NLQ or LQ texts, the RECOGMODULE_OMNIFONT_PLUS2W, RECOGMODULE_OMNIFONT_PLUS3W, RECOGMODULE_MTEXT_OMNIFONT or RECOGMODULE_MULTI_LINGUAL_OMNIFONT modules are likely to give better results.

OMR optical mark recognition module

This recognition module is used for recognizing optical marks (checkmarks). Typical application areas are in questionnaires, ballot papers, educational tests and reporting or ordering sheets, where the documents to be processed are form-like and filled by respondents, usually by hand.

HNR hand-printed numeral recognition module

This recognition module can be used for recognition of hand-printed numerals and four additional signs. If further hand-printed characters are to be recognized, the use of the RECOGMODULE_RER_PRINTED recognition module is recommended.

RER hand-printed recognition module

This is a third-party recognition module from reRecognition GmbH, Germany. The Engine contains its recognition engine version 4.0a.

MAT matrix matching recognition module

This module is designed to read certain groups of fixed-font characters specially designed for OCR or imaging applications, in which no two characters have similar shapes. Each character group has its own filling method. Application areas are in banking, check or waybill handling, product distribution and document validation, where high accuracy can be vital. It also handles some non-fixed print styles.

FRX multi-lingual omnifont recognition module

This module recognizes machine printed text; i.e. from printed publications, laser or ink-jet printers and electric typewriters. Output from mechanical typewriters in good condition may also be acceptable. It should also be used for Letter or Near Letter Quality (NLQ, LQ) output from dot-matrix printers.

PLUS2W and PLUS3W omnifont recognition modules

This recognition module recognizes machine printed text; i.e. from printed publications, laser or ink-jet printers and electric typewriters. Output from mechanical typewriters in good condition may also be acceptable.

The PLUS2W and PLUS3W modules use voting technology to provide improved recognition results.

The PLUS2W module combines the results from the MOR and MTX modules.

The PLUS3W module combines the results from the MOR, MTX and FRX modules.

With any of these two voting modules, the accuracy is considerably better, but the recognition may need significantly more time than any single module.

Asian recognition module

Recognizes the Asian languages.


Confidence reporting

For some applications, it may be important to know the reliability of the recognized text generated by the engine. These applications may require having additional confidence information for the recognized characters and/or words.

The engine can provide confidence information for the correctness of the recognized text in two different ways:

The Engine's output-marking feature (see: the MARKOPTIONS structure) enables the L_DocSaveResultsToMemory function to place a user-defined character sequence into the final output document before suspiciously recognized characters and/or words. Alternatively, the suspicious characters and/or words can be set to a particular color in the output document to indicate recognition results with low confidence.

In another approach, the Engine can generate output, which consists of structured data for each recognized character. In this output there is one structure or record for each character. The character code of the recognized entity is the primary field. Other fields include the coordinates of the character on the image, the zone to which the character belongs to, the font information for the character, and the confidence information.

The output-marking feature is supported by most of the output converters. Marking low confidence recognition with color requires the selection of an output format (e.g. MS Word) that supports colored text.

For more information on these converters, see the Output converter formatting properties topic.

A possible output for the marking feature might be as follows:

"We would like to ask you some questions, ta*king around 15 minutes"

The text extract above was generated using the output-marking feature, in which the asterisk ('*') character was set to mark the suspiciously recognized characters in the output.

Structured recognized output can be produced though one of the two special output converters (e.g. "2G Type 3"). Even more information can be retrieved directly into application memory by a call to L_DocGetRecognizedCharacters, just after calling L_DocRecognize. The L_DocGetRecognizedCharacters call provides the most detailed information about the recognized data. It results in a 36-byte long RECOGCHARS structure for each recognized character. Whereas the 2G Type output formats provide 2nd guesses for each character, the RECOGCHARS structure provides three.

There are two fields in the RECOGCHARS structure, which provide character recognition confidence information: the nConfidence and the nSpaceErr members.

The nConfidence member is a combined value. Its most significant bit is used to express the certainty/uncertainty of the word. (The word is uncertain, if this bit set to 1). The remaining bits express the certainty of the recognition of the character, which ranges between 0 and 100. A value of zero (0) means that the Engine recognized the character with high confidence. In some cases a word may have some or all characters that are individually suspicious but the characters are not be marked suspicious in the word bit. This is usually a result of language or user dictionary checking. It means the word was validated by the checking subsystem.

The nSpaceErr member ranges between 0 and 100, and it expresses the confidence of the value in the space field of the structure, i.e. whether the Engine is certain regarding the space estimation in front of the recognized character.

Applications that examine the character confidence information can use a threshold value, above which the character value is treated as a suspicious result. A value of 64 is recommended for this purpose. A value less than 64 will indicate that the character was recognized with high confidence. A value of 64 or greater marks that code is suspicious.

Note:

This value (64) is also used internally in the same manner when the output-marking feature for suspicious characters in the output text is enabled.

IMPORTANT NOTE

The confidence reporting system works best when all three recognition modules are used in the voting scheme (RECOGMODULE_OMNIFONT_PLUS3W). If other machine print recognition modules are used (RECOGMODULE_OMNIFONT_PLUS2W, RECOGMODULE_MTEXT_OMNIFONT, etc) then confidence information is still available, but the ability of the system to properly report confidence will be reduced. This will result in a higher level of false negative and false positive reporting of suspicious recognition results.


Drawing Pages and Zones

LEADTOOLS provides functions for drawing pages, with or without zones. The zones may or may not be selected.

Before drawing a page, with or without its zones, that page must be set as "active" by calling L_DocSetActivePage. Once the active page has been set, the page can be drawn by calling L_DocDrawPage. This function gives you the option of drawing the page with or without the zones.

A page may be drawn "zoomed in" by setting a paint zoom factor before actually drawing the page. To set the paint zoom factor for a specific page, call L_DocSetPaintZoomFactor. To get the current paint zoom factor for a specific page, call L_DocGetPaintZoomFactor.

A zone can be selected and the zone drawn in the HDC using L_DocSelectZone or L_DocSelectZoneByPoint. The L_DocSelectZone selects or deselects a zone by specifying a page index and a zone index. If the zone is selected, the zone is drawn with a "selection rectangle" around it. The pen used to draw the zones is set using the L_DocSetZonePen. The pen used to draw the selected zone is set using L_DocSetSelectedZonePen.

The L_DocSelectZoneByPoint selects a zone by determining which zone on the page contains the specified point. If a zone containing that point is found, that zone is selected and the zone is redrawn with a "selection rectangle" around it. As with the L_DocSelectZone function, the pen used to draw the zones is set using the L_DocSetZonePen. The pen used to draw the selected zone is set using L_DocSetSelectedZonePen.

To get information about the selected zone, call L_DocGetSelectedZone.

To update the area of a specific zone on a specific page, call L_DocZone. (This seems more like a general zone function that could be used for more than just drawing.)

L_DocRemoveSelectedZone removes the selected zone from the zone list of the specified page.

When scrolling a page that contains zones, the zones must also be scrolled in order to display the zones at the proper location on the page. The L_DocOffsetZones function takes the amount the page was scrolled and scrolls the zones accordingly.


Language Dictionary List

The OCR engine supports a number of languages for checking the spelling. These languages are listed below, along with their associated dictionary file. The language to use should be specified in the SpellLangId member of the pRecogOpts parameter passed to the L_DocRecognize function. For more information on options for the recognition process, refer to RECOGNIZEOPTS.

SPELLING LANGUAGE | LANGUAGE DICTIONARY FILE
Catalan | R_CAT.DAT
Czech | R_CZH.DAT
Danish | R_DAN.DAT
Dutch | R_DUT.DAT
English | R_ENG.DAT
Finnish | R_FIN.DAT
French | R_FRE.DAT
German | R_GER.DAT
Greek | R_GRE.DAT
Hungarian | R_HUN.DAT*
Italian | R_ITA.DAT
Norwegian | R_NOR.DAT
Polish | R_POL.DAT*
Portuguese | R_POR.DAT
Russian | R_RUS.DAT
Slovenian | R_SLN.DMD
Spanish | R_SPA.DAT
Swedish | R_SWE.DAT

Note:

Also requires the file ICHUNW32.DLL.


Output Converter Formatting Properties

In the final output document, not all possible formatting features can be used, since either they were not applicable or they were not implemented for that particular converter. For example, specifying the page margins in conjunction with a text output converter won't have any effect. The formatting parameters for the final output document can be controlled using L_DocSetRecognitionResultOptions and L_DocGetRecognitionResultOptions.

The table below summarizes what features were implemented for the different converters.

Output Converter | Document Options | Paragraph Options | Character Options | Mark Options
"Text – Standard" | No effect | No effect | No effect | Colors no, markers yes
"Text – Smart" | No effect, except Left Margin | No effect | No effect | Colors no, markers yes
"Text – Stripped" | No effect | No effect | No effect | Colors no, markers yes
"Text – Plain" | No effect, except Left- and Upper Margin | No effect | No effect | Colors no, markers yes
"Text – Comma Delimited" | No effect, except Table | No effect | No effect | Colors no, markers yes
"Text – Tab Delimited" | No effect, except Table | No effect | No effect | Colors no, markers yes
"Rec ASCII (Standard) " | No effect, except Page Breaks | No effect | No effect | Colors no, markers yes
"Rec ASCII (StandardEx)" | No effect, except Page Breaks | No effect | No effect | Colors no, markers yes
"Rec ASCII (Formatted)" | No effect | No effect | No effect | No effect
"General Word Processor" | No effect, except Page Breaks | No effect | No effect | Colors no, markers yes
"Adobe PDF" | No effect, except Graphics | No effect | No effect, except Bold, underline, Italic | No effect
"Adobe PDF with image substitutes" | No effect, except Graphics | No effect | No effect, except Bold, Underline, Italic | No effect
"Adobe PDF with image on text" | No effect, except Graphics | No effect | No effect, except Bold, Underline, Italic | No effect
"Adobe PDF image only" | No effect, except Graphics | No effect | No effect, except Bold, Underline, Italic | No effect
"Adobe PDF edited" | Yes | Yes | Yes | Yes
"HTML 4.0" | Yes, but no Orientation, Size, Break, Margin, Language | Yes | Yes | Yes
"HTML 3.2" | Yes, but no Paper Orientation, Size, Break, Margin, Language | Yes | No font types | Yes
"Word 97, 2000, XP" | Yes | Yes | Yes | Yes
"Excel 97, 2000" | Yes | Yes | Yes | Colors yes, markers no.
"WordPerfect 8" | Yes | Yes | Yes | Yes
"Rich Text Format" | Yes | Yes | Yes | Yes
"PowerPoint 97 (RTF)" | No embedded images, no tables as cells, no frames | Yes | Yes | Colors no, markers yes.
"Publisher 98 (RTF)" | No embedded images, no tables as cells, no frames | Yes | Yes | Colors no, markers yes.
"WordPad (RTF)" | Yes | Yes | Yes | Yes
"RTF Word 2000" | Yes | Yes | Yes | Yes
"RTF Word 97" | Yes | Yes | Yes | Yes
"RTF Word 6.0/95" | Yes | Yes | Yes | Yes
"Open eBook 1.0" | No | Yes | Yes | Yes
"XML" | No | No | No | Yes
"2G Type 2" | No | No effect | No effect | Colors no, markers yes.
"2G Type 3" | No | No effect | No effect | Colors no, markers yes.


Output Text Format List

The following table summarizes the output text formats available in the OCR engine. One of these can be specified as the format for the final output document. The file containing each output converter is also given.

NAME OF THE OUTPUT FORMAT | DESCRIPTION
"Text - Standard" | Text output with line break after each line. If table is present, its cells are positioned by TABs. The output converter is stored in "R4R11T.DLN".
"Text - Smart" | Text output with line break after each line. Left margin is taken into account (with SPACEs) If a table is present; its cells are positioned by SPACEs. The output converter is stored in "R4R11T.DLN".
"Text - Stripped" | Text output with line break after each paragraph. If table is present, its cells are separated by TABs. The output converter is stored in "R4R11T.DLN".
"Text - Plain" | Text output with line break after each line. Left and Upper margins are is taken into account (with SPACEs and NEWLINEs) If table is present, its cells are positioned by TABs. The output converter is stored in "R4R11T.DLN".
"Text - Comma Delimited" | Comma delimited text output. Line/cell contents are surrounded by quotes (""). The default delimiter (comma) can be overwritten (see the REC_OUT.ini file). The output converter is stored in "R4R11T.DLN".
"Text - Tab Delimited" | TAB separated text output. Line/cell contents are surrounded by quotes (""). The output converter is stored in "R4R11T.DLN".
"Rec ASCII (Formatted)" | Text output, layout retention with mimicked SPACEs. Line/cell contents are surrounded by quotes (""). The output converter is stored in "R4R07T.DLN".
"Rec ASCII (Standard)" | Text output allowing quick text conversion. Kept for compatibility reasons. The output converter is stored in "R4R04T.DLN".
"Rec ASCII (StandardEx)" | Text output allowing quick text conversion. Line break after each line and after each zone. Kept for compatibility reasons. The output converter is stored in "R4R08T.DLN".
"General Word Processor" | Text output allowing quick text conversion. Line break after each paragraph. Kept for compatibility reasons. The output converter is stored in "R4R01T.DLN".
"Adobe PDF" | Displaying the generated PDF file in a PDF-reader results in a very similar look to the original document. The text can be searched. The PDF file contains the recognized characters in the same positions as in the original.
"Adobe PDF with image substitutes" | As above, but the problematic recognition cases are handled by the inclusion of smaller image snippets in the output file taken from the original image.Image snippets are also exported for the following cases:- words containing suspect character(s) in the recognized text.- words not approved by the checking subsystem ("non-dictionary" words)- words containing rejection symbol(s)- words containing missing symbol(s).
"Adobe PDF with image on text" | The generated PDF file contains one image for each page in the document and also contains the recognized characters underneath. Displaying the generated PDF file in a PDF-reader results in a very similar look to the original document. The text can be searched..
"Adobe PDF image only" | The generated PDF file contains one image for each page in the document. The file won't contain characters at all, so the text cannot be searched.
"Adobe PDF edited" | The text can be searched. The PDF file contains the recognized characters in the same positions as in the original. Use this output format only if the application has made any change to the recognition result through the L_DocGetRecognizedCharacters and L_DocSetRecognizedCharacters.
"HTML 3.2" | HTML output. HTML 3.2 is useful to export with FORMAT_LEVEL_PART. The output files support both IE and Netscape.
"HTML 4.0" | HTML output. HTML 4.0 can set the exact position/size of objects, use this output format with the FORMAT_LEVEL_FULL option.
"Word 97, 2000, XP" | Microsoft Word 97, Word 2000 and Word XP output format.
"Excel 97, 2000" | Microsoft Excel 97 and Excel 2000 output format.
"WordPerfect 8" | WordPerfect 8 format.
"Rich Text Format" | Quick conversion to Rich Text Format.
"PowerPoint 97 (RTF)" | Rich Text Format for PowerPoint 97
"Publisher 98 (RTF)" | Rich Text Format for Publisher 98
"WordPad (RTF)" | Rich Text Format for WordPad
"RTF Word 2000" | Rich Text Format for Word 2000
"RTF Word 97" | Rich Text Format for Word 97
"RTF Word 6.0/95" | Rich Text Format for Word 6.0/95
"Open eBook 1.0" | Open eBook 1.0 format
"XML" | XML output format conforming with ScanSoft's schema file SSDOC-SCHEMA2.xmlhttp:\\www.scansoft.com/omnipage/xml/SSDOC-SCHEMA2.xml
"2G Type 2" | Binary output of the recognition with a 16-byte long structure for each recognized character.2G Type 2 structure output
"2G Type 3" | Binary output of the recognition with a 16-byte long structure for each recognized character.2G Type 3 structure output


Recognizing Document Pages

Each zone on a page has a recognition module associated with it through the ZONEDATA.RecogModule member. This recognition module provides information about the type of information contained in the zone and how to recognize that data. Depending on the type of recognition module, there may be additional options available for use during recognition. For example, if a zone is associated with a Multi-lingual Omnifont Recognition module (MOR), then other recognition options for this module can be set using L_DocSetMOROptions. To get the current MOR options, use L_DocGetMOROptions.

Similarly, if a zone is associated with a Hand Printed Numeral Recognition module, then other recognition options can be set using L_DocSetHandPrintOptions or retrieved using L_DocGetHandPrintOptions. If the zone is associated with an Optical Mark Recognition module (OMR), other recognition options can be set using L_DocSetOMROptions and retrieved using L_DocGetOMROptions.

For some general information about available recognition modules, refer to An Overview of Recognition Modules.

Depending on the type of recognition module associated with a zone, it may be beneficial to trade-off between the accuracy of recognition and the speed of recognition. Using the L_DocSetRecognizeModuleTradeOff function you can tell the OCR engine to perform the most accurate recognition, the fastest recognition, or a balanced recognition. To get the current trade-off setting for the OCR engine, call L_DocGetRecognizeModuleTradeOff.

If the host PC has two processors or a hyper-threaded one, using the Parallel Recognition Mode can speed up the recognition process by allowing the two recognition engines to run in parallel. The Parallel Recognition Mode may be used when a zone is associated with any of the following recognition modules: RECOGMODULE_MTEXT_OMNIFONT, RECOGMODULE_OMNIFONT_FRX, or RECOGMODULE_OMNIFONT_PLUS3W. To determine whether the Parallel Recognition Mode is enabled, call L_DocIsParallelRecognitionEnabled. To enable or disable the Parallel Recognition Mode, call L_DocEnableParallelRecognition.

When all necessary recognition options have been set, the page(s) can be recognized by calling L_DocRecognize. To get information on the status of the recognition process during recognition, pass a valid pointer to a RECOGNIZESTATUSCALLBACK function to the L_DocRecognize function.

After recognition is complete, the recognized characters can be obtained and the recognition results can be saved to a file or to memory.

The collection of characters recognized for a specific page can be obtained using L_DocGetRecognizedCharacters. To add any characters to this collection of recognized characters, call L_DocSetRecognizedCharacters. When this collection of recognized characters is no longer needed, it should be freed by calling L_DocFreeRecognizedCharacters.

Once the characters for a specific page have been determined using L_DocGetRecognizedCharacters, L_DocGetRecognizedWords can be called to combine the recognized characters into words. To change the contents of the recognized words, change the set of recognized characters by calling L_DocSetRecognizedCharacters. To save the updated recognized characters to a file, call L_DocSaveResultsToFile. To save the results into memory, call L_DocSaveResultsToMemory. When the collection of recognized words is no longer needed, it should be freed by calling L_DocFreeRecognizedWords.

The recognition results can be saved to a file by calling L_DocSaveResultsToFile. The type of material exported to a file, the method in which the material is stored and the file type in which it is stored can all be controlled using L_DocSetRecognitionResultOptions. To get the current recognition results settings, call L_DocGetRecognitionResultOptions.

When saving recognition results to a file, you can use L_DocEnumOutputFileFormats to enumerate all available output file formats supported by the OCR engine. This function will report each file format to an ENUMOUTPUTFILEFORMATS callback function. To get specific information about a particular output file format, call L_DocGetTextFormatInfo.

The recognition results can also be saved to memory by calling L_DocSaveResultsToMemory. When the memory is no longer needed it should be freed by calling L_DocFreeMemoryResults.

To get or set special characters used in the recognition process, use L_DocGetSpecialChar and L_DocSetSpecialChar.

Finally, to get the status of the OCR engine at any time, use L_DocGetStatus.


Working with a Dictionary

The checking subsystem is responsible for checking spelling, checking the user dictionary for acceptable words during recognition, provided a user dictionary has been set, and using a user-written callback function. To use a user dictionary during recognition, one must be created/set using L_DocSetUserDictionary before calling L_DocRecognize. To get the name of the current user dictionary, call L_DocGetUserDictionary.

A new user dictionary can be created or an existing dictionary loaded from a file by calling L_DocSetUserDictionary. To create a new user dictionary, call L_DocSetUserDictionary with the bCreateUD parameter set to TRUE. This will save the current user dictionary to a file and disable that user dictionary.

While the user dictionary is being used, it may have material added or removed. The L_DocGetUserDictionaryState indicates whether the user dictionary has been changed while it has been open.

A user dictionary consists of one or more sections (folders or categories) and each section can have one or more items (folder contents). When the user dictionary is opened or created, the user dictionary is opened to a specific default section, specified in the pszDefSection member of the pUDOpts parameter of the L_DocSetUserDictionary function. To get the name of that section, use L_DocGetUserDictionarySection.

Individual items within a section can be obtained using L_DocGetUserDictionarySectionItem. Items can be added to or removed from a section using L_DocAddItemToUserDictionary and L_DocRemoveItemFromUserDictionary.


Working with Languages

The OCR engine supports many different languages for recognizing text. For a language to be used in the recognition process it must be set as active. To activate the languages that will be used in the next recognition process, call L_DocSelectLanguages. In addition, special character options can also be set for characters in the active languages using L_DocSetCharLangsOptions. For more information on these character options, refer to the CHAROPTIONS structure. To determine what languages have been activated for the OCR engine, call L_DocGetSelectedLanguages. To determine what special character options have been set use L_DocGetCharLangsOptions.

To determine whether a specific character is enabled in the active languages, call L_DocIsCharEnabled.

L_DocGetDefaultSpellLanguages gets the default languages used for checking spelling. All available spelling languages available to the OCR engine are default and are used for checking spelling.

When the active languages are no longer needed, free the pointer to the selected languages by calling L_DocFreeLanguages.


Working with Pages

After starting the OCR document engine, you can begin working with the document page(s). An OCR document contains one or more pages.

The LEADTOOLS OCR functions provide support for the following when working with OCR pages:

Getting information about one ore more pages

Adding or removing pages,

Exporting pages.

Updating pages.

It may be necessary to alter the orientation of a page to make it more readable. To determine the angle necessary to orient the page, call L_DocDetectOrientationDegree. Please note that this function does not perform the orientation, it just obtains the degree of orientation necessary. Call L_DocAutoOrientPage to orient the page automatically. This function corrects the rotation of the page and automatically updates the image data.

Two functions may be used to obtain information about one or more pages in the OCR document. To determine the total number of pages in the OCR document, call L_DocGetPageCount. To get general information about a specific page, call L_DocGetPageInfo.

To add a page from an image file into the OCR document page list, call L_DocAddPage. To remove a page from the OCR document page list, call L_DocRemovePage.

L_DocExportPage exports a page from the OCR document to a file.

If the bitmap of a page changes, for example following the application of an image processing function, the page should by updated by calling L_DocUpdatePage. Before updating the page however, you must lock the page by calling L_DocLockPage. After updating the bitmap, unlock the page by calling L_DocUnlockPage.

To get the general fill method for the engine, call L_DocGetFillMethod. L_DocSetFillMethod updates the general fill method for the engine.

To get the default fill method for a specific page, call L_DocFindDefaultFillMethod.


Working with Zones

Once the desired language(s) have been activated, the user can create zones within the page(s) to be recognized. Zones are optional. A page does not have to have zones in order to be recognized. An OCR document may have a single page or multiple pages. Zones can be added to pages as follows:

1. | Manually: This is done by adding one or more zones to a specific OCR page using L_DocAddZone.
2. | Automatically: All zones on a specific page can be found by calling L_DocFindZones. This function runs an algorithm that automatically determines the zones for the page and adds the zones it finds to the OCR document page. The options that control the algorithm used by this function can be set using L_DocSetZoneOptions. These options should be set before calling L_DocFindZones. To determine the current options for the algorithm used for automatically determining the zones of a page, call L_DocGetZoneOptions.

General Zone functions:

LEADTOOLS provides other function s that can be used with zones, regardless of how the zones were created. L_DocGetZoneCount gets the total number of zones in the zone list for the specified OCR page, while L_DocGetZone gets general zone information for a specific zone in a specific OCR page.

The zone list for a specific page may be saved to a file for later use, or for use with a different OCR document. To save a zone list to a file, call L_DocExportZones. To import a zone list that has been saved using L_DocExportZones, call L_DocImportZones.

To update the zone data of a single zone in the zone list of a specific page, call L_DocUpdateZone.

Finally, a zone may be removed from a zone list for a specific page by calling L_DocRemoveZone.

If the host PC has two processors or a hyper-threaded one, using the Parallel Recognition Mode can speed up the recognition process by allowing the two recognition engines to run in parallel. The Parallel Recognition Mode may be used when a zone is associated with any of the following recognition modules: RECOGMODULE_MTEXT_OMNIFONT, RECOGMODULE_OMNIFONT_FRX, or RECOGMODULE_OMNIFONT_PLUS3W. To determine whether the Parallel Recognition Mode is enabled, call L_DocIsParallelRecognitionEnabled. To enable or disable the Parallel Recognition Mode, call L_DocEnableParallelRecognition.


Files To Be Included With Your Application

The installation procedure creates a directory tree for the LEADTOOLS files, and adds the demonstration programs and online help to your desktop. You specify the root directory during installation. The following subdirectory is created:

REDIST\OCR

Redistributable OCR files.

Note: | You may not copy or redistribute any of the following files without obtaining the proper license. In some cases, the license is included with your initial purchase of LEADTOOLS. In other cases, you must obtain a license from a third party or enter into a royalty agreement with LEAD to obtain the proper license. For these special licensing situations, see the notes below accompanying the specific file.
Note: | You may not distribute the header files with your application, and you may not provide software development capabilities in your application.

The following table summarizes the files you must include on your distribution diskettes to support the LEADTOOLS functions. Most files in the table are optional. 32-bit DLLs are listed. These files are referred to as "Redistributables" in the License Agreement.

Please note that LTKRN is required for ALL API applications. For more information on LTKRN and other files for the Main API, refer to Files To Be Included With Your Application .

Note: All Unicode versions of LEADTOOLS require Microsoft Unicode Layer for Windows (UNICOWS.DLL) in order to function on Windows 95/98/Me. You can obtain MSUL from: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_mslu.asp.

Redistributables:

Explanation:

If you are using a standard release without Unicode, the files to use are:

If you are using a standard release with Unicode, the files to use are:

If you are using an evaluation release without Unicode, the files to use are:

If you are using an evaluation release with Unicode, the files to use are:

LTDOC

LEADTOOLS OCR support. LTDOC14N.DLL is the LEADTOOLS OCR Support DLL.

DLL:
LTDOC14N.DLL

Library:
LTDOC_N.LIB

DLL:
LTDOC14NU.DLL

Library:
LTDOC_NU.LIB

DLL:
LTDOC14E.DLL

Library:
LTDOC_E.LIB

DLL:
LTDOC14EU.DLL

Library:
LTDOC_EU.LIB

LEADv122.lic

License file

For this file and all files below this point in the table, the same files are used for all versions.

For this file and all files below this point in the table, the same files are used for all versions.

For this file and all files below this point in the table, the same files are used for all versions.

For this file and all files below this point in the table, the same files are used for all versions.

RNAPI.DLL

Main ScanSoft module DLL

RNERR.DLL

Error string DLL

AMPLM.dll

ScanSoft licensing DLL

RecDiag.dll

Diagnostic DLL

RECOGN.SET

Code Page Definition file containing pre-defined mostly ASCII-based Code Pages

PDREAD.DLL

PDF reading support main module DLL

P4DLL.DLL

PDF reader DLL

P4DLL.VM

PDF reading support

PSMAXAPI.DLL

PaperPort MAX file support

MRCR3_1s.DLL

TIFF-FX reading support

MORPF.DLL

Page orientation detection DLL

CUD.dll

Part of Spell Checking System

CURTWORD.dat

internal Knowledge base file

ICDLLW32.DLL

Third-party spell checker (for Polish/Hungarian)

ICHUNW32.DLL

Third-party spell checker executable

MOR.DLL

Page orientation detection DLL

OURDICT.DAT

internal Knowledge base file

RECOGN.BCT

Knowledge base file for the MORPF module

RECOGN24.BCT

Knowledge base file for MOR engine

REGEXP.DLL

Regular expression DLL

Rfc12.dll

Needed for Flowing Column output

rndsdawg.dll

Interface to third-party spell checkers (.DMD)

RNDSINSO.DLL

Interface to third-party spell checkers (.DAT)

RNFMAN.DLL

Part of the Image Handling module

TEV.SZO

OCR-specific spell replacement file

xocr.dll

Mango DLL (DCM_STANDARD)

XOCR32B.exe

Main module executable

bnt.dll

Main MTX module DLL

Firewrx.dll

Main FRX module DLL

RM_MAT.INI

Sample RM-specific parameter file

RNDOT.DLL

Main DOT module DLL

RNMATRIX.DLL

Main MAT module DLL

SFOCR.TUD

Knowledge MAT base file

TUDAS.FA

Knowledge base file - 9-pin dot-matrix

Language Dictionary Files

asciieng.lng

Frx language dictionary. Used in case of multi-language selection

BALTIC.shp

Frx shape pack (code page) file

CharSetTable.chr

Frx language dictionary. Used in case of multi-language selection

CYRILLIC.shp

Frx shape pack (code page) file

czech.lng

Frx language dictionary data file

danish.lng

Frx language dictionary data file

dutch.lng

Frx language dictionary data file

english.lng

Frx language dictionary data file

finnish.lng

Frx language dictionary data file

french.lng

Frx language dictionary data file

german.lng

Frx language dictionary data file

greek.lng

Frx language dictionary data file

GREEK.shp

Frx shape pack (code page) file

hungar.lng

Frx language dictionary data file

italian.lng

Frx language dictionary data file

LATIN1.shp

Part of the FRX module

LATIN2.shp

Part of the FRX module

norsk.lng

Frx language dictionary data file

polish.lng

Frx language dictionary data file

port.lng

Frx language dictionary data file

russian.lng

Frx language dictionary data file

spanish.lng

Frx language dictionary data file

swedish.lng

Frx language dictionary data file

turkish.lng

Frx language dictionary data file

TURKISH.shp

Frx shape pack (code page) file

R_cat.dat

Catalan language dictionary data file

R_czh.dat

Czech language dictionary data file

R_dan.dat

Danish language dictionary data file

R_dut.dat

Dutch language dictionary data file

R_ENG.DAT

English language dictionary data file

R_fin.dat

Finnish language dictionary data file

R_fre.dat

French language dictionary data file

R_ger.dat

German language dictionary data file

R_gre.dat

Greek language dictionary data file (Greek alphabet)

R_hun.dat

Hungarian language dictionary data file

R_ita.dat

Italian language dictionary data file

R_nor.dat

Norwegian language dictionary data file

R_pol.dat

Polish language dictionary data file

R_por.dat

Portuguese language dictionary data file

R_rus.dat

Russian language dictionary data file (Cyrillic alphabet)

R_spa.dat

Spanish language dictionary data file

R_swe.dat

Swedish language dictionary data file

R_SLN.dmd

Slovenian language dictionary data file

Converter Files:

ATM2LLL.DLL

Required for DLC converters

CDK2000.DAT

Engine License/ Keycode file

eBookConv.dlc

"Open eBook 1.0" converter

EXCELcnv.dlc

"Excel 97, 2000" converter

FORMATTER.DLL

Formatter DLL (required for DLC converters)

HTMLcnv.dlc

"HTML 3.2" and "HTML 4.0" converters

LECSOMGR.DLL

"Lecso" manager DLL (required for DLC converters)

PDFcnv.dlc

PDF converters (available if PDF-output license is present)

PRERENDERING.DLL

Pre-renderer DLL (required for DLC converters)

r4r01t.dln

"General Word Processor" converter

r4r03t.dln

"2G" converters

r4r04t.dln

"Rec ASCII (Standard)" converter

r4r05t.dln

"Rich Text format" converter

r4r07t.dln

"Rec ASCII (Formatted)" converter

r4r08t.dln

"Rec ASCII (StandardEx)" converter

R4R11T.DLN

ATM to Lecso converter (required for DLC converters)

REC_OUT.INI

Output converter configuration file

RENDERING.DLL

Renderer DLL (required for DLC converters)

RenderingExt.dat

Renderer configuration file

RTFconv.dlc

RTF converters

TXTconv.dlc

Different text converters

WORDcnv.dlc

"Word 97, 2000, XP" converter

WPcnv.dlc

"WordPerfect 8" converter

XMLConv.dlc

"XML" converter

Recognition Module Files:

HAND.REC

Knowledge base file for alpha characters for RER recognition module

NUMPLUS.REC

Knowledge base file for digits for RER recognition module

KADMOS.UK

Knowledge base file for RER recognition module

RM_RER.INI

Sample RM-specific parameter file for RER recognition module

RNICR2.DLL

Main RER module DLL

KEZIRSTR.TBS

Knowledge base file for HNR

RNICR.DLL

Main HNR module DLL

RNOMR.DLL

Main OMR module DLL

Language Files for the MTX engine:

XINRWP.BIN

All of the .BIN files are language files for the MTX engine

XIBRTC.BIN

XIBRTD.BIN

XIBRTE.BIN

XIBRTP.BIN

XIBRTS.BIN

XIBRTZ.BIN

XIBRZB.BIN

XIBRZC.BIN

XIBRZD.BIN

XIBRZE.BIN

XIBRZP.BIN

XIBRZZ.BIN

XIBRZS.BIN

XIDANB.BIN

XIDANC.BIN

XIDAND.BIN

XIDANE.BIN

XIDANP.BIN

XIDANS.BIN

XIDANZ.BIN

XIDUTB.BIN

XIDUTC.BIN

XIDUTD.BIN

XIDUTE.BIN

XIDUTP.BIN

XIDUTS.BIN

XIDUTZ.BIN

XIENGB.BIN

used unaltered for all languages

XIENGC.BIN

used unaltered for all languages

XIENGD.BIN

used unaltered for all languages

XIENGE.BIN

used unaltered for all languages

XIENGF.BIN

used unaltered for all languages

XIENGL.BIN

used unaltered for all languages

XIENGP.BIN

used unaltered for all languages

XIENGS.BIN

used unaltered for all languages

XIENGZ.BIN

used unaltered for all languages

XIFINB.BIN

All of the .BIN files are language files for the MTX engine

XIFINC.BIN

XIFIND.BIN

XIFINE.BIN

XIFINP.BIN

XIFINS.BIN

XIFINZ.BIN

XIFRNB.BIN

XIFRNC.BIN

XIFRND.BIN

XIFRNE.BIN

XIFRNP.BIN

XIFRNS.BIN

XIFRNZ.BIN

XIGRMB.BIN

XIGRMC.BIN

XIGRMD.BIN

XIGRME.BIN

XIGRMP.BIN

XIGRMS.BIN

XIGRMZ.BIN

XIITLB.BIN

XIITLC.BIN

XIITLD.BIN

XIITLE.BIN

XIITLP.BIN

XIITLS.BIN

XIITLZ.BIN

XINRWB.BIN

XINRWC.BIN

XINRWD.BIN

XINRWE.BIN

XIBRTB.BIN

XINRWS.BIN

XINRWZ.BIN

XIPRTB.BIN

XIPRTC.BIN

XIPRTD.BIN

XIPRTE.BIN

XIPRTP.BIN

XIPRTS.BIN

XIPRTZ.BIN

XISPNB.BIN

XISPNC.BIN

XISPND.BIN

XISPNE.BIN

XISPNP.BIN

XISPNS.BIN

XISPNZ.BIN

XISWDB.BIN

XISWDC.BIN

XISWDD.BIN

XISWDE.BIN

XISWDP.BIN

XISWDS.BIN

XISWDZ.BIN


Installation Directory

The installation procedure creates a directory tree for the LEADTOOLS files, demonstration programs and online help. You specify the root directory during installation.

Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

The following is a list of the subdirectories in the root directory:

BIN | Executable files for the demonstration programs.
HELP | Online help files.
EXAMPLES\DLL | One subdirectory for each example API program.
EXAMPLES\COM | One subdirectory for each example COM program.
EXAMPLES\RES | Resource files for the example programs.
INCLUDE | Header files, BAS files, and the ActiveX's MFC interface files for versions of Visual C++ earlier than 4.0.
LIB | Library files.
REDIST\OCR | Redistributable files. These are copies of the LEADTOOLS files and other files that you may need to distribute with your application. For exact information about required files, refer to Files To Be Included With Your Application.


Technical Support

As a registered user, free technical support is available. You must register your software to receive any technical support. Technical support is available 9 a.m. through 6 p.m. Eastern Standard Time. If you are calling by phone, please be at your computer. You can also contact us through the following methods:

Phone: | (704) 372-9681
E-mail: | support@leadtools.com
FAX: | (704) 372-8161
Home page: | http://www.leadtools.com
FTP: | ftp.leadtools.com

You can also contact LEAD by mail at:

LEAD Technologies, Inc.
Attn: Technical Support
Suite 400
1201 Greenwood Cliff
Charlotte, NC 28204

Before calling technical support, please look in the online documentation and the example programs for an answer to your question.


OCR API Function Groups

OCR Functions

OCR Functions: Starting and Shutting Down

OCR Functions: Pages

OCR Functions: Zones

OCR Functions: Languages

OCR Functions: User Dictionary

OCR Functions: Recognition

OCR Functions: Drawing Zones and Pages

OCR Functions: Callbacks


OCR Functions: Drawing Zones and Pages

OCR Functions:
Drawing Zones and Pages

L_DocDrawPage

L_DocGetPaintZoomFactor

L_DocGetSelectedZone

L_DocOffsetZones

L_DocRemoveSelectedZone

L_DocSelectZoneByPoint

L_DocSelectZone

L_DocSetActivePage

L_DocSetPaintZoomFactor

L_DocSetSelectedZonePen

L_DocSetZonePen

L_DocZone


OCR Functions: Languages

OCR Functions:
Languages

L_DocFreeLanguages

L_DocGetCharLangsOptions

L_DocGetDefaultSpellLanguages

L_DocGetSelectedLanguages

L_DocIsCharEnabled

L_DocSelectLanguages

L_DocSetCharLangsOptions


OCR Functions: Pages

OCR Functions:
Pages

L_DocAddPage

L_DocAutoOrientPage

L_DocDetectOrientationDegree

L_DocExportPage

L_DocFindDefaultFillMethod

L_DocGetFillMethod

L_DocGetPageCount

L_DocGetPageInfo

L_DocLockPage

L_DocRemovePage

L_DocSetFillMethod

L_DocUnlockPage

L_DocUpdatePage


OCR Functions: Recognition

OCR Functions:
Recognition

L_DocEnableParallelRecognition

L_DocEnumOutputFileFormats

L_DocFreeMemoryResults

L_DocFreeRecognizedCharacters

L_DocFreeRecognizedWords

L_DocGetHandPrintOptions

L_DocGetMOROptions

L_DocGetOMROptions

L_DocGetRecognitionResultOptions

L_DocGetRecognizedCharacters

L_DocGetRecognizedWords

L_DocGetSpecialChar

L_DocGetStatus

L_DocGetTextFormatInfo

L_DocIsParallelRecognitionEnabled

L_DocRecognize

L_DocSaveResultsToFile

L_DocSaveResultsToMemory

L_DocSetHandPrintOptions

L_DocSetMOROptions

L_DocSetOMROptions

L_DocSetRecognitionResultOptions

L_DocSetRecognizedCharacters

L_DocSetRecognizeModuleTradeOff

L_DocGetRecognizeModuleTradeOff

L_DocSetSpecialChar


OCR Functions: Starting and Shutting Down

OCR Functions:
Starting and Shutting Down

L_DocLoadSettings

L_DocSaveSettings

L_DocSetProgressCB

L_DocShutDown

L_DocStartUp


OCR Functions: User Dictionary

OCR Functions:
User Dictionary

L_DocAddItemToUserDictionary

L_DocGetUserDictionary

L_DocGetUserDictionarySectionItem

L_DocGetUserDictionarySection

L_DocGetUserDictionaryState

L_DocRecognize

L_DocRemoveItemFromUserDictionary

L_DocSetUserDictionary


OCR Functions: Zones

OCR Functions:
Zones

L_DocAddZone

L_DocEnableParallelRecognition

L_DocExportZones

L_DocFindZones

L_DocGetZoneCount

L_DocGetZone

L_DocGetZoneOptions

L_DocImportZones

L_DocIsParallelRecognitionEnabled

L_DocRemoveZone

L_DocSetZoneOptions

L_DocUpdateZone


OCR Functions: Callbacks

OCR Functions:
Callbacks

ENUMOUTPUTFILEFORMATS

PROGRESSCALLBACK

RECOGNIZESTATUSCALLBACK

VERIFICATIONCALLBACK


Data Types

Basic Data Types and Keywords

LEADTOOLS Basic Data Types

Keywords Used in Declarations

OCR Enumerations

CHAR_FILTER

FILLMETHOD

RECOGMODULE

ZONETYPE

PAGEPARSER

LANGIDS

RECOGMODULE_TRADEOFF

HANDRECOG_STYLE

OMRFRAME

OMRSENSE

FORMATLEVEL

TABLEMETHOD

SELECTOR

PAPERTYPE

PAPERORIENTATION

LANGUAGE_RESULT

COLOR_RESULT

LINESPACING

ALIGNMENT

FORMAT_OUTPUTTYPE

OCRPROCID

FONTDEFINE

VERIFYCODE

FORMAT_TYPE

L_HDOC

OCR Structures

PROGRESSDATA

ZONEDATA

AUTOZONEOPTS

CHAROPTIONS

MOROPTIONS

HANDPRINTOPTIONS

OMROPTIONS

USERDICTIONARY

STATUS

DOCUMENTOPTIONS

PARAGRAPHOPTIONS

CHARACTEROPTIONS

MARKOPTIONS

RESULTOPTIONS

TEXTFORMATINFO

SPECIALCHAR

PAGEINFO

RECOGNIZEOPTS

RECOGCHARS

RECOGWORDS

Structures Used with Input and Output Functions

WINDOWS Structures


LEADTOOLS Basic Data Types

LEADTOOLS has defined the following basic data types for portability:

Data Type | Definition and Usage
L_BITFIELD | Defined as L_UINT; used as a bit field.
L_BOOL | Defined as L_UINT; used as a boolean value.
L_CHAR | Defined as char; used as a signed 8-bit integer.
L_DOUBLE | Defined as double; used as a double precision floating point number.
L_FLOAT | Defined as float; used as a floating point number.
L_INT | Defined as int; used as a signed integer, 16-bits or larger.
L_INT16 | Defined as short; used as a signed 16-bit integer.
L_INT32 | Defined as long; used as a signed 32-bit integer.
L_UCHAR | Defined as unsigned char; used as an unsigned 8-bit integer.
L_UINT | Defined as unsigned; used as an unsigned integer, 16-bits or larger.
L_UINT16 | Defined as unsigned short; used as an unsigned 16-bit integer.
L_UINT32 | Defined as unsigned long; used as an unsigned 32-bit integer.
L_VOID | Defined as void; used as a void.
L_COMP | Defined as L_UINT; used as a handle to a computer
L_MEDIA | Defined as L_VOID L_FAR *; used as a void pointer
L_WCHAR | Defined as wchar; used as a signed 16-bit integer.
L_TCHAR | Defined as either char or TCHAR. If FOR_UNICODE is defined, then L_TCHAR will be defined as TCHAR.


Keywords Used in Declarations

LEADTOOLS uses the following keywords in declarations of functions, structures, and datatypes:

Keyword | Definition and Usage
L_FAR | Defined as nothing; used as a placeholder.
L_HUGE | Defined as nothing; used as a placeholder.
L_EXPORT | Defined as nothing; used as a placeholder.
L_PASCAL | Defined as nothing; used as a placeholder.
EXT_FUNCTION | Defined as WINAPI; used as an attribute for all toolkit functions.
pEXT_FUNCTION | Defined as EXT_FUNCTION L_FAR *; used as an attribute when defining pointers to toolkit functions.
EXT_CALLBACK | Defined as _cdecl L_FAR; used as an attribute for all toolkit callback functions.
pEXT_CALLBACK | Defined as EXT_CALLBACK L_FAR *; used as an attribute when defining pointers to toolkit callback functions.


ALIGNMENT

typedef enum
{
ALIGNMENT_LEFTALIGNMENT = 0,
ALIGNMENT_RIGHTALIGNMENT,
ALIGNMENT_CENTERED,
ALIGNMENT_JUSTIFIED
} ALIGNMENT;

The ALIGNMENT enumerated type represents the possible alignment options.

Value | Meaning
ALIGNMENT_LEFTALIGNMENT | Paragraphs will have left alignment.
ALIGNMENT_RIGHTALIGNMENT | Paragraphs will have right alignment.
ALIGNMENT_CENTERED | Paragraphs will be centered.
ALIGNMENT_JUSTIFIED | Paragraphs will be justified (Default).

Comments

This enumerated type is used by the following structure:

PARAGRAPHOPTIONS


AUTOZONEOPTS

typedef struct _tagAutoZoneOpts
{
L_UINT uStructSize;
PAGEPARSER Parser;
L_BOOL bEnableForceSingleColumn;
L_BOOL bVisibleGridLines;
} AUTOZONEOPTS, L_FAR * pAUTOZONEOPTS;

The AUTOZONEOPTS structure contains options for automatic zone detection.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(AUTOZONEOPTS).
Parser | Specifies the Page parser algorithm to be used by the engine. For a list of possible values, refer to PAGEPARSER.
bEnableForceSingleColumn | Flag that indicates whether to force the page to be a single column. Possible values are:
 | Value | Meaning
 | TRUE | Force the page to be a single column.
 | FALSE | Do not force the page to be a single column. This prevents the engine from detecting columns and placing their contents one below the other. It is useful for conserving the columnar structure in tables
bVisibleGridLines | Flag that indicates whether to make the grid lines visible. Possible values are:
 | Value | Meaning
 | TRUE | Make the grid lines visible.
 | FALSE | Make the grid lines invisible.

Comments

pAUTOZONEOPTS is a pointer to a AUTOZONEOPTS structure. Where the function parameter type is pAUTOZONEOPTS, declare a ZONEDATA variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pAUTOZONEOPTS variable is necessary only if the program requires a pointer.

This structure is used with following functions:

L_DocSetZoneOptions

L_DocGetZoneOptions


CHAR_FILTER

typedef enum
{
ZONE_CHAR_FILTER_DEFAULT = 0,
ZONE_CHAR_FILTER_DIGIT,
ZONE_CHAR_FILTER_UPPERCASE,
ZONE_CHAR_FILTER_LOWERCASE,
ZONE_CHAR_FILTER_PUNCTUATION,
ZONE_CHAR_FILTER_MISCELLANEOUS,
ZONE_CHAR_FILTER_PLUS,
ZONE_CHAR_FILTER_ALL,
ZONE_CHAR_FILTER_ALPHA,
ZONE_CHAR_FILTER_NUMBERS
} CHAR_FILTER;

The CHAR_FILTER enumerated type represents the possible character set filters for a zone.

Value | Meaning
ZONE_CHAR_FILTER_DEFAULT | This value is used to have the zone handled globally. Do not combine this with any other filter.
ZONE_CHAR_FILTER_DIGIT | Recognition of numerals only. E.g.: "3" (Digit Three).
ZONE_CHAR_FILTER_UPPERCASE | Recognition of uppercase letters only, including accented ones. E.g.: "A" (Capital A).
ZONE_CHAR_FILTER_LOWERCASE | Recognition of lowercase letters only including accented ones. E.g.: "a" (Lowercase a).
ZONE_CHAR_FILTER_PUNCTUATION | Recognition of punctuation signs only. E.g.: "!" (Exclamation Mark).
ZONE_CHAR_FILTER_MISCELLANEOUS | Recognition of miscellaneous characters only. E.g.: "+" (Plus sign).
ZONE_CHAR_FILTER_PLUS | Enables the use of the Filter Plus characters specified by the pCHAROPTIONS structure. The Filter Plus characters are added to the language environment after any filtering. This filter can also be used to achieve a very limited character set.
ZONE_CHAR_FILTER_ALL | Since all elements are enabled, there is no filtering.
ZONE_CHAR_FILTER_ALPHA | Recognition of upper and lowercase letters only.
ZONE_CHAR_FILTER_NUMBERS | Recognition of the digits, plus the Filter Plus characters set by the L_DocSetCharLangsOptions function.

Comments

This enumerated type is used by the following structures:

ZONEDATA

CHAROPTIONS


CHARACTEROPTIONS

typedef struct _tagCharacterOptions
{
L_UINT uStructSize;
SELECTOR SelOutputFont;
FONTDEFINE FontNames[5];
L_INT nSize;
L_BOOL bBold;
L_BOOL bItalic;
L_BOOL bUnderline;
} CHARACTEROPTIONS, L_FAR * pCHARACTEROPTIONS;

The CHARACTEROPTIONS structure contains Character properties for the final output document.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(CHARACTEROPTIONS).
SelOutputFont | Value that indicates whether the font names and character sizes are exported, and if so, are they calculated or predefined. For a list of possible values, refer to SELECTOR.
FontNames | Array of output font constants. The application can change the real default font names to be used for each index.
nSize | Character size setting for the pre-defined font. Valid only if the SelOutputFont member is SEL_PREDEFINED.
bBold | Flag that specifies whether the character is bold. Possible values are:
 | Value | Meaning
 | TRUE | The character is bold.
 | FALSE | The character is not bold.
bItalic | Flag that specifies whether the character is italic. Possible values are:
 | Value | Meaning
 | TRUE | The character is italic.
 | FALSE | The character is not italic.
bUnderline | Flag that specifies whether the character is underlined. Possible values are:
 | Value | Meaning
 | TRUE | The character is underlined.
 | FALSE | The character is not underlined.

Comments

pCHARACTEROPTIONS is a pointer to a CHARACTEROPTIONS structure. Where the function parameter type is pCHARACTEROPTIONS, declare a CHARACTEROPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pCHARACTEROPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetRecognitionResultOptions

L_DocGetRecognitionResultOptions

This structure is used with the RESULTOPTIONS structure.


CHAROPTIONS

typedef struct _tagCharOptions
{
L_UINT uStructSize;
L_WCHAR * pszCharPlus;
L_UINT uCharPlusSize;
L_WCHAR * pszCharFilterPlus;
L_UINT uCharFilterPlusSize;
CHAR_FILTER CharFilter;
} CHAROPTIONS, L_FAR * pCHAROPTIONS;

The CHAROPTIONS structure contains options for selected languages.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(CHAROPTIONS).
pszCharPlus | Specifies some individual characters. These characters are added to the set of characters determined by the language selection. The resulting set of characters is called the Language environment.
uCharPlusSize | Specifies the size of pszCharPlus member.
pszCharFilterPlus | Specifies a set of individual characters. The Filter Plus characters broaden or define the filtered set of characters globally or on a per-zone basis.
uCharFilterPlusSize | Specifies the size of pszCharFilterPlus member.
CharFilter | Specifies a Global filter, i.e. a Character Set filter to be applied globally, at page level. If this function is not called by the integrating application after the engine's initialization, the value ZONE_CHAR_FILTER_ALL is applied, i.e. the Language environment will not be filtered globally. The Global filter setting is applied to all zones with ZONE_CHAR_FILTER_DEFAULT in their CharFilter member of ZONEDATA structures.

Comments

pCHAROPTIONS is a pointer to a CHAROPTIONS structure. Where the function parameter type is pCHAROPTIONS, declare a CHAROPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pCHAROPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetCharLangsOptions

L_DocGetCharLangsOptions


COLOR_RESULT

typedef enum
{
COLOR_NONEGR,
COLOR_BW,
COLOR_GRAY,
COLOR_TRUECOLOR,
COLOR_ORIGINAL
} COLOR_RESULT;

The COLOR_RESULT enumerated type represents the options for outputting graphics.

Value | Meaning
COLOR_NONEGR | Suppress all graphics in the final output document.
COLOR_BW | Convert all graphics zones to B/W before inserting them into the final output document.
COLOR_GRAY | Convert all graphics zones to 8-bit grayscale before inserting them into the final output document.
COLOR_TRUECOLOR | Convert all graphics zones to 24-bit color before inserting them into the final output document.
COLOR_ORIGINAL | Transmit all graphics zones without conversion.

Comments

This enumerated type is used by the following structures:

DOCUMENTOPTIONS


DOCUMENTOPTIONS

typedef struct _tagDocumentOptions
{
L_UINT uStructSize;
SELECTOR PaperSize;
PAPERTYPE PaperType;
PAPERORIENTATION PaperOrientation;
SELECTOR Language;
LANGUAGE_RESULT ResLang;
COLOR_RESULT Color;
L_BOOL bEnableTextInBoxes;
SELECTOR Margins;
RECT rcMargin;
L_BOOL bEnablePageBreaks;
TABLEMETHOD TableMethod;
} DOCUMENTOPTIONS, L_FAR * pDOCUMENTOPTIONS;

The DOCUMENTOPTIONS structure contains page properties for the final output document.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(DOCUMENTOPTIONS).
PaperSize | Value that indicates whether the paper size will be exported and, if the value is exported, it will indicate whether the value is calculated or predefined. For a list of possible values, refer to SELECTOR.
PaperType | Value that indicates the type of paper. This value is exported only if the PaperSize member is SEL_PREDEFINED. For a list of possible values, refer to PAPERTYPE.
PaperOrientation | Value that indicates the orientation of the output document. This value is used (i.e. exported) only if the PaperSize member is SEL_PREDEFINED.
Language | Value that indicates whether the resulting language is exported, and if so, is the language calculated or predefined. For a list of possible values, refer to SELECTOR.
ResLang | Value that represents the output language. This value is used (i.e. exported) only if the Language member is SEL_PREDEFINED. For a list of possible values, refer to LANGUAGE_RESULT.
Color | Value that indicates how to output the graphics. For a list of possible values, refer to COLOR_RESULT.
bEnableTextInBoxes | Flag that indicates whether the content of zones will be kept in frames in the final output document. Possible values are:
 | Value | Meaning
 | TRUE | The content of zones will be kept in frames in the final output document.
 | FALSE | The content of zones will not be kept in frames in the final output document.
Margins | Value that indicates whether the margins will be exported, and if so, whether the margins be calculated or predefined.
rcMargin | Margin setting, measured in Twips. This value is used (i.e. exported) only if the Margins member is SEL_PREDEFINED
bEnablePageBreaks | Value that indicates whether to retain or drop page breaks in the final output document. Possible values are:
 | Value | Meaning
 | TRUE | Keep the page breaks in the output document.
 | FALSE | Drop the page breaks from the output document.
TableMethod | Value that indicates how tables will be output. For a list of possible values, refer to TABLEMETHOD.

Comments

pDOCUMENTOPTIONS is a pointer to a DOCUMENTOPTIONS structure. Where the function parameter type is pDOCUMENTOPTIONS, declare a DOCUMENTOPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pDOCUMENTOPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetRecognitionResultOptions

L_DocGetRecognitionResultOptions

This structure is used with the RESULTOPTIONS structure.


FILLMETHOD

typedef enum
{
FILL_DEFAULT = 0,
FILL_OMNIFONT,
FILL_DRAFTDOT9,
FILL_OMR,
FILL_HANDPRINT,
FILL_DRAFTDOT24,
FILL_OCRA,
FILL_OCRB,
FILL_MICR,
FILL_DOTDIGIT,
FILL_DASHDIGIT,
FILL_NO_OCR,
} FILLMETHOD;

The FILLMETHOD enumerated type represents the possible filling methods for a zone.

Value | Meaning
FILL_DEFAULT | This value denotes that the filling method for a zone is undetermined.
FILL_OMNIFONT | The omnifont zone filling method. It denotes a machine printed text with any typeface which is not too stylized.
FILL_DRAFTDOT9 | The 9-pin draft dot-matrix zone filling method. It denotes a 9-pin draft dot-matrix printout.
FILL_OMR | The optical mark zone filling method. It specifies a search for the presence or absence of an OMR mark within the zone.
FILL_HANDPRINT | The handprinted zone filling method. It denotes handprinting within the zone.
FILL_DRAFTDOT24 | The 24-pin draft dot-matrix zone filling method. It denotes a 24-pin draft dot-matrix printout.
FILL_OCRA | The OCR-A zone filling method.
FILL_OCRB | The OCR-B zone filling method.
FILL_MICR | The magnetic ink character filling method (also called E-13B).
FILL_DOTDIGIT | The dot-digit zone filling method.
FILL_DASHDIGIT | The dash-digit zone filling method.
FILL_NO_OCR | No recognition will be attempted.

Comments

This enumerated type is used by the following structure:

ZONEDATA


FONTDEFINE

typedef enum
{
FONT_PROPORTSERIF = 1,
FONT_PROPORTSANSSERIF,
FONT_MONOSERIF,
FONT_MONOSANSSERIF,
FONT_PREDEFFONT,
} FONTDEFINE;

The FONTDEFINE enumerated type represents the possible fonts.

Value | Meaning
FONT_PROPORTSERIF | Serif font - Times New Roman
FONT_PROPORTSANSSERIF | Arial
FONT_MONOSERIF | Serif font - Courier New
FONT_MONOSANSSERIF | SansSerif font - Courier New
FONT_PREDEFFONT | Pre-defined - Times New Roman

Comments

This enumerated type is used by the following structure:

CHARACTEROPTIONS


FORMAT_OUTPUTTYPE

typedef enum
{
OUT_TYPE_PLAIN,
OUT_TYPE_WORD_PROCESSOR,
OUT_TYPE_TRUE_WORD_PROCESSOR,
OUT_TYPE_TABLE,
OUT_TYPE_UNKNOWN,
} FORMAT_OUTPUTTYPE;

The FORMAT_OUTPUTTYPE enumerated type represents the possible text output types.

Value | Meaning
OUT_TYPE_PLAIN | Plain text: only characters, without any formatting information, embedded images or framed text. Corresponds to FORMAT_LEVEL_DROP
OUT_TYPE_WORD_PROCESSOR | Word processor output: formatted text. May handle embedded images, but not columns or text frames. Corresponds to FORMAT_LEVEL_DROP or FORMAT_LEVEL_PART
OUT_TYPE_TRUE_WORD_PROCESSOR | Sophisticated word processor output: Supports formatted text with embedded images, and text or other elements in frames. Corresponds to any of the three format levels.
OUT_TYPE_TABLE | Spreadsheet output.
OUT_TYPE_UNKNOWN | Unknown output. The selected output converter is unknown for the Engine.

Comments

This enumerated type is used by the following structure:

TEXTFORMATINFO


FORMAT_TYPE

typedef enum
{
DOC_TEXT_STANDARD = 0,
DOC_TEXT_SMART,
DOC_TEXT_STRIPPED,
DOC_TEXT_PLAIN,
DOC_TEXT_COMMA_DELIMITED,
DOC_TEXT_TAB_DELIMITED,
DOC_REC_ASCII_FORMATTED,
DOC_REC_ASCII_STANDARD,
DOC_REC_ASCII_STANDARDEX,
DOC_GENERAL_WORD_PROCESSOR,
DOC_PDF_IMAGE_SUBSTITUTES,
DOC_PDF_IMAGE_ON_TEXT,
DOC_PDF_IMAGEONLY,
DOC_PDF_EDITED,
DOC_HTML_3_2,
DOC_HTML_4_2,
DOC_WORD_97_2000_XP,
DOC_EXCEL_97_2000,
DOC_WORDPERFECT_8,
DOC_RTF,
DOC_PPT_97_RTF,
DOC_PUB_98_RTF,
DOC_WORDPAD_RTF,
DOC_RTF_WORD_2000,
DOC_RTF_WORD_97,
DOC_RTF_WORD_6_95,
DOC_XML,
DOC_2G_TYPE_2,
DOC_2G_TYPE_3,
} FORMAT_TYPE;

The FORMAT_TYPE enumerated type represents the possible document format types.

Value | Meaning
DOC_TEXT_STANDARD | Text - Standard
DOC_TEXT_SMART | Text - Smart
DOC_TEXT_STRIPPED | Text - Stripped
DOC_TEXT_PLAIN | Text - Plain
DOC_TEXT_COMMA_DELIMITED | Text - Comma Delimited
DOC_TEXT_TAB_DELIMITED | Text - Tab Delimited
DOC_REC_ASCII_FORMATTED | Rec ASCII (Formatted)
DOC_REC_ASCII_STANDARD | Rec ASCII (Standard)
DOC_REC_ASCII_STANDARDEX | Rec ASCII (StandardEx)
DOC_GENERAL_WORD_PROCESSOR | General Word Processor
DOC_PDF_IMAGE_SUBSTITUTES | Adobe PDF with image substitutes
DOC_PDF_IMAGE_ON_TEXT | Adobe PDF with image on text
DOC_PDF_IMAGEONLY | Adobe PDF image only
DOC_PDF_EDITED | Adobe PDF edited
DOC_HTML_3_2 | HTML 3.2
DOC_HTML_4_2 | HTML 4.0
DOC_WORD_97_2000_XP | Word 97, 2000, XP
DOC_EXCEL_97_2000 | Excel 97, 2000
DOC_WORDPERFECT_8 | WordPerfect 8
DOC_RTF | Rich Text Format
DOC_PPT_97_RTF | PowerPoint 97 (RTF)
DOC_PUB_98_RTF | Publisher 98 (RTF)
DOC_WORDPAD_RTF | WordPad (RTF)
DOC_RTF_WORD_2000 | RTF Word 2000
DOC_RTF_WORD_97 | RTF Word 97
DOC_RTF_WORD_6_95 | RTF Word 6.0/95
DOC_XML | XML
DOC_2G_TYPE_2 | 2G Type 2
DOC_2G_TYPE_3 | 2G Type 3

Comments

This enumerated type is used by the following structure:

RESULTOPTIONS


FORMATLEVEL

typedef enum
{
FORMAT_LEVEL_FULL = 0,
FORMAT_LEVEL_PART,
FORMAT_LEVEL_DROP,
} FORMATLEVEL;

The FORMATLEVEL enumerated type represents how much formatting is exported.

Value | Meaning
FORMAT_LEVEL_FULL | All formatting is retained, including text zoning (Default).
 | It keeps the original layout of the pages, including columns. This is done with text, graphical and table zones and frames. This is offered only for target applications capable of handling these. FORMAT_LEVEL_FULL formatting is the only choice for all PDF export, except for the file type "Adobe PDF edited".
FORMAT_LEVEL_PART | A partial set of output formatting elements is retained.
 | All recognized paragraph and character formatting features along with graphics and tables are exported.
FORMAT_LEVEL_DROP | Only some character formatting properties (font size and name) is exported, if applicable. When exporting to text file types, graphics and tables are not supported.

Comments

This enumerated type is used by the following structure:

RESULTOPTIONS


HANDPRINTOPTIONS

typedef struct _tagHandPrintOptions
{
L_UINT uStructSize;
HANDRECOG_STYLE style;
L_BOOL bSpace;
L_INT nCharHeight;
L_INT nCharWidth;
L_INT nCharSpace;
} HANDPRINTOPTIONS, L_FAR * pHANDPRINTOPTIONS;

The HANDPRINTOPTIONS structure contains options for Hand print recognition.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(HANDPRINTOPTIONS).
style | Specifies the writing style setting for the hand printed numerals recognition module. For a list of possible options, refer to HANDRECOG_STYLE.
bSpace | Flag that indicates whether or not the hand printed numeral recognition module should export spaces detected between characters. Possible values are:
 | Value | Meaning
 | TRUE | Export spaces detected between characters.
 | FALSE | Do not export spaces detected between characters.
nCharHeight | Character height in 1/1200 of an inch. A value of zero (0) forces the automatic calculation of this parameter. If this parameter is zero (0), the remaining fields are also considered 0.
nCharWidth | Character width in 1/1200 of an inch. A value of zero (0) forces the automatic calculation of this parameter.
nCharSpace | Leading spaces in 1/1200 of an inch. A value of zero (0) forces the automatic calculation of this parameter.

Comments

This structure used only when the recognition module is RECOGMODULE_HAND_PRINTED_NUMERAL.

pHANDPRINTOPTIONS is a pointer to a HANDPRINTOPTIONS structure. Where the function parameter type is pHANDPRINTOPTIONS, declare a HANDPRINTOPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pHANDPRINTOPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetHandPrintOptions

L_DocGetHandPrintOptions


HANDRECOG_STYLE

typedef enum
{
HAND_STYLE_EURO,
HAND_STYLE_US
} HANDRECOG_STYLE;

The HANDRECOG_STYLE enumerated type represents the possible writing styles for hand printed numerals.

Value | Meaning
HAND_STYLE_EURO | Writing in European style (Default).
HAND_STYLE_US | Writing in North-American style.

Comments

This enumerated type is used by the following structure:

HANDPRINTOPTIONS


L_HDOC

LEADTOOLS has defined the following data type for referencing the OCR document handle:

Data Type | Definition and Usage
L_HDOC | Defined as Handle, used as a handle of the OCR document toolkit.


LANGIDS

typedef enum
{
LANG_ID_AUTO = -2,
LANG_ID_NO = -1,
LANG_ID_ENGLISH = 0,
LANG_ID_GERMAN,
LANG_ID_FRENCH,
LANG_ID_DUTCH,
LANG_ID_NORWEGIAN,
LANG_ID_SWEDISH,
LANG_ID_FINNISH,
LANG_ID_DANISH,
LANG_ID_ICELANDIC,
LANG_ID_PORTUGUESE,
LANG_ID_SPANISH,
LANG_ID_CATALAN,
LANG_ID_ITALIAN,
LANG_ID_MALTESE,
LANG_ID_GREEK,
LANG_ID_POLISH,
LANG_ID_CZECH,
LANG_ID_SLOVAK,
LANG_ID_HUNGARIAN,
LANG_ID_SLOVENIAN,
LANG_ID_CROATIAN,
LANG_ID_ROMANIAN,
LANG_ID_ALBANIAN,
LANG_ID_TURKISH,
LANG_ID_ESTONIAN,
LANG_ID_LATVIAN,
LANG_ID_LITHUANIAN,
LANG_ID_ESPERANTO,
LANG_ID_SERBIAN,
LANG_ID_MACEDONIAN,
LANG_ID_MOLDAVIAN,
LANG_ID_BULGARIAN,
LANG_ID_BYELORUSSIAN,
LANG_ID_UKRAINIAN,
LANG_ID_RUSSIAN,
LANG_ID_AFRIKAANS,
LANG_ID_AYMARA,
LANG_ID_BASQUE,
LANG_ID_BEMBA,
LANG_ID_BLACKFOOT,
LANG_ID_BRETON,
LANG_ID_BRAZILIAN,
LANG_ID_BUGOTU,
LANG_ID_CHAMORRO,
LANG_ID_CHECHEN,
LANG_ID_CHUANA_TSWANA,
LANG_ID_CORSICAN,
LANG_ID_CROW,
LANG_ID_ESKIMO,
LANG_ID_FAROESE,
LANG_ID_FIJIAN,
LANG_ID_FRISIAN,
LANG_ID_FRIULIAN,
LANG_ID_GAELIC_IRISH,
LANG_ID_GAELIC_SCOTTISH,
LANG_ID_GANDA_LUGANDA,
LANG_ID_GUARANI,
LANG_ID_HANI,
LANG_ID_HAWAIIAN,
LANG_ID_IDO,
LANG_ID_INDONESIAN,
LANG_ID_INTERLINGUA,
LANG_ID_KABARDIAN,
LANG_ID_KASUB,
LANG_ID_KAWA,
LANG_ID_KIKUYU,
LANG_ID_KONGO,
LANG_ID_KPELLE,
LANG_ID_KURDISH,
LANG_ID_LAPPISH,
LANG_ID_LATIN,
LANG_ID_LUBA,
LANG_ID_LUXEMBOURGIAN,
LANG_ID_MALAGASY,
LANG_ID_MALAY,
LANG_ID_MALINKE,
LANG_ID_MAORI,
LANG_ID_MAYAN,
LANG_ID_MIAO,
LANG_ID_MINANKABAW,
LANG_ID_MOHAWK,
LANG_ID_NAHUATL,
LANG_ID_NYANJA,
LANG_ID_OCCIDENTAL,
LANG_ID_OJIBWAY,
LANG_ID_PAPIAMENTO,
LANG_ID_PIDGIN_ENGLISH,
LANG_ID_PROVENCAL,
LANG_ID_QUECHUA,
LANG_ID_RHAETIC,
LANG_ID_ROMANY,
LANG_ID_RUANDA,
LANG_ID_RUNDI,
LANG_ID_SAMOAN,
LANG_ID_SARDINIAN,
LANG_ID_SHONA,
LANG_ID_SIOUX,
LANG_ID_SOMALI,
LANG_ID_SOTHO_SUTO_SESUTO,
LANG_ID_SUNDANESE,
LANG_ID_SWAHILI,
LANG_ID_SWAZI,
LANG_ID_TAGALOG,
LANG_ID_TAHITIAN,
LANG_ID_TINPO,
LANG_ID_TONGAN,
LANG_ID_TUN,
LANG_ID_VISAYAN,
LANG_ID_WELSH,
LANG_ID_WEND_SORBIAN,
LANG_ID_WOLOF,
LANG_ID_XHOSA,
LANG_ID_ZAPOTEC,
LANG_ID_ZULU,
LANG_ID_GALICIAN,
LANG_ID_SERBIAN_LATIN,
LANG_ID_SAMI,
LANG_ID_LULE_SAMI,
LANG_ID_NORTHERN_SAMI,
LANG_ID_SOUTHERN_SAMI,
} LANGIDS;

The LANGIDS enumerated type represents the languages supported by the OCR engine.

Value | Meaning
LANG_ID_AUTO | Used Auto language
LANG_ID_NO | No selected language
LANG_ID_ENGLISH | English
LANG_ID_GERMAN | German
LANG_ID_FRENCH | French
LANG_ID_DUTCH | Dutch
LANG_ID_NORWEGIAN | Norwegian
LANG_ID_SWEDISH | Swedish
LANG_ID_FINNISH | Finnish
LANG_ID_DANISH | Danish
LANG_ID_ICELANDIC | Icelandic
LANG_ID_PORTUGUESE | Portuguese
LANG_ID_SPANISH | Spanish
LANG_ID_CATALAN | Catalan
LANG_ID_ITALIAN | Italian
LANG_ID_MALTESE | Maltese
LANG_ID_GREEK | Greek
LANG_ID_POLISH | Polish
LANG_ID_CZECH | Czech
LANG_ID_SLOVAK | Slovak
LANG_ID_HUNGARIAN | Hungarian
LANG_ID_SLOVENIAN | Slovenian
LANG_ID_CROATIAN | Croatian
LANG_ID_ROMANIAN | Romanian
LANG_ID_ALBANIAN | Albanian
LANG_ID_TURKISH | Turkish
LANG_ID_ESTONIAN | Estonian
LANG_ID_LATVIAN | Latvian
LANG_ID_LITHUANIAN | Lithuanian
LANG_ID_ESPERANTO | Esperanto
LANG_ID_SERBIAN | Serbian
LANG_ID_MACEDONIAN | Macedonian
LANG_ID_MOLDAVIAN | Moldavian
LANG_ID_BULGARIAN | Bulgarian
LANG_ID_BYELORUSSIAN | Byelorussian
LANG_ID_UKRAINIAN | Ukrainian
LANG_ID_RUSSIAN | Russian
LANG_ID_AFRIKAANS | Afrikaans
LANG_ID_AYMARA | Aymara
LANG_ID_BASQUE | Moldavian
LANG_ID_BEMBA | Bemba
LANG_ID_BLACKFOOT | Blackfoot
LANG_ID_BRETON | Breton
LANG_ID_BRAZILIAN | Brazilian
LANG_ID_BUGOTU | Bugotu
LANG_ID_CHAMORRO | Chamorro
LANG_ID_CHECHEN | Chechen
LANG_ID_CHUANA_TSWANA | Chuana Tswana
LANG_ID_CORSICAN | Corsican
LANG_ID_CROW | Crow
LANG_ID_ESKIMO | Eskimo
LANG_ID_FAROESE | Faroese
LANG_ID_FIJIAN | Fijian
LANG_ID_FRISIAN | Frisian
LANG_ID_FRIULIAN | Friulian
LANG_ID_GAELIC_IRISH | Gaelic Irish
LANG_ID_GAELIC_SCOTTISH | Gaelic Scottish
LANG_ID_GANDA_LUGANDA | Ganda Luganda
LANG_ID_GUARANI | Guarani
LANG_ID_HANI | HANI
LANG_ID_HAWAIIAN | Hawaiian
LANG_ID_IDO | IDO
LANG_ID_INDONESIAN | Indonesian
LANG_ID_INTERLINGUA | Interlingua
LANG_ID_KABARDIAN | Kabardian
LANG_ID_KASUB | Kasub
LANG_ID_KAWA | Kawa
LANG_ID_KIKUYU | Kikuyu
LANG_ID_KONGO | Kongo
LANG_ID_KPELLE | Kpelle
LANG_ID_KURDISH | Kurdish
LANG_ID_LAPPISH | Lappish
LANG_ID_LATIN | Latin
LANG_ID_LUBA | LUBA
LANG_ID_LUXEMBOURGIAN | Luxembourgian
LANG_ID_MALAGASY | Malagasy
LANG_ID_MALAY | Malay
LANG_ID_MALINKE | Malinke
LANG_ID_MAORI | Malinke
LANG_ID_MAYAN | Mayan
LANG_ID_MIAO | Miao
LANG_ID_MINANKABAW | Minankabaw
LANG_ID_MOHAWK | Mohawk
LANG_ID_NAHUATL | Nahuatl
LANG_ID_NYANJA | Nyanja
LANG_ID_OCCIDENTAL | Occidental
LANG_ID_OJIBWAY | Ojibway
LANG_ID_PAPIAMENTO | Papiamento
LANG_ID_PIDGIN_ENGLISH | Pidgin English
LANG_ID_PROVENCAL | Provencal
LANG_ID_QUECHUA | Quechua
LANG_ID_RHAETIC | Rhaetic
LANG_ID_ROMANY | Romany
LANG_ID_RUANDA | Ruanda
LANG_ID_RUNDI | Rundi
LANG_ID_SAMOAN | Samoan
LANG_ID_SARDINIAN | Sardinian
LANG_ID_SHONA | Shona
LANG_ID_SIOUX | Sioux
LANG_ID_SOMALI | Somali
LANG_ID_SOTHO_SUTO_SESUTO | Sotho Suto Sesuto
LANG_ID_SUNDANESE | Sundanese
LANG_ID_SWAHILI | Swahili
LANG_ID_SWAZI | Swazi
LANG_ID_TAGALOG | Tagalog
LANG_ID_TAHITIAN | Tahitian
LANG_ID_TINPO | Tinpo
LANG_ID_TONGAN | Tongan
LANG_ID_TUN | Tun
LANG_ID_VISAYAN | Visayan
LANG_ID_WELSH | Welsh
LANG_ID_WEND_SORBIAN | Wend Sorbian
LANG_ID_WOLOF | Wolof
LANG_ID_XHOSA | Xhosa
LANG_ID_ZAPOTEC | Zapotec
LANG_ID_ZULU | Zulu
LANG_ID_GALICIAN | Galician
LANG_ID_SERBIAN_LATIN | Serbian (Latin)
LANG_ID_SAMI | Sami
LANG_ID_LULE_SAMI | Lule Sami
LANG_ID_NORTHERN_SAMI | Northern Sami
LANG_ID_SOUTHERN_SAMI | Southern Sami

Comments

This enumerated type is used by the following structures:

RECOGNIZEOPTS

RECOGCHARS


LANGUAGE_RESULT

typedef enum
{
LANG_OUT_NO_LANGUAGE,
LANG_OUT_ALBANIAN,
LANG_OUT_FRENCH,
LANG_OUT_FRENCH_BELGIAN,
LANG_OUT_NORWEGIAN_NYNORSK,
LANG_OUT_POLISH,
LANG_OUT_BAHASA,
LANG_OUT_CATALAN,
LANG_OUT_CROATO_SERBIAN_LATIN,
LANG_OUT_CZECH,
LANG_OUT_DANISH,
LANG_OUT_DUTCH,
LANG_OUT_DUTCH_BELGIAN,
LANG_OUT_ENGLISH_AUSTRALIAN,
LANG_OUT_ENGLISH_UK,
LANG_OUT_ENGLISH_US,
LANG_OUT_FINNISH,
LANG_OUT_FRENCH_CANADIAN,
LANG_OUT_FRENCH_SWISS,
LANG_OUT_GERMAN,
LANG_OUT_GERMAN_SWISS,
LANG_OUT_GREEK,
LANG_OUT_HUNGARIAN,
LANG_OUT_ICELANDIC,
LANG_OUT_ITALIAN,
LANG_OUT_ITALIAN_SWISS,
LANG_OUT_NORWEGIAN,
LANG_OUT_PORTUGUESE_BRAZILIAN,
LANG_OUT_PORTUGUESE,
LANG_OUT_RHAETO_ROMANIC,
LANG_OUT_ROMANIAN,
LANG_OUT_SLOVAK,
LANG_OUT_SPANISH_CASTILIAN,
LANG_OUT_SPANISH_MEXICAN,
LANG_OUT_SWEDISH,
LANG_OUT_TURKISH,
LANG_OUT_SERBO_CROATIAN_CYRILLIC,
LANG_OUT_BULGARIAN,
LANG_OUT_RUSSIAN,
} LANGUAGE_RESULT;

The LANGUAGE_RESULT enumerated type represents the possible output languages.

Value | Meaning
LANG_OUT_NO_LANGUAGE | No Language
LANG_OUT_ALBANIAN | Albanian
LANG_OUT_FRENCH | French
LANG_OUT_FRENCH_BELGIAN | French Belgian
LANG_OUT_NORWEGIAN_NYNORSK | Norwegian Nynorsk
LANG_OUT_POLISH | Polish
LANG_OUT_BAHASA | Bahasa
LANG_OUT_CATALAN | Catalan
LANG_OUT_CROATO_SERBIAN_LATIN | Croato Serbian Latin
LANG_OUT_CZECH | Czech
LANG_OUT_DANISH | Danish
LANG_OUT_DUTCH | Dutch
LANG_OUT_DUTCH_BELGIAN | Dutch Belgian
LANG_OUT_ENGLISH_AUSTRALIAN | English Australian
LANG_OUT_ENGLISH_UK | English UK
LANG_OUT_ENGLISH_US | English US
LANG_OUT_FINNISH | Finnish
LANG_OUT_FRENCH_CANADIAN | French Canadian
LANG_OUT_FRENCH_SWISS | French Swiss
LANG_OUT_GERMAN | German
LANG_OUT_GERMAN_SWISS | German Swiss
LANG_OUT_GREEK | Greek
LANG_OUT_HUNGARIAN | Hungarian
LANG_OUT_ICELANDIC | Icelandic
LANG_OUT_ITALIAN | Italian
LANG_OUT_ITALIAN_SWISS | Italian Swiss
LANG_OUT_NORWEGIAN | Norwegian
LANG_OUT_PORTUGUESE_BRAZILIAN | Portuguese Brazilian
LANG_OUT_PORTUGUESE | Portuguese
LANG_OUT_RHAETO_ROMANIC | Rhaeto Romanic
LANG_OUT_ROMANIAN | Romanian
LANG_OUT_SLOVAK | Slovak
LANG_OUT_SPANISH_CASTILIAN | Spanish Castilian
LANG_OUT_SPANISH_MEXICAN | Spanish Mexican
LANG_OUT_SWEDISH | Swedish
LANG_OUT_TURKISH | Turkish
LANG_OUT_SERBO_CROATIAN_CYRILLIC | Serbo Croatian Cyrillic
LANG_OUT_BULGARIAN | Bulgarian
LANG_OUT_RUSSIAN | Russian

Comments

This enumerated type is used by the following structure:

DOCUMENTOPTIONS


LINESPACING

typedef enum
{
LINE_HALF,
LINT_ONE,
LINE_ONEANDHALF,
LINE_DOUBLE,
} LINESPACING;

The LINESPACING enumerated type represents the line spacing options.

Value | Meaning
LINE_HALF | Half line spacing.
LINT_ONE | Single line spacing (Default).
LINE_ONEANDHALF | One and a half line spacing.
LINE_DOUBLE | Double line spacing.

Comments

This enumerated type is used by the following structure:

PARAGRAPHOPTIONS


MARKOPTIONS

typedef struct _tagMarkOptions
{
L_UINT uStructSize;
L_UINT uColSuspCharacter;
L_UINT uColRejectionSymbol;
L_UINT uColMissingSymbol;
L_UINT uColSuspWord;
L_WCHAR szSepBeforeSuspCharacter[MAX_SIZE];
L_WCHAR szSepBeforeRejectionSymbol[MAX_SIZE];
L_WCHAR szSepBeforeMissingSymbol[MAX_SIZE];
L_WCHAR szSepStartofSuspWord[MAX_SIZE];
L_WCHAR szSepEndofSuspWord[MAX_SIZE];
L_WCHAR szSepStartofLine[MAX_SIZE];
L_WCHAR szSepEndofLine[MAX_SIZE];
L_WCHAR szSepStartofTableRow[MAX_SIZE];
L_WCHAR szSepEndofTableRow[MAX_SIZE];
L_WCHAR szSepStartofPara[MAX_SIZE];
L_WCHAR szSepEndofPara[MAX_SIZE];
L_WCHAR szSepStartofZone[MAX_SIZE];
L_WCHAR szSepEndofZone[MAX_SIZE];
L_WCHAR szSepStartofPage[MAX_SIZE];
L_WCHAR szSepEndofPage[MAX_SIZE];
} MARKOPTIONS, L_FAR *pMARKOPTIONS;

The MARKOPTIONS structure contains Output-marking properties (coloring or separator marking) for the final output document.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(MARKOPTIONS).
uColSuspCharacter | Defines a color for the suspect characters in the final output document. Valid values may be one or more COLOR_RESULT values, ORed (|).
uColRejectionSymbol | Defines a color for the rejection symbol in the final output document. Valid values may be one or more COLOR_RESULT values, ORed (|).
uColMissingSymbol | Defines a color for the missing symbol in the final output document. Valid values may be one or more COLOR_RESULT values, ORed (|).
uColSuspWord | Defines a color for the suspect words in the final output document, i.e. for the words not approved by the Checking subsystem. Valid values may be one or more COLOR_RESULT values, ORed (|).
szSepBeforeSuspCharacter | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted before each suspect character in the final output document.
szSepBeforeRejectionSymbol | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted before each rejection symbol in the final output document.
szSepBeforeMissingSymbol | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted before each missing symbol in the final output document.
szSepStartofSuspWord | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted before each suspect word in the final output document (i.e. before the words not approved by the Checking subsystem).
szSepEndofSuspWord | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted after each suspect word in the final output document (i.e. after the words not approved by the Checking subsystem).
szSepStartofLine | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the beginning of each line in the final output document.
szSepEndofLine | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at he end of each line in the final output document.
szSepStartofTableRow | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted before each table row in the final output document.
szSepEndofTableRow | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the end of each table row in the final output document.
szSepStartofPara | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the beginning of each paragraph in the final output document.
szSepEndofPara | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the end of each paragraph in the final output document.
szSepStartofZone | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the beginning of each zone in the final output document.
szSepEndofZone | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the end of each zone in the final output document.
szSepStartofPage | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the beginning of each page in the final output document.
szSepEndofPage | Pointer to a user-defined UNICODE string or NULL. It must point to a separator string that will be inserted at the end of each page in the final output document.

Comments

pMARKOPTIONS is a pointer to a MARKOPTIONS structure. Where the function parameter type is pMARKOPTIONS, declare a MARKOPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pMARKOPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetRecognitionResultOptions

L_DocGetRecognitionResultOptions

This structure is used with the RESULTOPTIONS structure.


MOROPTIONS

typedef struct _tagMOROptions
{
L_UINT uStructSize;
L_BOOL bEnableFax;
} MOROPTIONS, L_FAR * pMOROPTIONS;

The MOROPTIONS structure contains options for MOR recognition.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(MOROPTIONS).
bEnableFax | Flag that specifies whether the fax image mode is enabled or not. Possible values are:
 | Value | Meaning
 | TRUE | The fax image mode is enabled.
 | FALSE | The fax image mode is not enabled.

Comments

This structure used only when the recognition module for the zone is RECOGMODULE_MULTI_LINGUAL_OMNIFONT. The recognition module for a zone can be found in the ZONEDATA structure.

pMOROPTIONS is a pointer to a MOROPTIONS structure. Where the function parameter type is pMOROPTIONS, declare a MOROPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pMOROPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functios:

L_DocSetMOROptions

L_DocGetMOROptions


OCRPROCID

typedef enum
{
PROC_LOADING_IMG = 0,
PROC_SAVING_IMG,
PROC_FIND_ZONES,
PROC_RECOGNIZE_MOR,
PROC_RECOGNITION,
PROC_SPELLING,
PROC_SAVE_RECOG_RESULT,
PROC_WRITE_OUTPUT_DOC,
PROC_WRITE_OUTPUT_IMG,
PROC_RECOGNITION3,
PROC_PROCESSING_IMG
} OCRPROCID;

The OCRPROCID enumerated type represents the possible OCR processes.

Value | Meaning
PROC_LOADING_IMG | Identifies the Image loading process
PROC_SAVING_IMG | Identifies the image saving process
PROC_FIND_ZONES | Identifies the page-layout decomposition (auto-zoning) process
PROC_RECOGNIZE_MOR | Identifies the 1st pass of the Recognition process. This pass is applicable only for the RECOGMODULE_MULTI_LINGUAL_OMNIFONT recognition module
PROC_RECOGNITION | Identifies the 2nd pass of the Recognition process
PROC_SPELLING | Identifies the Checking process
PROC_SAVE_RECOG_RESULT | Reading from the recognition data file
PROC_WRITE_OUTPUT_DOC | Identifies the process for writing the recognized text to the final output document (to file or memory)
PROC_WRITE_OUTPUT_IMG | Identifies the image conversion process activated by the PROC_WRITE_OUTPUT_DOC process for saving the image of a graphical image zone to the word processor output document
PROC_RECOGNITION3 | Identifies the 3rd pass of the Recognition process. This pass is applicable only for the RECOGMODULE_OMNIFONT_PLUS3W recognition module.
PROC_PROCESSING_IMG | Identifies the image pre-processing process.

Comments

This enumerated type is used by the following structure:

PROGRESSDATA


OMRFRAME

typedef enum
{
OMR_FRAME_AUTO,
OMR_FRAME_NO,
OMR_FRAME_YES,
} OMRFRAME;

The OMRFRAME enumerated type represents the presence or absence of a frame in a zone, or whether frames will be automatically detected.

Value | Meaning
OMR_FRAME_AUTO | Automatic frame detection (Default).
OMR_FRAME_NO | There is no frame within the zone.
OMR_FRAME_YES | There is a frame within the zone.

Comments

This enumerated type is used by the following structure:

OMROPTIONS


OMROPTIONS

typedef struct _tagOMROptions
{
L_UINT uStructSize;
L_BOOL bFill;
OMRFRAME Frame;
OMRSENSE Sense;
} OMROPTIONS, L_FAR * pOMROPTIONS;

The OMROPTIONS structure contains options for OMR recognition.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(OMROPTIONS).
bFill | Flag that indicates whether the recognition output can take two or three values. Possible values are:
 | Value | Meaning
 | TRUE | Three values are possible for grouped zones:
 |  | 0 = unfilled,
 |  | 1 = filled,
 |  | 2 = filled-in-error.
 | FALSE | Only one of two values can be generated for each RM_OMR zone:
 |  | 0 = unfilled
 |  | 1 = filled
Frame | Frame detection method to be set. This specifies whether the OMR zone borders will be visible or invisible in the images. For a list of possible values, refer to OMRFRAME.
Sense | Mark sensitivity level to be set (Default: OMR_SENSE_NORMAL). For a list of possible values, refer to OMRSENSE.

Comments

The default values are:

* | two-value output from recognition,
* | OMR_FRAME_AUTO detection mode,
* | OMR_SENSE_NORMAL sensitivity setting.

This structure used only when the recognition module is RECOGMODULE_OMR.

pOMROPTIONS is a pointer to a OMROPTIONS structure. Where the function parameter type is pOMROPTIONS, declare a OMROPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pOMROPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetOMROptions

L_DocGetOMROptions


OMRSENSE

typedef enum
{
OMR_SENSE_NORMAL,
OMR_SENSE_LOW,
OMR_SENSE_LOWER,
OMR_SENSE_LOWEST,
} OMRSENSE;

The OMRSENSE enumerated type represents the mark sensitivity.

Value | Meaning
OMR_SENSE_NORMAL | Highest mark sensitivity (Default).
OMR_SENSE_LOW | Less mark sensitivity.
OMR_SENSE_LOWER | Lower mark sensitivity.
OMR_SENSE_LOWEST | Lowest mark sensitivity.

Comments

This enumerated type is used by the following structure:

OMROPTIONS


PAGEINFO

typedef struct _tagPageInfo
{
L_UINT uStructSize;
L_INT nWidth;
L_INT nHeight;
L_INT nBitsPerPixel;
} PAGEINFO, L_FAR * pPAGEINFO;

The PAGEINFO structure contains page information.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(PAGEINFO)
nWidth | Specifies the page width
nHeight | Specifies the page height
nBitsPerPixel | Specifies the number of bits per pixel (bit depth).

Comments

pPAGEINFO is a pointer to a PAGEINFO structure. Where the function parameter type is pPAGEINFO, declare a PAGEINFO variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pPAGEINFO variable is necessary only if the program requires a pointer.

This structure is used with the L_DocGetPageInfo function.


PAGEPARSER

typedef enum
{
PARSE_AUTO,
PARSE_LEGACY,
PARSE_STANDARD,
PARSE_FAST
} PAGEPARSER;

The PAGEPARSER enumerated type represents the possible page parser algorithms.

Value | Meaning
PARSE_AUTO | Specifies that the Engine will determine at run-time which page parser algorithm will be applied. (Default.)
PARSE_LEGACY | Identifies the page-parsing algorithm used in the toolkit till version 10.0.
PARSE_STANDARD | Identifies the most accurate page parsing algorithm of the Engine.
PARSE_FAST | This algorithm can be treated as a simplified variant of PARSE_LEGACY: this algorithm doesn't try to find tables on the page. It is the fastest (but least accurate) parsing algorithm available. Use it only for simple page parsing tasks!

Comments

This enumerated type is used by the following structure:

AUTOZONEOPTS


PAPERORIENTATION

typedef enum
{
ORIENT_PORTRAIT = 0,
ORIENT_LANDSCAPE,
} PAPERORIENTATION;

The PAPERORIENTATION enumerated type represents the orientation of the output document.

Value | Meaning
ORIENT_PORTRAIT | The orientation of the final output document is Portrait (Default).
ORIENT_LANDSCAPE | The orientation of the final output document is Landscape.

Comments

This enumerated type is used by the following structure:

DOCUMENTOPTIONS


PAPERTYPE

typedef enum
{
PAPER_TYPE_A4,
PAPER_TYPE_A0,
PAPER_TYPE_A1,
PAPER_TYPE_A2,
PAPER_TYPE_A3,
PAPER_TYPE_A5,
PAPER_TYPE_A6,
PAPER_TYPE_A7,
PAPER_TYPE_B0,
PAPER_TYPE_B1,
PAPER_TYPE_B2,
PAPER_TYPE_B3,
PAPER_TYPE_B4,
PAPER_TYPE_B5,
PAPER_TYPE_B6,
PAPER_TYPE_B7,
PAPER_TYPE_LETTER,
PAPER_TYPE_LEGAL,
PAPER_TYPE_EXECUTIVE,
PAPER_TYPE_FROMIMAGEMAX,
} PAPERTYPE;

The PAPERTYPE enumerated type represents the paper type.

Value | Meaning
PAPER_TYPE_A4 | A4 size (Default).
PAPER_TYPE_A0 | A0 size.
PAPER_TYPE_A1 | A1 size.
PAPER_TYPE_A2 | A2 size.
PAPER_TYPE_A3 | A3 size.
PAPER_TYPE_A5 | A5 size.
PAPER_TYPE_A6 | A6 size.
PAPER_TYPE_A7 | A7 size.
PAPER_TYPE_B0 | B0 size.
PAPER_TYPE_B1 | B1 size.
PAPER_TYPE_B2 | B2 size.
PAPER_TYPE_B3 | B3 size.
PAPER_TYPE_B4 | B4 size.
PAPER_TYPE_B5 | B5 size.
PAPER_TYPE_B6 | B6 size.
PAPER_TYPE_B7 | B7 size.
PAPER_TYPE_LETTER | Letter size.
PAPER_TYPE_LEGAL | Legal size.
PAPER_TYPE_EXECUTIVE | Executive size.
PAPER_TYPE_FROMIMAGEMAX | The size is determined from the original image.

Comments

This enumerated type is used by the following structures:

DOCUMENTOPTIONS


PARAGRAPHOPTIONS

typedef struct _tagParagraphOptions
{
L_UINT uStructSize;
SELECTOR SelSpaceBefore;
L_INT nSpaceBefore;
SELECTOR SelParaIndent;
L_INT nFirstLineIndent;
SELECTOR SelLineSpacing;
LINESPACING LineSpacing;
SELECTOR SelAlignment;
ALIGNMENT Alignment;
} PARAGRAPHOPTIONS, L_FAR * pPARAGRAPHOPTIONS;

The PARAGRAPHOPTIONS structure contains Paragraph properties for the final output document.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(PARAGRAPHOPTIONS).
SelSpaceBefore | Value that indicates whether the extra space before a paragraph is exported, and if so, is it calculated or predefined. For a list of possible values, refer to SELECTOR.
nSpaceBefore | Value that represents the number of spaces before a paragraph that are exported. This value is used (i.e. exported) only if the SelSpaceBefore member is SEL_PREDEFINED. This value is measured in Twips.
SelParaIndent | Value that indicates whether an indented first line of a paragraph will be exported, and if so, is the indentation size calculated or predefined. For a list of possible values, refer to SELECTOR.
nFirstLineIndent | Value that represents the length of the indentation of the first line of a paragraph, that will be exported. This value is measured in Twips, and it is used (i.e. exported) only if the SelParaIndent handling switch is SEL_PREDEFINED.
SelLineSpacing | Value that indicates whether the line spacing is exported, and if so, is it calculated or predefined. For a list of possible values, refer to SELECTOR.
LineSpacing | Value that represents the line spacing to be exported. This value is used (i.e. exported) only if the SelLineSpacing member is SEL_PREDEFINED. For a list of possible values, refer to SELECTOR.
SelAlignment | Value that indicates whether the alignment will be exported, and if so, is the alignment calculated or predefined.
Alignment | Value that represents the alignment to be exported. This value is used (i.e. exported) only if the Alignment member is SEL_PREDEFINED.

Comments

pPARAGRAPHOPTIONS is a pointer to a PARAGRAPHOPTIONS structure. Where the function parameter type is pPARAGRAPHOPTIONS, declare a PARAGRAPHOPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pPARAGRAPHOPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetRecognitionResultOptions

L_DocGetRecognitionResultOptions

This structure is used with RESULTOPTIONS structure.


PROGRESSDATA

typedef struct _tagProgressData
{
L_UINT uStructSize;
OCRPROCID Id;
L_INT nPercent;
L_INT nAccecptCharCount;
L_INT nRejectedCharCount;
L_UINT uObjSize;
L_UCHAR *uObjData;
} PROGRESSDATA, L_FAR * pPROGRESSDATA;

The PROGRESSDATA structure used for PROGRESSCALLBACK function.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(PROGRESSDATA).
Id | Identifier of the process currently running. For a list of possible values, refer to OCRPROCID.
nPercent | Progress of the current process expressed as a percentage
nAccecptCharCount | Number of recognized characters accepted during the recognition process.
nRejectedCharCount | Number of characters rejected during the recognition process
uObjSize | Size of the uObjData buffer containing the real time information
uObjData | Sample text from the recognized characters (typically 30-80 chars) in UNICODE for real-time information.

Comments

The uObjSize and uObjData fields are also recognition specific fields. They serve for real time display purposes. These fields are applicable only if the Id member is PROC_RECOGNITION.

The nAccecptCharCount and nRejectedCharCount fields are recognition specific fields. They are applicable only if the Id member is PROC_RECOGNIZE_MOR, PROC_RECOGNITION or PROC_RECOGNITION3.

pPROGRESSDATA is a pointer to a PROGRESSDATA structure. Where the function parameter type is pPROGRESSDATA, declare a PROGRESSDATA variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pPROGRESSDATA variable is necessary only if the program requires a pointer.

This structure will be filled only when PROGRESSCALLBACK is called. The PROGRESSCALLBACK function will be called if you have set a callback function with L_DocSetProgressCB.


RECOGCHARS

typedef struct _tagRecogChars
{
L_UINT uStructSize;
RECT rcArea;
L_INT nYOffset;
L_INT nSpace;
L_INT nSpaceErr;
L_WCHAR wGuessCode;
L_WCHAR wGuessCode2;
L_WCHAR wGuessCode3;
L_INT nZoneIndex;
L_INT nCellIndex;
L_INT nConfidence;
L_UINT uFont;
L_INT nFontSize;
L_INT nCharFormat;
LANGIDS Lang;
LANGIDS Lang2;
} RECOGCHARS, L_FAR * pRECOGCHARS;

The RECOGCHARS structure contains information about the recognized characters.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(RECOGCHARS).
rcArea | RECT structure that contains the area for the recognized character.
nYOffset | Y coordinate of the baseline measured from the top edge of the rectangle exactly containing the character.
nSpace | Value that represents the number of spaces in front of the recognized code character.
nSpaceErr | Confidence number expressing the certainty of the space parameter.
wGuessCode | Character code in UNICODE. This is either the first guess of the recognition or zero (0) signaling that the engine could not recognize the character (rejected character).
wGuessCode2 | Second guess of the recognition, if any.
wGuessCode3 | Third guess of the recognition, if any.
nZoneIndex | Index of the zone in the zone list which contains the character.
nCellIndex | Index of the cell in the cell list which contains the character (applicable only for ZONE_TABLE zones). The cell list is not accessible for the application.
nConfidence | Confidence number expressing both the certainty of the recognition of the first guess (code member) and also the certainty of the word.
uFont | Font information about the recognized character. Possible values are given below. These values can be combined using OR (|)
 | Value | Meaning
 | FONT_ITALIC | [0x001] The character is italic.
 | FONT_BOLD | [0x002] The character is bold.
 | FONT_UNDERLINE | [0x004] The character is underlined.
 | FONT_SUBSCRIPT | [0x008] The character is subscript.
 | FONT_SUPERSCRIPT | [0x010] The character is superscript.
 | FONT_SANSSERIF | [0x020] The character is Sans Serif.
 | FONT_SERIF | [0x040] The character is Serif.
 | FONT_PROPORTIONAL | [0x080] The character is proportional.
nFontSize | Font size in points.
nCharFormat | Formatting attributes of the character. Possible values are given below. These values can be combined using OR (|)
 | Value | Meaning
 | CHAR_ENDOFLINE | [0x001] This is the last character in a line.
 | CHAR_ENDOFPARA | [0x002] This is the last character in a paragraph.
 | CHAR_ENDOFWORD | [0x004] This is the last character of a word.
 | CHAR_ENDOFZONE | [0x008] This is the last character in a zone.
 | CHAR_ENDOFPAGE | [0x010] This is the last character on a page.
 | CHAR_ENDOFCELL | [0x020] This is the last character in a cell.
 |  | (applicable only for ZONE_TABLE type zones).
Lang | Value that represents the first language in which the recognized word is found. For a list of possible values, refer to LANGIDS.
Lang2 | Value that represents the second language in which the recognized word is found.

Comments

The application should evaluate the nConfidence member, when confidence information on the recognition is also required. Its most significant bit is used to express the certainty/uncertainty of the word (word is uncertain, if this bit set to one (1). The remaining bits represent the certainty of the character recognition, which ranges between 0 and 100. The smaller this value is, the higher is the confidence of the recognition. For more details, see the Confidence reporting topic.

pRECOGCHARS is a pointer to a RECOGCHARS structure. Where the function parameter type is pRECOGCHARS, declare a RECOGCHARS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pRECOGCHARS variable is necessary only if the program requires a pointer.

If the recognition process cannot associate the current recognized word with any language, then Lang is updated with LANG_ID_NO.

If the recognized word can be found in more than one language, then Lang will be updated with the ID of the first language in which the recognized word was found and Lang2 will be updated with the second language in which the word was found.

This structure is used with the following functions:

L_DocGetRecognizedCharacters

L_DocSetRecognizedCharacters

L_DocFreeRecognizedCharacters


RECOGMODULE

typedef enum
{
RECOGMODULE_AUTO = 0,
RECOGMODULE_MTEXT_OMNIFONT,
RECOGMODULE_MULTI_LINGUAL_OMNIFONT,
RECOGMODULE_DOT_MATRIX,
RECOGMODULE_OMR,
RECOGMODULE_HAND_PRINTED_NUMERAL,
RECOGMODULE_RER_PRINTED,
RECOGMODULE_BRAILLE,
RECOGMODULE_MATRIX,
RECOGMODULE_OMNIFONT_PLUS2W,
RECOGMODULE_OMNIFONT_FRX,
RECOGMODULE_OMNIFONT_PLUS3W,
} RECOGMODULE;

The RECOGMODULE enumerated type represents the possible types of recognition module associated with a zone.

Value | Meaning
RECOGMODULE_AUTO | Specifies that the engine will try to automatically select the most suitable recognition module for the zone. This is determined just before recognition, according to the zone's filling method and, if necessary, other settings, most typically the Character Set.
RECOGMODULE_MTEXT_OMNIFONT | Specifies the M/TEXT omnifont recognition module.
RECOGMODULE_MULTI_LINGUAL_OMNIFONT | Specifies the multi-lingual MOR omnifont recognition module.
RECOGMODULE_DOT_MATRIX | Specifies the DOT 9-pin draft dot-matrix recognition module.
RECOGMODULE_OMR | Specifies the OMR optical mark recognition module.
RECOGMODULE_HAND_PRINTED_NUMERAL | Specifies the HNR handprinted numeral recognition module.
RECOGMODULE_RER_PRINTED | Specifies the third-party RER reRecognition Handprint recognition module.
RECOGMODULE_MATRIX | Specifies the MAT matrix matching recognition module.
RECOGMODULE_OMNIFONT_PLUS2W | Specifies the two-way voting POWR++ omnifont recognition module. Note that this was the most accurate omnifont recognition module of the previous Capture SDK version, called RM_PLUS.
RECOGMODULE_OMNIFONT_FRX | Specifies the FireWorX omnifont recognition module.
RECOGMODULE_OMNIFONT_PLUS3W | Specifies the three-way voting omnifont recognition module. This is the most accurate, OmniPage 12 compatible omnifont recognition module.

Comments

This enumerated type is used by the following structure:

ZONEDATA


RECOGMODULE_TRADEOFF

typedef enum
{
RECGMD_ACCURATE,
RECGMD_BALANCED,
RECGMD_FAST,
} RECOGMODULE_TRADEOFF;

The RECOGMODULE_TRADEOFF enumerated type represents the options available for trading off accuracy and speed during recognition.

Value | Meaning
RECGMD_ACCURATE | Most accurate recognition (Default)
RECGMD_BALANCED | Mid-level accuracy/speed recognition
RECGMD_FAST | Fast recognition

Comments

This enumerated type is used by the following functions:

L_DocGetRecognizeModuleTradeOff

L_DocSetRecognizeModuleTradeOff


RECOGNIZEOPTS

typedef struct _tagRecognizeOpts
{
L_UINT uStructSize;
L_INT nPageIndexStart;
L_INT nPagesCount;
L_BOOL bEnableSubSystem;
L_BOOL bEnableCorrection;
LANGIDS SpellLangId;
L_TCHAR *pszFileName;
} RECOGNIZEOPTS, L_FAR *pRECOGNIZEOPTS;

The RECOGNIZEOPTS structure contains recognition options.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(RECOGNIZEOPTS).
nPageIndexStart | Specifies the index of the first page to recognize.
nPagesCount | Specifies the number of pages that will be recognized.
bEnableSubSystem | Enables or disables the checking subsystem. Possible values are:
 | Value | Meaning
 | TRUE | Enable the checking subsystem.
 | FALSE | Disable the checking subsystem.
bEnableCorrection | Enables or disables the Correction mode setting of the checking subsystem. Possible values are:
 | Value | Meaning
 | TRUE | Enable the correction mode of the checking subsystem.
 | FALSE | Disables the correction mode of the checking subsystem.
SpellLangId | Specifies the language the checking subsystem will use for spell-checking. For a list of possible values, refer to LANGIDS.
pszFileName | Character string that contains the name of the file in which to save the recognition data.

Comments

Always set the pszFileName member to a valid file name.

pRECOGNIZEOPTS is a pointer to a RECOGNIZEOPTS structure. Where the function parameter type is pRECOGNIZEOPTS, declare a RECOGNIZEOPTS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pRECOGNIZEOPTS variable is necessary only if the program requires a pointer.

This structure is used with the L_DocRecognize function.


RECOGWORDS

typedef struct _tagRecogWords
{
L_UINT uStructSize;
L_WCHAR szWord[MAX_WORD_SIZE];
RECT rcWordArea;
L_INT nZoneIndex;
} RECOGWORDS, * pRECOGWORDS;

The RECOGWORDS structure contains information about a recognized word.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(RECOGWORDS).
szWord | String that contains the recognized word.
rcWordArea | RECT structure that contains the area for the recognized word.
nZoneIndex | Index of the zone in the zone list, which contains the word.

Comments

pRECOGWORDS is a pointer to a RECOGWORDS structure. Where the function parameter type is pRECOGWORDS, declare a RECOGWORDS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pRECOGWORDS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocGetRecognizedWords

L_DocFreeRecognizedWords


RESULTOPTIONS

typedef struct _tagResultOptions
{
L_UINT uStructSize;
FORMAT_TYPE Format;
FORMATLEVEL FormatLevel;
DOCUMENTOPTIONS DocOptions;
PARAGRAPHOPTIONS ParagOptions;
CHARACTEROPTIONS CharOptions;
MARKOPTIONS MarkOptions;
} RESULTOPTIONS, L_FAR * pRESULTOPTIONS;

The RESULTOPTIONS structure contains result document properties for the final output document.

This structure contains the format type that will be used in saving the recognition results by calling L_DocSaveResultsToFile.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(RESULTOPTIONS).
Format | Specifies the output text format for the final output document. For a list of possible values, refer to FORMAT_TYPE.
FormatLevel | Specifies the level of format retention for the final output document. For a list of possible values, refer to FORMATLEVEL.
DocOptions | Structure that contains document options. For more information, refer to the DOCUMENTOPTIONS structure.
ParagOptions | Structure that contains paragraph options. For more information, refer to PARAGRAPHOPTIONS structure.
CharOptions | Structure that contains character options. For moreinformation, refer to CHARACTEROPTIONS structure.
MarkOptions | Structure that contains mark options. For more information, refer to MARKOPTIONS structure.

Comments

pRESULTOPTIONS is a pointer to a RESULTOPTIONS structure. Where the function parameter type is pRESULTOPTIONS, declare a RESULTOPTIONS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pRESULTOPTIONS variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetRecognitionResultOptions

L_DocGetRecognitionResultOptions


SELECTOR

typedef enum
{
SEL_NONE,
SEL_AUTO,
SEL_PREDEFINED
} SELECTOR;

The SELECTOR enumerated type indicates whether a value is exported or not and whether an exported value is calculated or predefined.

Value | Meaning
SEL_NONE | When this value is set for a formatting property, this property WON'T BE exported to the final output document, i.e. even if the final output document supports the particular property, it won't be sent to the document.
SEL_AUTO | When this value is set for a formatting property, this property will be calculated automatically by the Engine and will be exported to the final output document. This usually mirrors the properties of the original document.
SEL_PREDEFINED | When this value is set for a formatting property, this property will take a programmed value and be exported to the final output document.

Comments

This enumerated type is used by the following structures:

CHARACTEROPTIONS

DOCUMENTOPTIONS

PARAGRAPHOPTIONS


SPECIALCHAR

typedef struct _tagSpecialChar
{
L_UINT uStructSize;
L_WCHAR chReject;
L_WCHAR chMissSym;
} SPECIALCHAR, L_FAR * pSPECIALCHAR;

The SPECIALCHAR structure contains special characters for the selected language.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(SPECIALCHAR)
chReject | Specifies the rejection symbol that will be used in the recognition result.
chMissSym | Specifies the missing symbol that will be used in the recognition result.

Comments

pSPECIALCHAR is a pointer to a SPECIALCHAR structure. Where the function parameter type is pSPECIALCHAR, declare a SPECIALCHAR variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pSPECIALCHAR variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetSpecialChar

L_DocGetSpecialChar


STATUS

typedef struct _tagStatus
{
L_UINT uStructSize;
L_INT nRecogChrCount;
L_INT nRecogWordCount;
L_INT nRejectChrCount;
L_INT nRejectWordCount;
L_INT32 lRecogTime;
L_INT32 lReadingTime;
L_INT32 lPreprocTime;
L_INT32 lDecompTime;
} STATUS, L_FAR *pSTATUS;

The STATUS structure will be filled when calling L_DocGetStatus.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(STATUS).
nRecogChrCount | Number of recognized characters on the image
nRecogWordCount | Number of recognized words on the image
nRejectChrCount | Number of rejected characters on the image
nRejectWordCount | Number of words on the image corrected by the checking subsystem
lRecogTime | Engine time spent on recognition of the image content. This is the pure recognition time that the image spent in the different recognition modules involved in the recognition process of the image. Measured in 1/1000 of a second.
lReadingTime | Engine time spent on the image from the start of the recognition process. This includes the time lRecogTime defined above and further steps as follows: It also consists of the time necessary for sorting the output coming from the different recognition modules, the time spent with the checking subsystem, and the time required to produce the recognition result (e.g. the time necessary to write the recognition result into the recognition data file).
 | This field may also include the time needed for transferring the recognition result from the current image into the final output document – supposing that the statistical information was requested after converting to the final output document. Measured in 1/1000 of a second.
lPreprocTime | Engine time spent on image pre-processing. Measured in 1/1000 of a second.
lDecompTime | Engine time spent on the image’s page-layout decomposition, i.e. auto-zoning (the PID_DECOMPOSITION process). Measured in 1/1000 of a second.

Comments

The total processing time that a single image spends in the Engine until the recognition data or the final output document is produced can be calculated as follows:lTotal = lReadingTime + lPreprocTime + lDecompTime.

The accuracy of the Engine timing values provided in this structure depends on the resolution of the system timer, i.e. the timing resolution for Windows 95/98 is approximately 55 ms, for Windows NT, Windows 2000, or Windows XP it is 10 ms.

pSTATUS is a pointer to a STATUS structure. Where the function parameter type is pSTATUS, declare a STATUS variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pSTATUS variable is necessary only if the program requires a pointer.


TABLEMETHOD

typedef enum
{
TABLE_METHOD_USETABS,
TABLE_METHOD_USECELLS,
} TABLEMETHOD;

The TABLEMETHOD enumerated type represents how to export table zones.

Value | Meaning
TABLE_METHOD_USETABS | Export the recognized table zones by exporting TAB positions and TAB characters into the final output document (Default for FORMAT_LEVEL_DROP and FORMAT_LEVEL_PART).
TABLE_METHOD_USECELLS | Export the recognized table zones as table objects with a row-and-column cell structure into the final output document (Default for FORMAT_LEVEL_FULL).

Comments

This enumerated type is used by the following structure:

DOCUMENTOPTIONS


TEXTFORMATINFO

typedef struct _tagTextFormatInfo
{
L_UINT uStructSize;
L_CHAR L_FAR * pszName;
L_CHAR L_FAR * pszDLLName;
L_CHAR L_FAR * pszExtName;
FORMAT_OUTPUTTYPE Type;
} TEXTFORMATINFO, L_FAR * pTEXTFORMATINFO;

The TEXTFORMATINFO structure contains detailed information about a specific format.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(TEXTFORMATINFO).
pszName | Character string that contains the name of the output text format.
pszDLLName | Character string that contains the name of the output converter DLL file containing the Name converter.
pszExtName | Character string that contains the default extension for the final output document.
Type | Value that represents the type of document to output (e.g. plain text, word processor, spreadsheet). For a list of possible values, refer to FORMAT_OUTPUTTYPE.

Comments

pTEXTFORMATINFO is a pointer to a TEXTFORMATINFO structure. Where the function parameter type is pTEXTFORMATINFO, declare a TEXTFORMATINFO variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pTEXTFORMATINFO variable is necessary only if the program requires a pointer.

This structure is used with the L_DocGetTextFormatInfo function.


USERDICTIONARY

typedef struct _tagUserDictionary
{
L_UINT uStructSize;
L_TCHAR L_FAR * pszFileName;
L_CHAR L_FAR * pszDefSection;
} USERDICTIONARY, L_FAR * pUSERDICTIONARY;

The USERDICTIONARY structure contains user dictionary options.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(USERDICTIONARY).
pszFileName | Character string that contains the name of the user's dictionary file.
pszDefSection | Character string that contains the name of the default section in the user's dictionary. If it is NULL, the default section will be the first section of the dictionary, if one exists.

Comments

The functionality of the checking subsystem consists of the following three parts:

* | Spell checking (using all available languages),
* | User Dictionary-checking (using the User dictionary),
* | User-written checking (using user-written callback functions).

Once the checking subsystem has been enabled, it can be further configured to use any combination of these three possible checking options.

pUSERDICTIONARY is a pointer to a USERDICTIONARY structure. Where the function parameter type is pUSERDICTIONARY, declare a USERDICTIONARY variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pUSERDICTIONARY variable is necessary only if the program requires a pointer.

This structure is used with the following functions:

L_DocSetUserDictionary

L_DocGetUserDictionary


VERIFYCODE

typedef enum
{
VERIFY_IMPOSSIBLE = 0,
VERIFY_UNLIKELY,
VERIFY_UNRESOLVED,
VERIFY_POSSIBLE,
VERIFY_ACCEPT,
} VERIFYCODE;

The VERIFYCODE enumerated type represents the possible verification codes.

Value | Meaning
VERIFY_IMPOSSIBLE | The OCR engine has determined that the recognized string for the given zone cannot be possible.
VERIFY_UNLIKELY | The OCR engine has determined that the recognized string for the given zone is unlikely to be acceptable.
VERIFY_UNRESOLVED | The application's checking function cannot make a decision on the acceptability of the string for the zone.
VERIFY_POSSIBLE | The OCR engine has determined that the recognized string for the given zone is possibly acceptable.
VERIFY_ACCEPT | The OCR engine has determined that the recognized string for the given zone is certainly acceptable.

Comments

This enumerated type is used by the following function:

VERIFICATIONCALLBACK


WINDOWS Structures

HWND

HWND is a standard Windows data type. For further information concerning HWND, please refer to the Microsoft SDK documentation or your compiler's documentation.

HANDLE

HANDLE is a standard Windows structure. For further information concerning HANDLE, please refer to the Microsoft SDK documentation or your compiler's documentation.

HDC

HDC is a standard Windows structure. For further information concerning HDC, please refer to the Microsoft SDK documentation or your compiler's documentation.

RECT

RECT is a standard Windows structure. For further information concerning RECT, please refer to the Microsoft SDK documentation or your compiler's documentation.

PRECT

PRECT is a standard Windows structure. For further information concerning PRECT, please refer to the Microsoft SDK documentation or your compiler's documentation.

POINT

POINT is a standard Windows structure. For further information concerning POINT, please refer to the Microsoft SDK documentation or your compiler's documentation.

HFONT

HFONT is a standard Windows structure. For further information concerning HFONT, please refer to the Microsoft SDK documentation or your compiler's documentation.

LPCTSTR

LPCTSTR is a standard Windows structure. For further information concerning LPCTSTR, please refer to the Microsoft SDK documentation or your compiler's documentation.

HPEN

HPEN is a standard Windows structure. For further information concerning HPEN, please refer to the Microsoft SDK documentation or your compiler's documentation.


ZONEDATA

typedef struct _tagZoneData
{
L_UINT uStructSize;
RECT rcArea;
L_INT Id;
FILLMETHOD FillMethod;
RECOGMODULE RecogModule;
CHAR_FILTER CharFilter;
ZONETYPE Type;
L_UINT uFlags;
L_CHAR szSection[MAX_SECTION_NAME_LENGTH];
VERIFICATIONCALLBACK pfnCallback;
L_VOID L_FAR * pUserData;
} ZONEDATA, L_FAR * pZONEDATA;

The ZONEDATA structure contains all the necessary information for describing a zone. A zone is a rectangular area on an image containing a feature of interest to the user. The image data covered by each zone is handled and processed (typically recognized) separately.

Member | Description
uStructSize | Specifies the structure size. It should be equal to sizeof(ZONEDATA).
rcArea | Coordinates of the zone (RECT)
Id | Identifier of the zone, mainly managed by the engine
FillMethod | Zone filling method. For a list of possible values, refer to FILLMETHOD.
RecogModule | Recognition module associated with the zone. For a list of possible values, refer to RECOGMODULE.
CharFilter | Character Set filter for the zone. For a list of possible values, refer to CHAR_FILTER.
Type | Zone type. For a list of possible values, refer to ZONETYPE.
uFlags | Flags that control the checking process. Possible values are given below. These values can be combined using OR (|)
 | Value | Meaning
 | ZONE_CHK_LANGDICT_PROHIBIT | [0x00000001] Prohibit the use of the Language dictionary.
 | ZONE_CHK_USERDICT_PROHIBIT | [0x00000002] Prohibit the use of the User dictionary.
 | ZONE_CHK_CHECKCBF_PROHIBIT | [0x00000004] Prohibit the use of the user-written checking callback function.
 | ZONE_CHK_VERTDICT_PROHIBIT | [0x00000008] Prohibit the use of the Vertical dictionary
 | ZONE_CHK_IGNORE_WHITESPACE | [0x00000010] Ignore white space characters (SPACE and TAB characters) during checking. This field should be used together with the ZONE_CHK_PASS_LINES.
 | ZONE_CHK_IGNORE_CASE | [0x00000020] Case insensitive UD-checking
 | ZONE_CHK_PASS_LINES | [0x00000040] Instructs the RECOGMODULE to pass entire lines to the checker, instead of words. Do not use this attribute in conjunction with spell checking.
 | ZONE_CHK_CORRECTION_DISABLED | [0x00000080] Correction done by the Spell module is disabled even if it is enabled at page-level
 | ZONE_CHK_INCLUDE_PUNCTUATION | [0x00000100] Checking will consider punctuation characters on the boundaries of the strings, as well
 | ZONE_CHK_CORRECT_PROPERNAMES | [0x00000200] Enables the correction of words beginning with an uppercase letter inside a sentence (i.e. typically but not always proper names)
 | ZONE_CHK_LANGDICT_USED | [0x00010000] "After recognition flag": the Language dictionary was enabled during the checking process (spell checking was activated for the zone)
 | ZONE_CHK_USERDICT_USED | [0x00020000] "After recognition flag": the User dictionary was enabled during the checking process (UD-checking was activated for the zone).
 | ZONE_CHK_CHECKCBF_USED | [0x00040000] "After recognition flag": a user-written checking callback function was enabled during the checking process (user-written checking was activated)
szSection | Contains a null terminated string, such as the section name in the User dictionary assigned to the zone or an empty string
pfnCallback | Address of a user-written verification callback function (VERIFICATIONCALLBACK function) or NULL.
pUserData | More user data used in pUserData parameter of the VERIFICATIONCALLBACK function

Comments

Zones in an image are built into a sequential list, called the zone list. Each zone receives an internal index number, reflecting its position in this list. In some cases, this zone order even determines the zone content order in the final output document. The index of the first zone in the zone list is zero (0).

The zone type parameter type is used to classify the zone into one of the three basic zone categories: flow text, table or graphics. To set this, use ZONE_FLOWTEXT, ZONE_TABLE or ZONE_GRAPHIC, respectively.

Flow text:Any of the following text types can appear instead of ZONE_FLOWTEXT: ZONE_COLUMN, ZONE_HEADER, ZONE_FOOTER, ZONE_CAPTION, ZONE_TITLE, ZONE_OTHER. One of these values is typically created by the page-layout decomposition (auto-zoning) process, however they have the same meaning for the recognition algorithms: the zone contains flow text.

Table text:ZONE_TABLE is for table-type zones. With this, the engine will try to reconstruct the original table text layout of the zone in the final output document.

Graphics zones:For these, use the ZONE_GRAPHIC type. When specified, no recognition will run on the zone and all other recognition related settings would be ignored. The related ZONE_SGRAPHIC type can appear as the result of the page-layout decomposition (auto-zoning) process, and also signifies a graphic zone.

pZONEDATA is a pointer to a ZONEDATA structure. Where the function parameter type is pZONEDATA, declare a ZONEDATA variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pZONEDATA variable is necessary only if the program requires a pointer.


ZONETYPE

typedef enum
{
// Basic Zone type
ZONE_FLOWTEXT = 0,
ZONE_TABLE,
ZONE_GRAPHIC,
// Further types created by the page-layout decomposition process:
ZONE_COLUMN,
ZONE_HEADER,
ZONE_FOOTER,
ZONE_CAPTION,
ZONE_TITLE,
ZONE_OTHER,
ZONE_SGRAPHIC,
} ZONETYPE;

The ZONETYPE enumerated type represents the possible zone types.

Value | Meaning
ZONE_FLOWTEXT | flow text type zone.
ZONE_TABLE | table type zone
ZONE_GRAPHIC | zone containing graphics
ZONE_COLUMN | column type zone
ZONE_HEADER | header type zone
ZONE_FOOTER | footer type zone.
ZONE_CAPTION | caption type zone
ZONE_TITLE | title type zone
ZONE_OTHER | other zone type.
ZONE_SGRAPHIC | zone containing graphics (sure).
ZONE_HORZTEXT | horizontal text. Used in Asian OCR only
ZONE_VERTTEXT | vertical text. Used in Asian OCR only

Comments

This enumerated type is used by the following structure:

ZONEDATA


Return Codes

The following are the errors that are specifically related to the LEADTOOLS OCR document engine.

Error | No. | Description
ERROR_DOC_DLL_NOT_LOADED | -1200 | ScanSoft DLLs are not loaded
ERROR_DOC_INV_PAGE_INDEX | -1201 | Specified index is not correct
ERROR_DOC_INV_FILLMETHOD | -1202 | Invalid fill method
ERROR_DOC_INV_RECOG_MODULE | -1203 | Invalid recognition module
ERROR_DOC_INV_CHAR_FILTER | -1204 | Invalid character filter
ERROR_DOC_INV_ZONE_TYPE | -1205 | Invalid zone type
ERROR_DOC_INV_LANGID | -1206 | Invalid language Id
ERROR_DOC_INV_SPELL_LANGUAGE | -1207 | Invalid spell language
ERROR_DOC_INV_SECTION_ENUMERATION | -1208 | Invalid enumeration section
ERROR_DOC_INV_PAGE_COUNT | -1209 | Invalid page count
ERROR_DOC_ILLEGAL_CODE | -1210 | Illegal internal code as a parameter
ERROR_DOC_INV_PARAMETER | -1211 | Set parameter is not acceptable
ERROR_DOC_END_LIST_CODE_PAGES | -1212 | End of list of the available Code Pages
ERROR_DOC_LOAD_CODE_PAGE_FILE | -1213 | Error while loading the Code Page Definition file
ERROR_DOC_INV_BUFFER_SIZE | -1214 | The length of the exported code exceeds the buffer size
ERROR_DOC_INV_CHARACTER_CONVERSION | -1215 | Character conversion is not available for the given character
ERROR_DOC_INV_CHARACTER_LANGUAGE | -1216 | Conflict: The selected Code Page does not support some characters in the selected languages. There is no exact code in the Code Page for them
ERROR_DOC_INITIALIZE_CODE_PAGE | -1217 | Character Set and Code Pages module initialization error
ERROR_DOC_INITIALIZE_ENGINE | -1218 | OCR engine initialization error, or there is no appropriate license
ERROR_DOC_TERMINATE_ENGINE | -1219 | OCR engine termination error
ERROR_DOC_INITIALIZE_WARNING | -1220 | Module initialization warning
ERROR_DOC_PROCESS_USER_ABORT | -1221 | Application has aborted the current process
ERROR_DOC_FINISH_PROCESS | -1222 | Application has terminated the current recognition process without losing the recognized text
ERROR_DOC_MODULE_MISSING | -1223 | Module is not present
ERROR_DOC_MODULE_LOAD | -1224 | OS could not load a module
ERROR_DOC_MODULE_MISSING_ENTRY | -1225 | Missing entry in a module
ERROR_DOC_MODULE_INVALID | -1226 | Invalid module
ERROR_DOC_MODULE_INITIALIZE | -1227 | Module initialization error
ERROR_DOC_FEATURE_NOT_SUPPORTED | -1228 | The requested function is not available, or there is no appropriate license
ERROR_DOC_GENERAL | -1229 | General error in the engine
ERROR_DOC_GPF | -1230 | General Protection Fault in the engine
ERROR_DOC_NOT_SUPPORT_OS | -1231 | Unsupported operating system
ERROR_DOC_INV_SETTING_FILE | -1232 | Syntax error in the specified engine Settings file
ERROR_DOC_INV_SETTING | -1233 | Invalid setting
ERROR_DOC_ENGINE_BUSY | -1234 | The engine is busy
ERROR_DOC_RECOGNITION_TIME_OUT | -1235 | Recognition process Time Out
ERROR_DOC_INV_IMAGE_MODULE_SETTING | -1236 | Internal error in image module
ERROR_DOC_NO_MEMORY | -1237 | Not enough memory during image processing
ERROR_DOC_INV_IMAGE_DIMENSIONS | -1238 | Invalid rectangle dimensions
ERROR_DOC_INV_IMAGE_RESOLUTION | -1239 | Non-supported resolution
ERROR_DOC_CANNOT_COMPRESS_IMAGE | -1240 | Cannot process compressed image
ERROR_DOC_BAD_BITMAP | -1241 | Invalid bitmap address
ERROR_DOC_NOT_SUPPORT_BPP | -1242 | Unsupported BitsPerPixel value
ERROR_DOC_INV_IMAGE_MODULE | -1243 | Internal error in image module
ERROR_DOC_INV_IMAGE_HANDLE | -1244 | Invalid image handle
ERROR_DOC_BUFFER_OVERFLOW | -1245 | Buffer overflow during processing of the image
ERROR_DOC_ACCESS_DENIED | -1246 | Image operation denied
ERROR_DOC_NO_MORE_LINES | -1247 | No more lines in defined image area
ERROR_DOC_BAD_IMAGE_SIZE | -1248 | Non-supported image size
ERROR_DOC_BAD_ENGINE_MANAGER_MODULE | -1249 | Engine manager module error
ERROR_DOC_NO_RECOGNIZED_TEXT_AVAILABLE | -1250 | No recognized text available, either because the zone is empty or the required recognition module has not been initialized properly
ERROR_DOC_NO_SELECTED_RECOGNITION_MODULE | -1251 | There is no selected recognition module
ERROR_DOC_NO_ZONE | -1252 | There is no zone in the zone list
ERROR_DOC_INV_ZONE_INDEX | -1253 | Invalid zone index
ERROR_DOC_INV_ZONE_COORDINATES | -1254 | Invalid zone coordinates
ERROR_DOC_MOR_INITIALIZE_MODULE | -1255 | MOR recognition module initialization error
ERROR_DOC_MOR_BASE_FILE_NOT_FOUND | -1256 | MOR recognition module's knowledge base file not found
ERROR_DOC_MOR_BASE_FILE_CORRUPTED | -1257 | MOR recognition module's knowledge base file corrupted
ERROR_DOC_MOR_BASE_FILE_VERSION | -1258 | Incorrect knowledge base file version
ERROR_DOC_MOR_IMAGE_SIZE | -1259 | Size of image is too large
ERROR_DOC_MOR_FILE_CORRUPTED | -1260 | File is corrupted
ERROR_DOC_MOR_BAD_RECOG_MODULE | -1261 | Internal error in the MOR recognition module
ERROR_DOC_MOR_GPF_MODULE | -1262 | General Protection Fault in the MOR recognition module
ERROR_DOC_DOT_RECOGNITION | -1263 | Dot-matrix recognition error
ERROR_DOC_OMR_CHECKMARK_RECOGNITION | -1264 | Checkmark recognition error
ERROR_DOC_HNR_BASE_FILE__CORRUPTED | -1265 | HNR module's knowledge base file is corrupted
ERROR_DOC_HNR_PARAM_OUT_RANGE | -1266 | Parameter is out of valid range
ERROR_DOC_PER_MODULE | -1267 | Internal error in the RER module
ERROR_DOC_PER_BASE_FILE_NOT_FOUND | -1268 | RER module's knowledge base file not found
ERROR_DOC_PER_CHAR_SET_EMPTY | -1269 | Character Set is empty for the RER module
ERROR_DOC_PER_CHAR_SET_NOT_SUPPORTED | -1270 | The specified Character Set not fully supported by the RER recognition module
ERROR_DOC_PER_MODULE_NOT_FOUND | -1271 | RER specific file not found
ERROR_DOC_SPELL_NO_MEMORY | -1272 | Not enough memory for the SPL module
ERROR_DOC_SPELL_UNINITIALIZED | -1273 | Uninitialized spell object
ERROR_DOC_SPELL_FILE_OPEN | -1274 | Spell file open error
ERROR_DOC_SPELL_FILE_READ | -1275 | Spell file read error
ERROR_DOC_SPELL_USER_DICTIONARY_WRITE | -1276 | User dictionary write error
ERROR_DOC_SPELL_INV_FILE_FORMAT | -1277 | Invalid file format
ERROR_DOC_SPELL_INITIALIZE_MODULE | -1278 | Module initialization error
ERROR_DOC_SPELL_USER_DICTIONARY_CLOSE | -1279 | User dictionary close error
ERROR_DOC_SPELL_ILLEGAL_LANGUAGE_SETTING | -1280 | Illegal language setting
ERROR_DOC_SPELL_NO_MORE_ITEMS | -1281 | No more suggestions/items available
ERROR_DOC_SPELL_CHECK_ERROR | -1282 | Internal checking error
ERROR_DOC_SPELL_ITEM_ALREADY_EXIST | -1283 | Item already exists in the User dictionary
ERROR_DOC_SPELL_ITEM_NOT_EXIST | -1284 | Item doesn't exist in the User dictionary
ERROR_DOC_SPELL_ITEM_NOT_INSERTED | -1285 | Item wasn't inserted into the User dictionary
ERROR_DOC_SPELL_SECTION_NOT_EXIST | -1286 | Section does not exist in the User dictionary
ERROR_DOC_SPELL_BAD_SYNTEX | -1287 | Regular expression syntax error
ERROR_DOC_OUTPUT_NOT_INITIALIZED | -1288 | Output format conversion subsystem was not initialized
ERROR_DOC_OUTPUT_CONVERT_NOT_EXIST | -1289 | No more converters available
ERROR_DOC_OUTPUT_CONVERT_DLL_NOT_EXIST | -1290 | There is no converter DLL file
ERROR_DOC_OUTPUT_BAD_PARAMETER | -1291 | Wrong parameter or parameter not found
ERROR_DOC_OUTPUT_FILE_CORRUPTED | -1292 | TMP file is corrupted
ERROR_DOC_OUTPUT_FILE_NOT_FOUND | -1293 | TMP file not found
ERROR_DOC_OUTPUT_CREATE_FILE | -1294 | Cannot create TMP file
ERROR_DOC_OUTPUT_SEEK_FILE | -1295 | Cannot seek in TMP file
ERROR_DOC_OUTPUT_READ_FILE | -1296 | TMP file read error
ERROR_DOC_OUTPUT_WRITE_FILE | -1297 | TMP file write error
ERROR_DOC_OUTPUT_CLOSE_FILE | -1298 | Cannot close TMP file
ERROR_DOC_OUTPUT_LOAD_DLL | -1299 | Cannot load the DLL file
ERROR_DOC_OUTPUT_END_OF_FILE | -1300 | Internal error in ATMTXT module. (End-Of-File detected)
ERROR_DOC_OUTPUT_NO_MEMORY | -1301 | Not enough memory for ATMTXT/TMP module
ERROR_DOC_OUTPUT_IMAGE_NOT_AVAILABLE | -1302 | Image is not available for inserting into the output
ERROR_DOC_OUTPUT_NOT_REGISTER_INFO_ITEM | -1303 | Not enough memory to register an info item
ERROR_DOC_TXT_FILE_OPEN | -1304 | Output file open error
ERROR_DOC_TXT_FILE_READ | -1305 | Output file read error
ERROR_DOC_TXT_FILE_NOT_FOUND | -1306 | Output file not found
ERROR_DOC_TXT_FILE_WRITE | -1307 | Output file write error
ERROR_DOC_TXT_INV_COMMAND_SEQUENCE | -1308 | Invalid command sequence in the ICF file
ERROR_DOC_TXT_CREATE_FILE | -1309 | Cannot create the output file
ERROR_DOC_TXT_NO_MEMORY | -1310 | Not enough memory for ATMTXT/TXT module
ERROR_DOC_TXT_INV_DOCUMENT | -1311 | Invalid document type
ERROR_DOC_TXT_FILE_TOO_LARGE | -1312 | File too large
ERROR_DOC_TXT_WARNING_OUTPUT_FILE | -1313 | There was a WARNING during the output file conversion
ERROR_DOC_TXT_OPERATION_CANCELLED | -1314 | Operation cancelled
ERROR_DOC_TXT_ILLEGAL_OPTION | -1315 | Illegal option specified
ERROR_DOC_TXT_ENCRYPTED_SOURCE | -1316 | Encrypted source
ERROR_DOC_TXT_SEEK_ERROR | -1317 | Output file seek error
ERROR_DOC_BRAILLE_BAD_INITIALIZATION | -1318 | Braille recognition module initialization error
ERROR_DOC_MATRIX_BAD_INITIALIZATION | -1319 | Matrix matching recognition module initialization error
ERROR_DOC_MTX_BAD_INITIALIZATION | -1320 | M/TEXT recognition module initialization error
ERROR_DOC_NON_IMPLEMENTED_FEATURE | -1321 | Non-implemented feature
ERROR_DOC_NOT_FOUND_ZONE | -1322 | Couldn’t find specific zone
ERROR_DOC_NO_SELECTED_ZONE | -1323 | No available selected zone
ERROR_DOC_EXPORT_PAGE | -1324 | Can’t export the specified page
ERROR_DOC_LOCK_PAGE | -1325 | Can’t lock the specified page
ERROR_DOC_ACTIVE_PAGE | -1326 | Can’t set the specified page to be activated.
ERROR_DOC_LOCKED | -1327 | The OCR document engine is locked.
ERROR_DOC_OUTPUT_PDF_LOCKED | -1328 | Output PDF engine is locked.
ERROR_DOC_OMR_LOCKED | -1329 | OMR Options is locked
ERROR_DOC_ICR_LOCKED | -1330 | ICR Options is locked


Tutorials

Working with Pages

Working with Zones

Recognize Pages

Working with Recognition Results

Painting Pages and Zones


Working with Zones

Take the following steps to add code to the existing project that will let you recognize pages:

1. | Start with the program you created in Working with Pages.
2. | In Resource View tab, open the EZFUNC resources, and open MAIN_MENU1 menu to add the a new menu item as follows:
 | a. | Select an empty rectangle in the menu, and right click on that box and select Properties.
 | b. | Set the ID to IDM_FIND_ZONES and the Caption to Find Zones. Make sure Checked has been selected. Press Enter.
 | c. | Select another empty rectangle appears on the menu. Right click on that box and select Properties.
 | d. | Set the ID to IDM_ZONES_COUNT and the Caption to Zone Count. Make sure Checked has been selected. Press Enter.
 | e. | Select another empty rectangle appears on the menu. Right click on that box and select Properties.
 | f. | Set the ID to IDM_ADD_VERIFICATION_ZONE and the Caption to Add Verification Zone. Make sure Checked has been selected. Press Enter.
3. | Define the following global variables in EZFUNC.C in the EZOCRDOC directory:

L_INT nZoneCount;

4.

In the MainWndProc procedure, add the following code to the switch statement for WM_COMMAND:

case IDM_FIND_ZONES:
{
AUTOZONEOPTS ZoneOpts;
memset(&ZoneOpts, 0, sizeof(AUTOZONEOPTS));

ZoneOpts.uStructSize = sizeof(AUTOZONEOPTS);
ZoneOpts.bEnableForceSingleColumn = TRUE;
ZoneOpts.bVisibleGridLines = TRUE;

L_DocSetZoneOptions(hDoc, &ZoneOpts);
nRet = L_DocFindZones(hDoc, 0, NULL);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The automatic zone method found all available zones in the specified pages successfully."), TEXT("Notice!"), MB_OK);
else
{
wsprintf (achBuff, TEXT("Error %d in finding available zones in the specified page."), nRet);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);
}
}

break;
case IDM_ZONES_COUNT:
{
nRet = L_DocGetZoneCount(hDoc, 0, &nZoneCount);
if (nRet == SUCCESS)
{
wsprintf(achBuff, TEXT("Total Zones count = %d\n"), nZoneCount);
MessageBox(NULL, achBuff, TEXT("Zones Count"), MB_OK);
}
}
break;
case IDM_ADD_VERIFICATION_ZONE:
{
ZONEDATA Zone;
L_INT i;
for(i=0; i<nZoneCount; i++)
{
memset(&Zone, 0, sizeof(ZONEDATA));
nRet = L_DocGetZone(hDoc, 0, i, &Zone, sizeof(ZONEDATA));
if (nRet == SUCCESS)
{
if ((Zone.uFlags & ZONE_CHK_CHECKCBF_PROHIBIT) == ZONE_CHK_CHECKCBF_PROHIBIT)
Zone.uFlags &= ~ZONE_CHK_CHECKCBF_PROHIBIT;

Zone.pfnCallback = VerificationCB;
nRet = L_DocUpdateZone(hDoc, 0, i, &Zone);
if (nRet != SUCCESS)
{
wsprintf (achBuff, TEXT("Error %d in updating zone # %d"), nRet, i);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);
}
}
}
}
break;

5.

Add the following function in EZFUNC.C in the EZOCRDOC directory.

L_INT EXT_CALLBACK VerificationCB(L_INT nZoneIndex, L_TCHAR L_FAR * pszWord, VERIFYCODE * pVerify, L_VOID L_FAR * pUserData)
{
*pVerify = VERIFY_ACCEPT;
return SUCCESS;
}

6.

Also, add the following statement before the MainWndProc function.

L_INT EXT_CALLBACK VerificationCB(L_INT nZoneIndex, L_TCHAR L_FAR * pszWord, VERIFYCODE * pVerify, L_VOID L_FAR * pUserData);

7. | Build Ezfunc32.exe.
8. | Run Ezfunc32.exe.


Working with Pages

Take the following steps to create and run a program that shows how to add pages to an OCR document. Remember that the purpose of the tutorials is to provide you with a quick and easy way to generate an OCR program.

1. | Create a new directory in the LTWINxxx\EXAMPLES\DLL directory called EZOCRDOC.
2. | Copy everything in the EZFUNC directory into the EZOCRDOC directory.
3. | Compile the project as it is and run EZFUNC32.exe to familiarize yourself with the basic program. You can run the exe file from the MS-DOS prompt, or set the image file to add through the Build->Settings->Debug->Program Arguments menu.
4. | On the Insert menu, select Files into Project. Add the Ltdoc_n.lib file to the project from the LTWINxxx\LIB directory.
5. | Define the following global variables in EZFUNC.C in the EZOCRDOC directory:

L_HDOC hDoc; /* OCR Document handle */
PAGEINFO PageInfo;
LANGIDS LangId[1];

6.

Add the following include statement after the include statements in EZFUNC.C in the EZOCRDOC directory:

#include "..\\..\\..\\include\\ltdoc.h" /* LEADTOOLS main OCR document header file */

7. | Add the following statements in the WinMain function as follows:
 | a. | Add the following before calling InitInstance() statement

/* Note that this is a sample key, which will not work in your toolkit. You should replace the sample key */
L_UnlockSupport (L_SUPPORT_OCR, TEXT("TestKey"));
if (L_DocStartUp(&hDoc) != SUCCESS)
return 0;

b.

Add the following after the GetMessage() loop

L_DocShutDown(&hDoc);

8. | Add a menu resource to the project. If you are familiar with this process, you can skip to the next step.
 | a. | From the Insert menu, select Resource. Highlight Menu and click on NEW.
 | b. | The IDR_MENU will appear. Right click on IDR_MENU, select Properties and change the name to MAIN_MENU1.
 | c. | Right click on the menu entry (the outlined rectangle), and select Properties.
 | d. | In the Caption box enter User Mode. Make sure Pop-up is not selected and press Enter.
 | e. | Set the ID to IDM_FLIP_PAGE and the Caption to Flip Page. Make sure Checked has been selected. Press Enter. Save the resource.
9. | Add the following include statement with the include statements in EZFUNC.C in the EZOCRDOC directory:

#include "resource.h"

10.

In InitApplication, change the line:

wcWindowClass.lpszMenuName = NULL;

to:

wcWindowClass.lpszMenuName = TEXT("MAIN_MENU1");

11. | In InitInstance, change the menu parameter in CreateWindow from NULL to LoadMenu(hInstance, MAKEINTRESOURCE(MAIN_MENU1)).
12. | Under WM_CREATE in EZFUNC.C, add the following code after "L_LoadBitmap()" :

nRet = L_DocAddPage(hDoc, &LeadBitmap, 0);
if (nRet != SUCCESS)
{
wsprintf (achBuff, "Error %d adding page at index 0", nRet);
MessageBox (NULL, achBuff, "Error", MB_OK);
/* We have an error, so post WM_DESTROY */
PostMessage (hWnd, WM_DESTROY, 0, 0);
return (FALSE);
}

memset(&PageInfo, 0, sizeof(PAGEINFO));
nRet = L_DocGetPageInfo (hDoc, 0, &PageInfo, sizeof(PAGEINFO));
if (nRet == SUCCESS)
{
wsprintf (achBuff, TEXT("Page Width = %d\nPage Height = %d\nPage Bits Per Pixel = %d\n"),
PageInfo.nWidth,
PageInfo.nHeight,
PageInfo.nBitsPerPixel);

MessageBox (NULL, achBuff, TEXT("Pages Info"), MB_OK);
}

LangId[0] = LANG_ID_ENGLISH;
nRet = L_DocSelectLanguages(hDoc, LangId, 1);
if (nRet != SUCCESS)
{
wsprintf (achBuff, TEXT("Error %d Setting English as the default language."), nRet);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);

RemoveDocumentPages();
/* We have an error, so post WM_DESTROY */
PostMessage (hWnd, WM_DESTROY, 0, 0);
return (FALSE);
}

13.

Under WM_CREATE in EZFUNC.C, remove the following block:

/* Get the current window size and client area */
GetWindowRect(hWnd, &rWndSize);
GetClientRect(hWnd,&rClientSize);
/* Use this function to fit the displayed image in the client area. */
CalcDisplay ( rClientSize.right, /* Width allowed */
rClientSize.bottom, /* Height allowed */
BITMAPWIDTH(&LeadBitmap), /* Width factor, for aspect ratio */
BITMAPHEIGHT(&LeadBitmap), /* Height factor, for aspect ratio */
NULL, /* Resulting left value, not used */
NULL, /* Resulting top value, not used */
&DisplayWidth, /* Resulting width value */
&DisplayHeight); /* Resulting height value */
/* Adjust the window size to remove blank space at the right or bottom */
AdjustedWidth = rWndSize.right - rWndSize.left + DisplayWidth - rClientSize.right;
AdjustedHeight = rWndSize.bottom - rWndSize.top + DisplayHeight - rClientSize.bottom;
MoveWindow(hWnd, rWndSize.left, rWndSize.top, AdjustedWidth, AdjustedHeight, FALSE);
/* Get the client area of the adjusted window */
GetClientRect(hWnd,&rClientSize);
/* Make the destination rectangle for painting the same as the client area */
rLeadDest = rClientSize;
/* Set the source rectangle to use the whole bitmap */
SetRect(&rLeadSource, 0, 0, LeadBitmap.Width, LeadBitmap.Height);
/* Force paint palette creation */
SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L);

14. | Replace WM_PAINT in EZFUNC.C as follows:
 | a. | Remove the following block:

case WM_PAINT:
/* Get the handle to the device context */
hdc = BeginPaint (hWnd, &ps);
if (LeadBitmap.Flags.Allocated) /* Do we have an image? */
{
if (hpalPaint) /* If we have a paint palette, select it */
{
hPalette = SelectPalette (hdc, hpalPaint, TRUE);
/* Uncomment this if you do not process WM_QUERYNEWPALETTE */
/* RealizePalette (hdc); */
}
/* Paint the image */
L_PaintDC (hdc,
&LeadBitmap,
&rLeadSource, /* Source rectangle */
NULL, /* Default source clip area */
&rLeadDest, /* Destination rectangle */
&ps.rcPaint, /* Dest clip set by WM_PAINT */
SRCCOPY); /* Normal Paint */
if (hpalPaint) /* Return old palette */
SelectPalette (hdc, hPalette, TRUE);
}
EndPaint (hWnd, &ps); /* Return DC */
return (0);

b.

Add the following block:

case WM_PAINT:
return 0;

15.

Add the following function in EZFUNC.C in EZOCR directory

void RemoveDocumentPages()
{
L_INT nPageCount = 0;
L_INT i, nRet;
L_TCHAR szBuffer[1024];

nRet = L_DocGetPageCount(hDoc, &nPageCount);
if (nRet == SUCCESS)
{
for (i=0; i<nPageCount; i++)
{
nRet = L_DocRemovePage(hDoc, i);
if (nRet == SUCCESS)
{
wsprintf(szBuffer, TEXT("The page # %d was removed successfully"), i);
MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
}
}
}
}

16.

Also, add the following statement before the MainWndProc function

void RemoveDocumentPages();

17.

In the MainWndProc procedure, add the following code to the switch statement:

case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDM_FLIP_PAGE:
{
BITMAPHANDLE Bitmap;

L_InitBitmap (&Bitmap, sizeof(BITMAPHANDLE), 0, 0, 0);
nRet = L_DocExportPage(hDoc, &Bitmap, sizeof(BITMAPHANDLE), 0);
{
L_FlipBitmap (&Bitmap);
L_DocLockPage(hDoc, 0);
nRet = L_DocUpdatePage(hDoc, &Bitmap, 0);
if (nRet == SUCCESS)
{
wsprintf (achBuff, TEXT("The specified page was updated successfully."));
MessageBox (NULL, achBuff, TEXT("Notice!"), MB_OK);
}
else
{
wsprintf (achBuff, TEXT("Error %d in updating the page bitmap for page # 0"), nRet);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);
}

L_DocUnlockPage(hDoc, 0);
L_DocSetActivePage(hDoc, 0);

L_FreeBitmap (&Bitmap);
}
}
break;
}

return 0;

18. | On the Build menu, select Build Ezfunc32.exe.
19. | On the Build menu, select Execute Ezfunc32.exe.
20. | Save this project to use for testing other code samples.


Painting Pages and Zones

Take the following steps to add code to the existing project that will let you recognize pages:

1. | Start with the program you created in Working with Pages.
2. | Define the following global variables in EZFUNC.C in the EZOCRDOC directory:

L_BOOL bDrawZones;
L_BOOL bDrawPage;

3. | In Resource View tab, open the EZFUNC resources, and open MAIN_MENU1 menu to add the a new menu item as follows:
 | a. | Select an empty rectangle in the menu, and right click on that box and select Properties.
 | b. | Set the ID to IDM_DRAW_ZONES and the Caption to Enable Draw Zones. Make sure Checked has been selected. Press Enter.
4. | In the MainWndProc procedure, add the following code to the switch statement for WM_COMMAND:

bDrawZones = !bDrawZones;
break;

5.

Under WM_CREATE in EZFUNC.C, add the following line after "L_DocAddPage()" :

bDrawPage = FALSE;
L_DocSetActivePage(hDoc, 0);
bDrawPage = TRUE;

/* Get the client area of the adjusted window */
GetClientRect(hWnd,&rClientSize);
/* Make the destination rectangle for painting the same as the client area */
rLeadDest = rClientSize;

6.

In the MainWndProc procedure, add the following code to the WM_PAINT before WM_DESTROY and after WM_SYSCOLORCHANGE:

case WM_PAINT:
hdc = BeginPaint (hWnd, &ps);

if (bDrawPage)
{
if (hpalPaint) /* If we have a paint palette, select it */
{
hPalette = SelectPalette (hdc, hpalPaint, TRUE);
/* Uncomment this if you do not process WM_QUERYNEWPALETTE */
/* RealizePalette (hdc); */
}

L_DocDrawPage(hDoc, hdc, 0, NULL, NULL, &rLeadDest, &ps.rcPaint, SRCCOPY, bDrawZones);
if (hpalPaint) /* Return old palette */
SelectPalette (hdc, hPalette, TRUE);
}

EndPaint (hWnd, &ps); /* Return DC */
return 0;

7. | Build Ezfunc32.exe.
8. | Run Ezfunc32.exe.


Working with Recognition Results

Take the following steps to add code to the existing project that will let you recognize pages:

1. | Start with the program you created in Recognize Pages.
2. | In Resource View tab, open the EZFUNC resources, and open MAIN_MENU1 menu to add the a new menu item as follows:
 | a. | Select an empty rectangle in the menu, and right click on that box and select Properties.
 | b. | Set the ID to IDM_GET_OUTPUTFORMAT and the Caption to Get Output Formats. Make sure Checked has been selected. Press Enter.
 | c. | Another rectangle appears on the menu. Right click on that box and select Properties.
 | d. | Set the ID to IDM_SAVE_RESULTS and the Caption to Save Results. Make sure Checked has been selected. Press Enter.
3. | In the MainWndProc procedure, add the following code to the switch statement for WM_COMMAND:

case IDM_GET_OUTPUTFORMAT:
{
nRet = L_DocEnumOutputFileFormats(hDoc, EnumOutputFileFormatsCB, NULL);
if (nRet != SUCCESS)
{
wsprintf (achBuff, TEXT("Error %d enumerating available file formats"), nRet);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);
}
}
break;
case IDM_SAVE_RESULTS:
{
RESULTOPTIONS ResOpts;

memset(&ResOpts, 0, sizeof(RESULTOPTIONS));
nRet = L_DocGetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS));
if (nRet == SUCCESS)
{
ResOpts.FormatLevel = FORMAT_LEVEL_FULL;
ResOpts.DocOptions.PaperSize = SEL_PREDEFINED;
ResOpts.DocOptions.PaperType = PAPER_TYPE_A4;

L_DocSetRecognitionResultOptions(hDoc, &ResOpts);
nRet = L_DocSaveResultsToFile (hDoc, TEXT("c:\\test.doc"));
if (nRet != SUCCESS)
{
wsprintf (achBuff, TEXT("Error %d in saving recognition results to a file"), nRet);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);
}
}
}
break;

4.

Add the following function in EZFUNC.C in EZOCRDOC directory.

L_INT EXT_FUNCTION EnumOutputFileFormatsCB(FORMAT_TYPE Format, L_VOID L_FAR * pUserData)
{
TEXTFORMATINFO FormatInfo;
L_INT nRet;
L_TCHAR szBuffer[1024];

memset(&FormatInfo, 0, sizeof(TEXTFORMATINFO));
nRet = L_DocGetTextFormatInfo(hDoc, Format, &FormatInfo, sizeof(TEXTFORMATINFO));
if (nRet == SUCCESS)
{
wsprintf(szBuffer, TEXT("Format Name = %s\nFormat DLL Name = %s\nFormat Ext Name = %s\n"),
FormatInfo.pszName,
FormatInfo.pszDLLName,
FormatInfo.pszExtName);

MessageBox(NULL, szBuffer, TEXT("Format Info"), MB_OK);

switch (FormatInfo.Type)
{
case OUT_TYPE_PLAIN:
wsprintf(szBuffer, TEXT("Format Type = Plain"));
break;
case OUT_TYPE_WORD_PROCESSOR:
wsprintf(szBuffer, TEXT("Format Type = Word Processor"));
break;
case OUT_TYPE_TRUE_WORD_PROCESSOR:
wsprintf(szBuffer, TEXT("Format Type = True Word Processor"));
break;
case OUT_TYPE_TABLE:
wsprintf(szBuffer, TEXT("Format Type = Table"));
break;
case OUT_TYPE_UNKNOWN:
wsprintf(szBuffer, TEXT("Format Type = Unknown"));
break;
}

MessageBox(NULL, szBuffer, TEXT("Format Type"), MB_OK);
}

return SUCCESS;
}

5.

Also, add the following statement before the MainWndProc function

L_INT EXT_FUNCTION EnumOutputFileFormatsCB(FORMAT_TYPE Format, L_VOID L_FAR * pUserData);

6. | Build Ezfunc32.exe.
7. | Run Ezfunc32.exe.


Recognize Pages

Take the following steps to add code to the existing project that will let you recognize pages:

1. | Start with the program you created in Working with Zones.
2. | In Resource View tab, open the EZFUNC resources, and open MAIN_MENU1 menu to add the a new menu item as follows:
 | a. | Select an empty rectangle in the menu, and right click on that box and select Properties.
 | b. | Set the ID to IDM_RECOGNIZE and the Caption to Recognize Page. Make sure Checked has been selected. Press Enter.
 | c. | Another rectangle appears on the menu. Right click on that box and select Properties.
 | d. | Set the ID to IDM_GET_STATUS and the Caption to Engine Status. Make sure Checked has been selected. Press Enter.
3. | In the MainWndProc procedure, add the following code to the switch statement for WM_COMMAND:

case IDM_RECOGNIZE:
{
RECOGNIZEOPTS RecogOpts;
memset(&RecogOpts, 0, sizeof(RECOGNIZEOPTS));

RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = 0;
RecogOpts.nPagesCount = 1;
RecogOpts.SpellLangId = LANG_ID_ENGLISH;
RecogOpts.bEnableSubSystem = TRUE;
RecogOpts.bEnableCorrection = TRUE;
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");
nRet = L_DocRecognize(hDoc, &RecogOpts, RecognizeStatusCB, NULL);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The engine finished recognizing the specified pages successfully."), TEXT("Notice"), MB_OK);
else
{
wsprintf (achBuff, TEXT("Error %d in recognized pages"), nRet);
MessageBox (NULL, achBuff, TEXT("Error"), MB_OK);
}
}
break;
case IDM_GET_STATUS:
{
STATUS Status;
memset(&Status, 0, sizeof(STATUS));

nRet = L_DocGetStatus(hDoc, &Status, sizeof(STATUS));
if (nRet == SUCCESS)
{
wsprintf(achBuff, TEXT("Recognition Time = %d\nTotal Recognized Characters = %d\nTotal Recognized Words = %d\nTotal Rejected Characters = %d\nTotal Rejected Words = %d\n"),
Status.lRecogTime,
Status.nRecogChrCount,
Status.nRecogWordCount,
Status.nRejectChrCount,
Status.nRejectWordCount);
MessageBox(NULL, achBuff, TEXT("Status..."), MB_OK);
}
}
break;

4.

Add the following function in EZFUNC.C in EZOCRDOC directory.

L_INT EXT_CALLBACK RecognizeStatusCB(L_INT nRecogPage, L_INT nError, L_VOID L_FAR * pUserData)
{
L_TCHAR szBuffer[1024];

wsprintf(szBuffer, TEXT("Page # %d has finished recognition.\nThe recognition return code = %d\n"), nRecogPage, nError);
MessageBox(NULL, szBuffer, TEXT("Recognition Status"), MB_OK);
return SUCCESS; // continue to recognize next page
}

5.

Also, add the following statement before the MainWndProc function

L_INT EXT_CALLBACK RecognizeStatusCB(L_INT nRecogPage, L_INT nError, L_VOID L_FAR * pUserData);

6. | Build Ezfunc32.exe.
7. | Run Ezfunc32.exe.


L_DocAddItemToUserDictionary

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocAddItemToUserDictionary(hDoc, pSection, pUDitem, uMask)

L_HDOC hDoc; | /* handle to the OCR document */
L_CHAR L_FAR * pSection; | /* section name */
L_WCHAR * pUDitem; | /* UNICODE string, containing the section item to be added */
L_UINT32 uMask; | /* mask */

Adds a new section item to the specified section in the user dictionary.

Parameter | Description
hDoc | Handle to the OCR document.
pSection | Name of the section where the word should be added. If the specified section does not exist, a new section will be created automatically.
pUDitem | Pointer to a UNICODE string containing the item to be added.
uMask | Attribute for the pUDitem to be added. Valid values are:
 | Value | Meaning
 | USER_DICT_LITERAL | [0x0000] Used literal
 | USER_DICT_REGULAR_EXPRESSION | [0x0001] used regular expression

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

L_DocAddItemToUserDictionary can be used to add a new User dictionary item, that is a literal or a regular expression, to the User dictionary currently opened.

The item will be added to the section of the User dictionary specified by pSection.

User dictionary items are UNICODE strings and they must be no longer than MAX_UD_ITEM_LENGTH characters (including the terminating zero). They may contain spaces and punctuation characters.

When adding a new user dictionary item its uMask also has to be specified. An item can be added either as a literal or as a regular expression. User dictionary items having the regular expression attribute will be evaluated for conformance during the checking of the recognized result.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetUserDictionary, L_DocGetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySection, L_DocGetUserDictionarySectionItem, L_DocRemoveItemFromUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

For an example, refer to L_DocSetUserDictionary.


L_DocAddPage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocAddPage(hDoc, pBitmap, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
pBITMAPHANDLE pBitmap; | /* pointer to the bitmap handle */
L_INT nPageIndex; | /* position at which to insert the page */

Adds a new page to the OCR document.

Parameter | Description
hDoc | Handle to the OCR document.
pBitmap | Pointer to the bitmap handle that references the new page to insert into the internal OCR list of pages.
nPageIndex | Position in the list of pages at which to insert the new page. Use -1 to append the page to the end of the list.
 | Use zero-based indexing. For Example, if there are 10 pages in the list, the index of the last page is 9. If you insert a page within the list, the indices of other pages will change automatically to accommodate the insertion.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The function converts the inserted page(s) to be matched with the OCR requirements.

In addition, this function checks the color order for each loaded bitmap. If any bitmap color order is inversed (i.e. white to black) then the function will convert the color order to be normal (i.e. black to white).

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetPageCount, L_DocUpdatePage, L_DocRemovePage, L_DocExportPage, L_DocGetPageInfo
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestAddPages(L_HDOC hDoc, L_TCHAR * pszFileName)
{
BITMAPHANDLE Bitmap;
L_INT nPageCount = 0;
L_TCHAR szBuffer[100];

memset(szBuffer, 0, sizeof(szBuffer));

L_InitBitmap (&Bitmap, sizeof(BITMAPHANDLE), 0, 0, 0);
L_INT nRet = L_LoadBitmap (pszFileName, &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL);
if (nRet != SUCCESS)
return;

nRet = L_DocAddPage(hDoc, &Bitmap, -1);
if (nRet != SUCCESS)
{
MessageBox(NULL, TEXT("The engine can't add the specified bitmap."), TEXT("Notice!"), MB_OK);
return;
}

nRet = L_DocGetPageCount (hDoc, &nPageCount);
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("An error occurred during L_DocGetPageCount "), TEXT("Error!"), MB_OK);
else
{
wsprintf(szBuffer, TEXT("Total pages in the OCR document = %d\n"), nPageCount);
MessageBox(NULL, szBuffer, TEXT("Page Count!"), MB_OK);
}
}


L_DocAddZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocAddZone(hDoc, nPageIndex, nZoneIndex, pZoneData)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_INT nZoneIndex; | /* index of the zone to be added */
pZONEDATA pZoneData; | /* pointer to a ZONEDATA structure */

Adds new zone in the zone list of the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Index of the page on which to add the zone. This is a zero-based index.
nZoneIndex | Position in the list of zones at which to add new zone. Use -1 to append the page to the end of the list. This is a zero-based index.
pZoneData | Pointer to a ZONEDATA structure which contains the zone data to be added.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Adds a new zone in the zone list of the specified page. After the zone is added, the zone list is recalculated automatically.

When adding a zone, the application should directly initialize the following members of the ZONEDATA structure, since these members will not take their default values:

uStructSize
rcArea
FillMethod
CharFilter
Type
RecogModule

The OCR engine manages the ID member of the ZONEDATA structure.

The Type member of the ZONEDATA structure should be one of the following values:

ZONE_FLOWTEXT

ZONE_TABLE

ZONE_GRAPHIC

For successful zone addition, the whole zone area must lie within the page area and the top left coordinates of the zone must have lower values than those of the bottom right ones.

To find all zones in a specific page, use L_DocFindZones.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

L_INT EXT_CALLBACK VerificationCB(L_INT nZoneIndex, L_TCHAR L_FAR * pszWord, VERIFYCODE * pVerify,L_VOID L_FAR * pUserData)
{
//...
//... Set your code here
//...
return SUCCESS;
}

void TestAddZones(L_HDOC hDoc, L_INT nPageIndex)
{
ZONEDATA ZoneData;
L_INT nZoneCount = 0;
L_TCHAR szBuffer[100];

memset(szBuffer, 0, sizeof(szBuffer));
memset(&ZoneData, 0, sizeof(ZONEDATA));

ZoneData.uStructSize = sizeof(ZONEDATA);
ZoneData.rcArea.left = 100;
ZoneData.rcArea.top = 100;
ZoneData.rcArea.right = 200;
ZoneData.rcArea.bottom = 200;
ZoneData.FillMethod = FILL_DEFAULT;
ZoneData.RecogModule = RECOGMODULE_AUTO;
ZoneData.CharFilter = ZONE_CHAR_FILTER_DEFAULT;
ZoneData.Type = ZONE_FLOWTEXT;
ZoneData.uFlags = 0;
ZoneData.pfnCallback = VerificationCB;
ZoneData.pUserData = NULL;

L_INT nRet = L_DocAddZone(hDoc, nPageIndex, 0, &ZoneData);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The specified zone is added."), TEXT("Notice!"), MB_OK);

nRet = L_DocGetZoneCount (hDoc, nPageIndex, &nZoneCount);
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("An error occurred during L_DocGetZoneCount"), TEXT("Error!"), MB_OK);
else
{
wsprintf(szBuffer, TEXT("Total zones in the specified page = %d\n"), nZoneCount);
MessageBox(NULL, szBuffer, TEXT("Zone Count!"), MB_OK);
}
}


L_DocAutoOrientPage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocAutoOrientPage(hDoc, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */

Auto orients the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Index of the page to auto orient. This is a zero-based index.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function automatically orients (rotates) the specified page to be readable and updates the image data.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddPage, L_DocGetPageCount, L_DocRemovePage, L_DocExportPage, L_DocUpdatePage, L_DocGetPageInfo
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestOrientPage(L_HDOC hDoc, L_INT nPageIndex)
{
L_INT nRet = L_DocAutoOrientPage(hDoc, nPageIndex);
if (nRet != SUCCESS)
AfxMessageBox(TEXT("Failure while auto orienting the current page"));
}


L_DocDetectOrientationDegree

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocDetectOrientationDegree (hDoc, nPageIndex, * pnRotate)

L_HDOC hDoc; | /* handle to the OCR document.*/
L_INT nPageIndex; | /* page index */
L_INT * pnRotate; | /* pointer to a variable */

Determines the angle by which the specified page needs to be oriented.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page for which to get the orientation angle. This index is zero-based.
pnRotate | Pointer to a variable to be updated with the orientation angle, in degrees. Possible values are: +90, +180, and +270. The rotation is clockwise.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The purpose of orientation is to make the page more readable during recognition by making sure the top of the page is positioned properly. That is, a page that is oriented correctly like this:

is much more readable than the same page oriented like this:

Please note that this function just provides the angle of orientation that is needed. It does not actually orient the page. To orient the page, call L_DocAutoOrientPage.

If the specified page does not need to be oriented the pnRotate parameter is updated with 0.

To automatically orient a page, call L_DocAutoOrientPage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | Working with Pages
 | OCR Functions: Pages

Example

void TestOrientPage(L_HDOC hDoc, L_INT nPageIndex)
{
L_INT nRotate=0;
L_INT nRet = L_DocDetectOrientationDegree(hDoc, nPageIndex, &nRotate);

if (nRet == SUCCESS)
{
L_TCHAR szBuffer[1024];

wsprintf(szBuffer, TEXT("Orientation degree = %d"), nRotate);
AfxMessageBox(szBuffer);
}
}


L_DocDrawPage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocDrawPage(hDoc, hDC, nPageIndex, pSrc, pClipSrc, pDst, pClipDst, uROP3, bShowZones)

L_HDOC hDoc; | /* handle to the OCR document */
HDC hDC; | /* handle to the target device context */
L_INT nPageIndex; | /* page index */
LPRECT pSrc; | /* pointer to the display source rectangle */
LPRECT pClipSrc; | /* pointer to the display source clipping rectangle */
LPRECT pDst; | /* pointer to the display destination rectangle */
LPRECT pClipDst; | /* pointer to the display destination clipping rectangle */
L_UINT32 uROP3; | /* windows ROP code for display */
L_BOOL bShowZones; | /* flag to draw page zones or not */

Displays the specified page with(out) its zones, at any size, to any device context (screen, printer, or memory DC). If the display surface has fewer colors than the image, this function dithers the output to that display surface without affecting the actual image data.

Parameter | Description
hDoc | handle to the OCR document.
hDC | Handle to a device context, such as a screen, to use as the display surface. The mapping mode of the device context must be MM_TEXT.
nPageIndex | Specifies the index of the page that will be drawn. This index is zero-based.
pSrc | Pointer to the Windows RECT structure that specifies the part of the bitmap to use as the display source.
 | The coordinates in the RECT structure are relative to the bitmap. You can pass NULL to use the default, which matches the bitmap.
pClipSrc | Pointer to the Windows RECT structure that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source bitmap has changed.
 | The coordinates in the RECT structure are relative to the bitmap. You can pass NULL to use the default, which matches the bitmap.
pDst | Pointer to the Windows RECT structure that determines how the source rectangle is scaled and how the image is positioned in the device context.
 | The coordinates in the RECT structure are relative to the device context. There is no default for this parameter. You must specify the RECT structure.
pClipDst | Pointer to the Windows RECT structure that specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up.
 | The coordinates in the RECT structure are relative to the device context. You can pass NULL to use the default, which matches the device context. In most cases, however, you should use the rectangle returned by the Windows WM_PAINT message.
uROP3 | The Windows ROP code that determines how the destination rectangle is updated. This parameter takes the same codes as the Windows BitBlt function. For ordinary painting, use SRCCOPY.
bShowZones | Specifies if the page zones will be drawn or not. Valid values are:
 | Value | Meaning
 | TRUE | draw the page zones
 | FALSE | don’t draw the page zones.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Before calling this function, you must specify the active page that will be drawn.

If L_DocSetActivePage is not called, then this function will return an error, ERROR_DOC_ACTIVE_PAGE.

This function lets you specify a source rectangle (with coordinates relative to the bitmap) and a destination rectangle (with coordinates relative to the device context). Scaling of the displayed image depends on the relationship between these two rectangles, as shown in the following illustration.

Note:

These illustrations are for a bitmap with a TOP_LEFT view perspective. For an explanation of bitmap coordinates and view perspectives, refer to Accounting for View Perspective , in the Main API help file. If the bitmap is not in TOP_LEFT view perspective, refer to Changing Bitmap Coordinates in the Main API help file.

In addition, you can specify a clipping area within either rectangle to limit the area to be painted. For the destination rectangle, a clipping area is commonly specified to repaint part of the image that was temporarily covered up. For a source rectangle, you can use a clipping area to update the display when only part of the image in the source rectangle has changed.

The following illustration shows how specifying a source clipping area affects the display. Text has been added to the source bitmap (using the bitmap as a display surface), and the source clipping area specifies the area to be repainted.

You can specify the various rectangles in any way that meets your needs. Coordinates can have negative values and they can extend beyond the bounds of the bitmap or the device context. In fact, it is common for the display rectangle to be bigger than the device context, where scroll bars are used to see different parts of the image.

In simple cases, you can use this function as follows:

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

void TestDrawing(L_HDOC hDoc, HWND hWnd)
{
HDC hdc = NULL;
HPEN hSelectedPen = NULL;
HPEN hOldSelectedPen = NULL;
HPEN hPen = NULL;
HPEN hOldPen = NULL;
PAGEINFO PageInfo;
RECT rcDst;

memset(&PageInfo, 0, sizeof(PAGEINFO));
hdc = GetDC(hWnd);

L_DocSetActivePage(hDoc, 0);

hSelectedPen = CreatePen(PS_SOLID, 2, RGB(255, 255, 0));
if (hSelectedPen)
hOldSelectedPen = L_DocSetSelectedZonePen(hDoc, hSelectedPen);

hPen = CreatePen(PS_SOLID, 2, RGB(255, 0, 255));
if (hPen)
hOldPen = L_DocSetZonePen(hDoc, hSelectedPen);

L_DocGetPageInfo (hDoc, 0, &PageInfo, sizeof(PAGEINFO));
SetRect(&rcDst, 0, 0, PageInfo.nWidth, PageInfo.nHeight);

L_DocSelectZone(hDoc, hdc, 0, 0, TRUE);
L_DocDrawPage(hDoc, hdc, 0, NULL, NULL, &rcDst, NULL, SRCCOPY, TRUE);

if (hOldSelectedPen)
L_DocSetSelectedZonePen(hDoc, hOldSelectedPen);

if (hOldPen)
L_DocSetZonePen(hDoc, hOldPen);

ReleaseDC(hWnd, hdc);
}


L_DocEnableParallelRecognition

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocEnableParallelRecognition (hDoc, bEnable)

L_HDOC hDoc; | /* handle to the OCR document. */
L_BOOL bEnable; | /* flag */

Enables or disables the Parallel Recognition Mode of the OCR engine.

Parameter | Description
hDoc | Handle to the OCR document.
bEnable | Value that indicates whether to enable or disable the Parallel Recognition Mode. Possible values are:
 | Value | Meaning
 | TRUE | Enable the Parallel Recognition Mode. (default)
 | FALSE | Disable the Parallel Recognition Mode.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

If the host PC has two processors or a hyper-threaded one, enabling the Parallel Recognition Mode can speed up the recognition process by allowing the two recognition engines to run in parallel.

The OCR engine may use Parallel Recognition Mode when a zone is associated with any of the following recognition modules:

RECOGMODULE_MTEXT_OMNIFONT

RECOGMODULE_OMNIFONT_FRX

RECOGMODULE_OMNIFONT_PLUS3W

To determine whether the parallel recognition mode is enabled, call L_DocIsParallelRecognitionEnabled.

To get information on a particular zone, call L_DocGetZone. The recognition module associated with the zone is found in pZONEDATA. RecogModule, which is updated by the L_DocGetZone function.

If L_DocEnableParallelRecognition is not called within an application, then by default, parallel recognition is enabled.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocRecognize, L_DocIsParallelRecognitionEnabled
Topics: | Recognizing Document Pages
 | Working with Zones
 | OCR Functions: Recognition
 | OCR Functions: Zones

Example

For an example, refer to L_DocIsParallelRecognitionEnabled.


L_DocEnumOutputFileFormats

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocEnumOutputFileFormats(hDoc, pfnCallback, pUserData)

L_HDOC hDoc; | /* handle to the OCR document */
ENUMOUTPUTFILEFORMATS pfnCallback; | /* callback function */
L_VOID L_FAR * pUserData; | /* pointer to more parameters for the callback */

Enumerate all available output file formats in the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pfnCallback | Callback function for returning available output file formats.
 | L_DocEnumOutputFileFormats calls this callback function as it enumerates the available output formats.
 | The callback function must adhere to the following function prototype: ENUMOUTPUTFILEFORMATS.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer to the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Finds all available output text formats and reports them by calling the ENUMOUTPUTFILEFORMATS callback.

To get the format information for each format, call L_DocGetTextFormatInfo.

This function can be used to determine the available output file formats in the OCR document enginefor saving the recognition results.

To recognize a page(s), call L_DocRecognize.

To save the recognition results to a file, call L_DocSaveResultsToFile.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, ENUMOUTPUTFILEFORMATS
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

L_HDOC hDoc;
L_INT EXT_FUNCTION EnumOutputFileFormats(FORMAT_TYPE Format, L_VOID L_FAR * pUserData)
{
if (Format == DOC_RTF_WORD_2000)
{
TEXTFORMATINFO FormatInfo;

memset(&FormatInfo, 0, sizeof(TEXTFORMATINFO));
L_INT nRet = L_DocGetTextFormatInfo(hDoc, Format, &FormatInfo, sizeof(TEXTFORMATINFO));
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[1024];

memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Format Name = %s\nFormat DLL Name = %s\nFormat Ext = %s\n"),
FormatInfo.pszName,
FormatInfo.pszDLLName,
FormatInfo.pszExtName);

MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
}
}

return SUCCESS;
}

void TestOutputFileFormats()
{
L_DocEnumOutputFileFormats(hDoc, EnumOutputFileFormats, NULL);
}


L_DocExportPage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocExportPage(hDoc, pBitmap, uStructSize, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
pBITMAPHANDLE pBitmap; | /* pointer to the bitmap handle */
L_UINT uStructSize; | /* size of the structure */
L_INT nPageIndex; | /* page index */

Exports the specified page into the specified bitmap handle.

Parameter | Description
hDoc | Handle to the OCR document.
pBitmap | Pointer to the bitmap handle that references the bitmap to be updated with an image of the exported OCR page.
uStructSize | Specifies the size of the structure pointed to by pBitmap. Use sizeof(BITMAPHANDLE) to calculate this value.
nPageIndex | Index of the page to be exported. This is a zero-based indexing.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use L_FreeBitmap to free pBitmap when it is no longer needed.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddPage, L_DocGetPageCount, L_DocUpdatePage, L_DocRemovePage, L_DocGetPageInfo
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestExportPage(L_HDOC hDoc, L_INT nPageIndex, pBITMAPHANDLE pBitmap)
{
L_INT nRet = L_DocExportPage(hDoc, pBitmap, sizeof(BITMAPHANDLE), nPageIndex);
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("An error occurred in L_DocExportPage."), TEXT("Error!"), MB_OK);
else
MessageBox(NULL, TEXT("The specified page is exported."), TEXT("Notice!"), MB_OK);
}


L_DocExportZones

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocExportZones(hDoc, nPageIndex, pszFileName)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_TCHAR L_FAR * pszFileName; | /* file name */

Exports the zone list to a zone file.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page from which to export the zones. This is a zero-based index.
pszFileName | Character string that contains the name of the zone file to export.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Exports the current zone list of the specified page into a zone file.

This function overwrites any pre-existing zone file with the same name.

The zone coordinates are saved in the zone file in 1/1200 of an inch units.

To import a zone file to a specific page, call L_DocImportZones.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

For an example, refer to L_DocImportZones.


L_DocFindDefaultFillMethod

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFindDefaultFillMethod(hDoc, nPageIndex, pFillMethod)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
FILLMETHOD L_FAR * pFillMethod; | /* pointer to a variable */

Gets default fill method for the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specify the page index. This is a zero-based index.
pFillMethod | Pointer to a FILLMETHOD variable to be updated with the default fill method.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the global fill method of all zones in the specified page.

The function only looks into zones with the FILL_DEFAULT value in their ZONEDATA.FillMethod field. The detected fill method is updated in the pFillMethod variable.If you call this function with NULL for the pFillMethod parameter, the function performs a zone by zone analysis (instead of suggesting a general filling type for the entire image), and if the algorithm can determine a type for a given zone, the function replaces the FILL_DEFAULT value in the zone's ZONEDATA.FillMethod field by the determined one.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetFillMethod, L_DocSetFillMethod
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestFunction(L_HDOC hDoc, L_INT nPageIndex)
{
FILLMETHOD fm;
L_INT nRet = L_DocFindDefaultFillMethod(hDoc, nPageIndex, &fm);
if (nRet != SUCCESS)
return;

if (fm == FILL_OMR)
MessageBox(NULL, TEXT("The Default Fill Method that is used in the specified page is Fill OMR."), TEXT("Notice!"), MB_OK);
}


L_DocFindZones

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFindZones(hDoc, nPageIndex, pRect)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
LPRECT pRect; | /* zones Area */

Finds all zones in the specified are of the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page to search. This is a zero-based index.
pRect | Pointer to RECT structure which specifies the area in which to search for zones. Pass NULL to search the entire page area.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

L_DocFindZones is used for parsing the specified page (also called: auto-zoning), i.e. it analyzes the structure of the page layout and locates blocks for further processing.

The function performs the analysis within the specified area of the image. It finds text or graphics blocks within the specified area, builds a zone list and then connects it to the specified page.

Zones found by this function are entered in a sequential list, called the zone list, which is attached to the specified page. When this function is called, any previously inserted zones are deleted from this list.

L_DocGetZoneCount can be used to retrieve the number of zones in the zone list. Zones can be deleted from this list by the L_DocRemoveZone function. You can get the zone parameters by calling L_DocGetZone. After modifying some zone attributes, use L_DocUpdateZone to apply the changes to the zone.

This function finds the zone coordinates and the type of the zone. The zone type determines the role of the zone in the image layout and can be classified into three different groups:

Group 1: flowed text types:

ZONE_FLOWTEXT, ZONE_COLUMN, ZONE_HEADER, ZONE_FOOTER, ZONE_CAPTION, ZONE_TITLE, ZONE_OTHER

These zone types mean that the zone contains textual information without a table type structure (it is flowed text). The types listed above are considered the same. They are differentiated from each other during the later processing stages.

Group 2: table text type:

ZONE_TABLE

This type means that the zone is detected as containing a table, i.e. with columns, with or without a grid. Such zones are handled differently from those of flowed text type zones.

Group 3: graphic zones:

ZONE_GRAPHIC, ZONE_SGRAPHIC

These zones contain graphics, i.e. this zone will not be recognized at all. These zones exist only to allow saving or export of the image inside the zone area.

New zones created by this function always take the value ZONE_CHAR_FILTER_DEFAULT, meaning that the zone will take on the global filter setting (which is by default ZONE_CHAR_FILTER_DEFAULT to have no filtering).

New zones located by this function always have the FILL_DEFAULT and RECOGMODULE_AUTO values in their FillMethod and RecogModule fields, respectively. The "meaning" of the FILL_DEFAULT filling method can be specified with L_DocSetFillMethod.On the other hand, there is no similar function for specifying the default recognition module.

New zones created by this function always have empty strings in their ZONEDATA.szSection member, which specifies the use of the default section of any enabled User dictionary.

L_DocFindDefaultFillMethod can be used when you don't know the type of page to be processed.

To set Auto Zones options, call L_DocSetZoneOptions.

To get Auto Zones options, call L_DocGetZoneOptions.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

void TestAutoZoneFunc(L_HDOC hDoc, L_INT nPageIndex)
{
AUTOZONEOPTS ZoneOpts;

memset(&ZoneOpts, 0, sizeof(AUTOZONEOPTS));
L_DocGetZoneOptions (hDoc, &ZoneOpts, sizeof(AUTOZONEOPTS));
ZoneOpts.bEnableForceSingleColumn = TRUE;
ZoneOpts.bVisibleGridLines = TRUE;
L_DocSetZoneOptions (hDoc, &ZoneOpts);

L_INT nRet = L_DocFindZones(hDoc, nPageIndex, NULL);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The engine finds all available zones in the specified page."), TEXT("Notice!"), MB_OK);
}


L_DocFreeLanguages

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFreeLanguages(hDoc, ppLangIds)

L_HDOC hDoc; | /* handle to the OCR document */
LANGIDS ** ppLangIds; | /* pointer to the array to be freed */

Frees the language array.

Parameter | Description
hDoc | Handle to the OCR document.
ppLangIds | Pointer to LANGIDS array that will be freed. This array is originally allocated using L_DocGetSelectedLanguages.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Frees the associated memory for the ppLangIds parameter, allocated by a previous call to L_DocGetSelectedLanguages.

You can call this function after calling L_DocGetSelectedLanguages, when the ppLangIds array is no longer needed.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSelectLanguages, L_DocGetSelectedLanguages, L_DocSetCharLangsOptions, L_DocGetCharLangsOptions, L_DocIsCharEnabled, L_DocGetDefaultSpellLanguages
Topics: | OCR Functions: Languages
 | Working with Languages

Example

For an example, refer to L_DocGetSelectedLanguages.


L_DocFreeMemoryResults

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFreeMemoryResults(hDoc, ppBuffer)

L_HDOC hDoc; | /* handle to the OCR document */
L_UCHAR L_FAR ** ppBuffer; | /* buffer to be freed */

Frees the associated memory for the recognition results.

Parameter | Description
hDoc | Handle to the OCR document.
ppBuffer | Address of buffer that contains the recognition results that will be freed.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function must be called to free the memory allocated by a call to L_DocSaveResultsToMemory.

To save the recognition results to memory, call L_DocSaveResultsToMemory.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocFreeMemoryResults.


L_DocFreeRecognizedCharacters

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFreeRecognizedCharacters(hDoc, ppRecogChars)

L_HDOC hDoc; | /* handle to the OCR document */
pRECOGCHARS * ppRecogChars; | /* Address of pointer to RECOGCHARS */

Frees the memory allocated by L_DocGetRecognizedCharacters.

Parameter | Description
hDoc | Handle to the OCR document.
ppRecogChars | Address of a pointer to recognized characters to be freed.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Frees the memory associated with the recognized characters.

To get the recognized characters for a specific recognized page, call L_DocGetRecognizedCharacters.

To update the recognized characters, call L_DocSetRecognizedCharacters.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocGetRecognizedCharacters.


L_DocFreeRecognizedWords

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFreeRecognizedWords (hDoc, ppRecogWords)

L_HDOC hDoc; | /* handle to the OCR document */
pRECOGWORDS * ppRecogWords; | /* address of a pointer to a RECOGWORDS structure */

Frees the memory allocated by L_DocGetRecognizedWords.

Parameter | Description
hDoc | Handle to the OCR document.
ppRecogWords | Address of a pointer to the recognized words to be freed.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Frees the memory associated with the recognized words.

To get the recognized words for a specific recognized page, call L_DocGetRecognizedWords.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSaveResultsToFile, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocGetRecognizedWords.


L_DocGetCharLangsOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetCharLangsOptions(hDoc, pCharOpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pCHAROPTIONS pCharOpts; | /* pointer to a CHAROPTIONS structure */
L_UINT uStructSize; | /* size of the structure */

Gets the current character options for the current activated languages.

Parameter | Description
hDoc | Handle to the OCR document.
pCharOpts | Pointer to a CHAROPTIONS structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pCharOpts, use sizeof(CHAROPTIONS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current character options for the current activated languages in the OCR document engine.

To activate your recognized languages, call L_DocSelectLanguages.

To update the character options for the current activated languages, call L_DocSetCharLangsOptions.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSelectLanguages, L_DocGetSelectedLanguages, L_DocFreeLanguages, L_DocSetCharLangsOptions, L_DocIsCharEnabled, L_DocGetDefaultSpellLanguages
Topics: | OCR Functions: Languages
 | Working with Languages

Example

For an exmple, refer to L_DocSelectLanguages.


L_DocGetDefaultSpellLanguages

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetDefaultSpellLanguages(hDoc, ppLangIds, pnLangCount)

L_HDOC hDoc; | /* handle to the OCR document */
LANGIDS ** ppLangIds; | /* pointer to array to be updated */
L_INT L_FAR * pnLangCount; | /* pointer to integer to be updated */

Gets the default spell languages from the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
ppLangIds | Pointer to LANGIDS array to be updated with the default spell languages.
pnLangCount | Pointer to integer to be updated with the language element counts.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets list of default Spelling languages.

All available languages are the default languages and are always used for checking spelling.

The content of the resulting list depends on the configuration of the OCR document engine, i.e. the presence of the Language dictionary files in the engine Binary directory. For the list of the supported languages, see the topic (Language Dictionary List).

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSelectLanguages, L_DocGetSelectedLanguages, L_DocFreeLanguages, L_DocSetCharLangsOptions, L_DocGetCharLangsOptions, L_DocIsCharEnabled, L_DocRecognize
Topics: | OCR Functions: Languages
 | Working with Languages

Example

For an example, refer to L_DocRecognize.


L_DocGetFillMethod

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetFillMethod(hDoc, pFillMethod)

L_HDOC hDoc; | /* handle to the OCR document */
FILLMETHOD L_FAR * pFillMethod; | /* pointer to a variable */

Gets the default fill method from the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pFillMethod | Pointer to a variable to be updated with the default fill method.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the default filling method setting of the OCR document engine.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetFillMethod, L_DocFindDefaultFillMethod
Topics: | OCR Functions: Pages
 | Working with Pages

Example

For an example, refer to L_DocStartUp.


L_DocGetHandPrintOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetHandPrintOptions(hDoc, pHandOpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pHANDPRINTOPTIONS pHandOpts; | /* pointer to a HANDPRINTOPTIONS structure */
L_UINT uStructSize; | /* size of the structure */

Gets the current hand print options.

Parameter | Description
hDoc | Handle to the OCR document.
pHandOpts | Pointer to a HANDPRINTOPTIONS structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pHandOpts, use sizeof(HANDPRINTOPTIONS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current hand print options used by the OCR document engine.

These options will be used only when the recognition module is RECOGMODULE_HAND_PRINTED_NUMERAL.

To update the hand print options, call L_DocSetHandPrintOptions.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocGetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocGetMOROptions, L_DocSetHandPrintOptions, L_DocSetOMROptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocSetHandPrintOptions.


L_DocGetMOROptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetMOROptions(hDoc, pMOROpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pMOROPTIONS pMOROpts; | /* pointer to a MOROPTIONS structure */
L_UINT uStructSize; | /* size of the structure */

Gets the MOR recognition options from the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pMOROpts | Pointer to MOROPTIONS structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pMOROpts, use sizeof(MOROPTIONS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current MOR options used by the OCR document engine.

These options will be used only when the recognition module is RECOGMODULE_MULTI_LINGUAL_OMNIFONT.

To update the MOR options, call L_DocSetMOROptions.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocGetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocSetHandPrintOptions, L_DocGetHandPrintOptions, L_DocSetOMROptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocSetMOROptions.


L_DocGetOMROptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetOMROptions(hDoc, pOMROpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pOMROPTIONS pOMROpts; | /* pointer to OMROPTIONS */
L_UINT uStructSize; | /* size of the structure */

Gets the current used OMR options.

Parameter | Description
hDoc | Handle to the OCR document.
pOMROpts | Pointer to OMROPTIONS structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pOMROpts, use sizeof(OMROPTIONS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current OMR options used by the OCR document engine.

These options will be used only when the recognition module is RECOGMODULE_OMR.

To update the OMR options, call L_DocSetOMROptions.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocGetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocGetMOROptions, L_DocSetHandPrintOptions, L_DocGetHandPrintOptions, L_DocSetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocSetOMROptions.


L_DocGetPageCount

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetPageCount(hDoc, pnPageCount)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT L_FAR * pnPageCount; | /* address of the variable to be updated */

Gets the total number pages in the OCR document.

Parameter | Description
hDoc | Handle to the OCR document.
pnPageCount | Address of the variable to be updated with total number of OCR pages.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the total number of pages in the specified OCR document.

To remove a page, call L_DocRemovePage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddPage, L_DocUpdatePage, L_DocRemovePage, L_DocExportPage, L_DocGetPageInfo
Topics: | OCR Functions: Pages
 | Working with Pages

Example

For an example, refer to L_DocAddPage.


L_DocGetPageInfo

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetPageInfo(hDoc, nPageIndex, pPageInfo, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
pPAGEINFO pPageInfo; | /* pointer to PAGEINFO structure */
L_UINT uStructSize; | /* size of the structure */

Gets the information about the specified page in the OCR document.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies index of the page for which information will be retrieved.
pPageInfo | Pointer to a PAGEINFO structure to be updated with the page information.
uStructSize | Specifies the size of the structure pointed to by pPageInfo, use sizeof(PAGEINFO) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To get the number of pages of the OCR document, call L_DocGetPageCount.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddPage, L_DocGetPageCount, L_DocUpdatePage, L_DocRemovePage, L_DocExportPage
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestPageInfo(L_HDOC hDoc, L_INT nPageIndex)
{
PAGEINFO PageInfo;
L_INT nPageCount = 0;
L_TCHAR szBuffer[100];

memset(szBuffer, 0, sizeof(szBuffer));

memset(&PageInfo, 0, sizeof(PAGEINFO));
L_INT nRet = L_DocGetPageInfo(hDoc, nPageIndex, &PageInfo, sizeof(PAGEINFO));
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("An error occurred during L_DocGetPageInfo."), TEXT("Error!"), MB_OK);
else
{
wsprintf(szBuffer, TEXT("Page Width = %d\nPage Height = %d\nPage Bits Per Pixel = %d\n"), PageInfo.nWidth, PageInfo.nHeight, PageInfo.nBitsPerPixel);
MessageBox(NULL, szBuffer, TEXT("Page Info!"), MB_OK);
}
}


L_DocGetPaintZoomFactor

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetPaintZoomFactor (hDoc, nPageIndex, pfZoomFactor)

L_HDOC hDoc; | /* handle to the OCR document. */
L_INT nPageIndex; | /* page index */
L_FLOAT * pfZoomFactor; | /* pointer to a variable */

Gets the zoom factor used to draw the specified OCR page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page for which to get the zoom factor. This index is zero-based.
pfZoomFactor | Pointer to a variable to be updated with the zoom factor for the specified page.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function retrieves the zoom factor that was set using L_DocSetPaintZoomFactor. If L_DocGetPaintZoomFactor is called before L_DocSetPaintZoomFactor has been called, pfZoomFactor will be updated with the default value 100, which represents normal display.

The specified page may or may not contain zones. If the page has zones, the zones will be drawn using the zoom factor too.

To draw the specified page, call L_DocDrawPage.

To set the zoom factor for a specific page, call L_DocSetPaintZoomFactor.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetPaintZoomFactor, L_DocRecognize, L_DocDrawPage, L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | Drawing Pages and Zones
 | OCR Functions: Drawing Zones and Pages

Example

For an example, refer to L_DocSetPaintZoomFactor.


L_DocGetRecognitionResultOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetRecognitionResultOptions(hDoc, pResOpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pRESULTOPTIONS pResOpts; | /* pointer to RESULTOPTIONS */
L_UINT uStructSize; | /* size of the structure */

Gets current used options to save the recognition results.

Parameter | Description
hDoc | Handle to the OCR document.
pResOpts | Pointer to a RESULTOPTIONS structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pResOpts, use sizeof(RESULTOPTIONS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current options for saving recognition results to a file.

To update the options for saving the recognition results, call L_DocGetRecognitionResultOptions.

To recognize a page(s), call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocSaveResultsToFile.


L_DocGetRecognizedCharacters

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetRecognizedCharacters(hDoc, nPageIndex, ppRecogChars, plCharsCount, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
pRECOGCHARS * ppRecogChars; | /* address of a pointer to a RECOGCHARS structure */
L_UINT uStructSize; | /* size of the structure */

Gets all recognized characters for specific recognized page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the recognized page for which to get the recognized characters. This index is zero-based.
ppRecogChars | Address of pointer to a RECOGCHARS structure into which an array of RECOGCHARS structures will be allocated and updated.
plCharsCount | Pointer to variable to be updated with the number of elements in the ppRecogChars array.
uStructSize | Specifies the size of the structure pointed to by ppRecogChars, use sizeof(RECOGCHARS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will allocate and return an array for all recognized characters for the specified recognized page in ppRecogChars.

This function will return the recognized characters count in plCharsCount.

You must free the memory associated with ppRecogChars parameter when it is no longer needed by calling L_DocFreeRecognizedCharacters.

This function can be called after a successful recognition process started by calling L_DocRecognize.

This function should not be called before calling L_DocRecognize.

To update the recognized characters, call L_DocSetRecognizedCharacters. To save the updated recognized characters to a file, call L_DocSaveResultsToFile To save the results into memory, call L_DocSaveResultsToMemory.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void UpdateRecognizedChars(L_HDOC hDoc)
{
RECOGNIZEOPTS RecogOpts;
RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = 0;
RecogOpts.nPagesCount = 1;
RecogOpts.SpellLangId = LANG_ID_ENGLISH;
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

L_INT nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
if (nRet == SUCCESS)
{
pRECOGCHARS pRecogChars = NULL;
L_INT32 lCharsCount = 0;
nRet = L_DocGetRecognizedCharacters(hDoc, 0, &pRecogChars, &lCharsCount, sizeof(RECOGCHARS));
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[1024];
RESULTOPTIONS ResOpts;

memset(&ResOpts, 0, sizeof(RESULTOPTIONS));
memset(szBuffer, 0, sizeof(szBuffer));

wsprintf(szBuffer, TEXT("Number of recognized characters in the specified page = %d\n"), lCharsCount);
MessageBox(NULL, szBuffer, TEXT("Recognized Characters Count"), MB_OK);

for (L_INT32 i=0; i<lCharsCount; i++)
{
if (pRecogChars[i].nConfidence > 900)
{
pRecogChars[i].uFont |= FONT_BOLD | FONT_UNDERLINE;
pRecogChars[i].nFontSize = 20;
}
}

L_DocSetRecognizedCharacters(hDoc, 0, pRecogChars, lCharsCount);
L_DocFreeRecognizedCharacters(hDoc, &pRecogChars);

L_DocGetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS));

ResOpts.Format = DOC_RTF_WORD_2000;
ResOpts.FormatLevel = FORMAT_LEVEL_FULL;
ResOpts.DocOptions.PaperSize = SEL_PREDEFINED;
ResOpts.DocOptions.PaperType = PAPER_TYPE_A4;

L_DocSetRecognitionResultOptions(hDoc, &ResOpts);
L_DocSaveResultsToFile(hDoc, TEXT("c:\\test.doc"));
}
}
}


L_DocGetRecognizedWords

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetRecognizedWords (hDoc, nPageIndex, ppRecogWords, uStructSize, pnWordsCount)

L_HDOC hDoc; | /* handle to the OCR document.*/
L_INT nPageIndex; | /* page index */
pRECOGWORDS * ppRecogWords; | /* address of a pointer to a RECOGWORDS structure*/
L_UINT uStructSize; | /* size of the structure */
L_INT * pnWordsCount; | /* pointer to a variable to be updated */

Gets all recognized words for the specified recognized page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the recognized page from which to get the recognized words. This index is zero-based.
ppRecogWords | Address of a pointer to a RECOGWORDS structure into which an array of RECOGWORDS structures will be allocated and updated.
uStructSize | Specifies the size of the structure pointed to by ppRecogWords. Should be set to sizeof(RECOGWORDS).
pnWordsCount | Pointer to a variable to be updated with the number of elements in the ppRecogWords array.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function updates ppRecogWords with an array containing all of the recognized words for the specified recognized page. Memory for the array of structures pointed to by ppRecogWords is allocated by this function.

This function also updates the variable pointed to by pnWordsCount with the number of recognized words.

Once the ppRecogWords parameter is no longer needed, free the memory associated with it by calling L_DocFreeRecognizedWords.

This function should only be called after successfully starting a recognition process by calling L_DocRecognize.

L_DocGetRecognizedWords just combines the recognized characters for the specified page into words. To change the contents of the recognized words, change the set of recognized characters by calling L_DocSetRecognizedCharacters. To save the updated recognized characters to a file, call L_DocSaveResultsToFile To save the results into memory, call L_DocSaveResultsToMemory.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSaveResultsToFile, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestRecognizedWords(L_HDOC hDoc)
{
pRECOGWORDS pRecogWords = NULL;
L_INT nWordsCount = 0;

L_INT nRet = L_DocGetRecognizedWords(hDoc, 0, &pRecogWords, sizeof(RECOGWORDS), &nWordsCount);
if (nRet == SUCCESS)
{
CString csBuffer;

csBuffer.Format(TEXT("Total Recognized words = %d"), nWordsCount);
AfxMessageBox(csBuffer);

for (L_INT i=0; i<nWordsCount; i++)
{
CString csWord = pRecogWords[i].szWord;
csBuffer.Format(TEXT("Word = %s\nZone Index = %d\nArea {%d, %d, %d, %d}"),
csWord,
pRecogWords[i].nZoneIndex,
pRecogWords[i].rcWordArea.left,
pRecogWords[i].rcWordArea.top,
pRecogWords[i].rcWordArea.right,
pRecogWords[i].rcWordArea.bottom);
AfxMessageBox(csBuffer);
}

L_DocFreeRecognizedWords(hDoc, &pRecogWords);
}
}


L_DocGetRecognizeModuleTradeOff

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetRecognizeModuleTradeOff(hDoc, pTradeOff)

L_HDOC hDoc; | /* handle to the OCR document */
RECOGMODULE_TRADEOFF * pTradeOff; | /* pointer to a variable */

Gets the current OCR document engine Trade-off setting.

Parameter | Description
hDoc | Handle to the OCR document.
pTradeOff | Pointer to a variable be updated with a value that represents the trade-off option used by the engine. For a list of possible values, refer to RECOGMODULE_TRADEOFF.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current OCR document engine Trade-off setting.

To set Trade-off setting, call L_DocSetRecognizeModuleTradeOff.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocGetMOROptions, L_DocSetHandPrintOptions, L_DocGetHandPrintOptions, L_DocSetOMROptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocRecognize.


L_DocGetSelectedLanguages

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetSelectedLanguages(hDoc, ppLangIds, pnLangCount)

L_HDOC hDoc; | /* handle to the OCR document */
LANGIDS ** ppLangIds; | /* pointer to an array to be updated */
L_INT L_FAR * pnLangCount; | /* pointer to a variable to be updated */

Gets the current selected languages.

Parameter | Description
hDoc | Handle to the OCR document.
ppLangIds | Pointer to a LANGIDS array to be filled with the current selected languages.
pnLangCount | Pointer to an integer to be updated with the number of selected languages in ppLangIds.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Retrieves the current language selection.

To activate recognized languages, call L_DocSelectLanguages function.

This function will allocate memory for ppLangIds. To free the ppLangIds parameter, call L_DocFreeLanguages.

To get the character options for the current activated languages, call L_DocGetCharLangsOptions.

To set the character options for the current activated languages, call L_DocSetCharLangsOptions.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSelectLanguages, L_DocFreeLanguages, L_DocSetCharLangsOptions, L_DocGetCharLangsOptions, L_DocIsCharEnabled, L_DocGetDefaultSpellLanguages
Topics: | OCR Functions: Languages
 | Working with Languages

Example

void TestGetLangs(L_HDOC hDoc)
{
LANGIDS * pLangIds = NULL;
L_INT nLangCount = 0;

L_INT nRet = L_DocGetSelectedLanguages(hDoc, &pLangIds, &nLangCount);
if (nRet != SUCCESS)
return;

for (L_INT i=0; i<nLangCount; i++)
{
if (pLangIds[i] == LANG_ID_ENGLISH)
MessageBox(NULL, TEXT("English is the active language."), TEXT("Notice!"), MB_OK);
}

L_DocFreeLanguages (hDoc, &pLangIds);

if (L_DocIsCharEnabled(hDoc, L'a') == TRUE)
MessageBox(NULL, TEXT("The specified character is available in the selected languages."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("The specified character is not available in the selected languages."), TEXT("Notice!"), MB_OK);
}


L_DocGetSelectedZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetSelectedZone(hDoc, nPageIndex, pZoneData, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
pZONEDATA pZoneData; | /* pointer to a ZONEDATA structure */
L_UINT uStructSize; | /* size of the structure */

Gets the selected zone data.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page in which to find the zone data for its selected zone. This index is zero-based.
pZoneData | Pointer to a ZONEDATA structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pZoneData, use sizeof(ZONEDATA) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the zone data for the selected zone in the specified page.

To select a zone, call L_DocSelectZone or L_DocSelectZoneByPoint.

To get zone data for specific zone, call L_DocGetZone.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

For an example, refer to L_DocZone.


L_DocGetSpecialChar

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetSpecialChar(hDoc, pSpecialChar, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pSPECIALCHAR pSpecialChar; | /* pointer to a SPECIALCHAR structure */
L_UINT uStructSize; | /* size of the structure */

Gets the current used special characters.

Parameter | Description
hDoc | Handle to the OCR document.
pSpecialChar | Pointer to a SPECIALCHAR structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pSpecialChar, use sizeof(SPECIALCHAR) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the current special characters used in the last recognition process or save results process.

To update the special characters, call L_DocSetSpecialChar.

To recognize a page(s), call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocSetSpecialChar.


L_DocGetStatus

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetStatus(hDoc, pStatus, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pSTATUS pStatus; | /* pointer to STATUS structure */
L_UINT uStructSize; | /* size of the structure */

Gets last recognition status.

Parameter | Description
hDoc | Handle to the OCR document.
pStatus | Pointer to a STATUS structure to be updated
uStructSize | Specifies the size of the structure pointed to by pStatus, use sizeof(STATUS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Returns information about the accuracy and timing data of the last recognition status.

Call this function after calling L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestFunction(L_HDOC hDoc)
{
STATUS Status;
L_TCHAR szBuffer[1024];

memset(&Status, 0, sizeof(STATUS));
memset(szBuffer, 0, sizeof(szBuffer));
L_INT nRet = L_DocGetStatus(hDoc, &Status, sizeof(STATUS));
if (nRet == SUCCESS)
{
wsprintf(szBuffer, TEXT("Recognized Characters = %d\nRecognized Words = %d\nRejected Characters = %d\nRejected Words = %d\n"),
Status.nRecogChrCount,
Status.nRecogWordCount,
Status.nRejectChrCount,
Status.nRejectWordCount);

MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
}
}


L_DocGetTextFormatInfo

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetTextFormatInfo(hDoc, Format, pFormatInfo, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
FORMAT_TYPE Format; | /* format type */
pTEXTFORMATINFO pFormatInfo; | /* pointer to a TEXTFORMATINFO structure */
L_UINT uStructSize; | /* size of the structure */

Gets extra information about specific file format.

Parameter | Description
hDoc | Handle to the OCR document.
Format | Specifies the format type for which to obtain extra information.
pFormatInfo | Pointer to a TEXTFORMATINFO structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pFormatInfo, use sizeof(TEXTFORMATINFO) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the detailed information about the specified output format.

To get all the available output formats in the OCR document engine, call L_DocEnumOutputFileFormats.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocEnumOutputFileFormats.


L_DocGetUserDictionary

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetUserDictionary(hDoc, pUDOpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pUSERDICTIONARY pUDOpts; | /* pointer to a USERDICTIONARY structure */
L_UINT uStructSize; | /* size of the structure */

Gets the name of the current User dictionary and its default section.

Parameter | Description
hDoc | Handle to the OCR document.
pUDOpts | Pointer to a USERDICTIONARY structure to be updated.
uStructSize | Specifies the size of the structure pointed to by pUDOpts, use sizeof(USERDICTIONARY) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the name of the current User dictionary and its default section that used in the recognition process.

To set a User dictionary and its default section, call L_DocSetUserDictionary.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySection, L_DocGetUserDictionarySectionItem, L_DocAddItemToUserDictionary, L_DocRemoveItemFromUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

void UserDictionaryInfo(L_HDOC hDoc)
{
USERDICTIONARY UDOpts;

memset(&UDOpts, 0, sizeof(USERDICTIONARY));
L_INT nRet = L_DocGetUserDictionary(hDoc, &UDOpts, sizeof(USERDICTIONARY));
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[1024];

memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("User Dictionary Name = %s\nDefault Section Name = %s\n"),
UDOpts.pszFileName,
UDOpts.pszDefSection);

MessageBox(NULL, szBuffer, TEXT("User Dictionary Info"), MB_OK);

if (L_DocGetUserDictionaryState(hDoc))
MessageBox(NULL, TEXT("The current user dictionary is changed."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("The current user dictionary is not changed."), TEXT("Notice!"), MB_OK);

L_CHAR szSection[MAX_SECTION_NAME_LENGTH];
memset(szSection, 0, sizeof(szSection));
nRet = L_DocGetUserDictionarySection(hDoc, szSection, MAX_SECTION_NAME_LENGTH, TRUE);
if (nRet == SUCCESS)
{
memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("First Section in the current User Dictionray = %s\n"), szSection);

MessageBox(NULL, szBuffer, TEXT("First Section"), MB_OK);

L_WCHAR * pwcItem = (L_WCHAR *)GlobalAllocPtr(GHND, 512 * sizeof(L_WCHAR));
if (pwcItem)
{
L_UINT32 uMask = 0;
nRet = L_DocGetUserDictionarySectionItem(hDoc, szSection, pwcItem, 512 * sizeof(L_WCHAR), &uMask, TRUE);
if (nRet == SUCCESS)
{
L_TCHAR szItem[512];

memset(szItem, 0, sizeof(szItem));
WideCharToMultiByte (0, 0, pwcItem, -1, szItem, 512, NULL, NULL);

memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("1st Section Item in the 1st section of the current User Dictionray = %s\n"), szItem);

MessageBox(NULL, szBuffer, TEXT("First Section Item"), MB_OK);
}

GlobalFreePtr(pwcItem);
}
}
}
}


L_DocGetUserDictionarySection

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetUserDictionarySection(hDoc, pSection, nSize, bFirst)

L_HDOC hDoc; | /* handle to the OCR document */
L_CHAR L_FAR * pSection; | /* pointer to a buffer to be updated */
L_INT nSize; | /* buffer size */
L_BOOL bFirst; | /* flag */

Gets user dictionary sections.

Parameter | Description
hDoc | Handle to the OCR document.
pSection | Pointer to a buffer to be updated with the name of the section, specified in the bFirst parameter, in the User dictionary.
nSize | Specifies the size of the buffer in bytes.
bFirst | Flag specifying which section to get. Valid values are:
 | Value | Meaning
 | TRUE | Get the first section in the user dictionary
 | FALSE | Gets the next section in the user dictionary

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets a list of user dictionary sections.

The lengths of each section name never exceeds MAX_SECTION_NAME_LENGTH characters (including the terminating zero).

Call this function multiple times to get each section in a user dictionary. The first time you call it, pass TRUE for bFirst. In each subsequent call, pass FALSE for bFirst, and LEADTOOLS will get the next section from the specified dictionary. To re-start the process, call this function again, and pass TRUE for bFirst.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetUserDictionary, L_DocGetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySectionItem, L_DocAddItemToUserDictionary, L_DocRemoveItemFromUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

For an example, refer to L_DocGetUserDictionary.


L_DocGetUserDictionarySectionItem

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetUserDictionarySectionItem(hDoc, pSection, pItem, nSize, puMask, bFirst)

L_HDOC hDoc; | /* handle to the OCR document */
L_CHAR L_FAR * pSection; | /* string containing the section name */
L_WCHAR * pItem; | /* pointer to be updated */
L_INT nSize; | /* buffer size */
L_UINT32 L_FAR * puMask; | /* pointer to be updated */
L_BOOL bFirst; | /* flag */

Gets section items from the specified section of the user dictionary.

Parameter | Description
hDoc | Handle to the OCR document.
pSection | Name of the section of the User dictionary whose items are to be listed.
pItem | Pointer to a buffer to get the first UNICODE item of the item-list.
nSize | Specifies the size of the buffer in bytes.
puMask | Pointer to a variable to hold the item's attribute. Valid values are:
 | Value | Meaning
 | USER_DICT_LITERAL | [0x0000] Used literal
 | USER_DICT_REGULAR_EXPRESSION | [0x0001] used regular expression

bFirst | Flag specifying which item to get. Valid values are:
 | Value | Meaning
 | TRUE | get the first section item in the specified section
 | FALSE | gets the next section item in the specified section

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function returns the item from the pSection section of the User dictionary.

Before calling this function, you must allocate a buffer with sufficient size to accommodate the current pItem parameter.

Call this function multiple times to get each of the items in a user dictionary section. The first time you call it, pass TRUE for bFirst. In each subsequent call, pass FALSE for bFirst, and LEADTOOLS will get the next item from the specified section. To re-start the process, call this function again, and pass TRUE for bFirst.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetUserDictionary, L_DocGetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySection, L_DocAddItemToUserDictionary, L_DocRemoveItemFromUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

For an example, refer to L_DocGetUserDictionary.


L_DocGetUserDictionaryState

#include "ltdoc.h"

L_BOOL EXT_FUNCTION L_DocGetUserDictionaryState(hDoc)

L_HDOC hDoc;

/* handle to the OCR document */

Indicates whether or not the user dictionary has been changed since it was saved or created.

Parameter | Description
hDoc | Handle to the OCR document.

Returns

TRUE | The user dictionary has been modified since it was last saved or since it was opened/created.
FALSE | The user dictionary has not been modified.

Comments

Changes to the dictionary include adding or deleting user dictionary items.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetUserDictionary, L_DocGetUserDictionary, L_DocGetUserDictionarySection, L_DocGetUserDictionarySectionItem, L_DocAddItemToUserDictionary, L_DocRemoveItemFromUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

For an example, refer to L_DocGetUserDictionary.


L_DocGetZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetZone(hDoc, nPageIndex, nZoneIndex, pZoneData, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_INT nZoneIndex; | /* zone index */
pZONEDATA pZoneData; | /* pointer to a ZONEDATA structure */
L_UINT uStructSize; | /* size of the structure */

Gets information about the zone at the specified index in the zone list of the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page from which to get the zone information. This is a zero-based index.
nZoneIndex | Specifies the index of the zone for which to get the information. This is a zero-based index.
pZoneData | Pointer to a ZONEDATA structure that will be updated with zone information.
uStructSize | Specifies the size of the structure pointed to by pZoneData, use sizeof(ZONEDATA) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Retrieves zone information for the specified zone index in the specified page.

To remove a specific zone, call L_DocRemoveZone.

To add a zone, call L_DocAddZone.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

void TestUpdateZone(L_HDOC hDoc, L_INT nPageIndex, L_INT nZoneIndex)
{
ZONEDATA ZoneData;
memset(&ZoneData, 0, sizeof(ZONEDATA));

L_INT nRet = L_DocGetZone(hDoc, nPageIndex, nZoneIndex, &ZoneData, sizeof(ZONEDATA));
if (nRet != SUCCESS)
{
MessageBox(NULL, TEXT("Couldn't get the specified zone information."), TEXT("Error!"), MB_OK);
return;
}

if (ZoneData.FillMethod != FILL_OCRA)
ZoneData.FillMethod = FILL_OCRA;

if (ZoneData.Type != ZONE_GRAPHIC)
ZoneData.Type = ZONE_GRAPHIC;

nRet = L_DocUpdateZone(hDoc, nPageIndex, nZoneIndex, &ZoneData);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The specified zone is updated."), TEXT("Notice!"), MB_OK);
}


L_DocGetZoneCount

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetZoneCount(hDoc, nPageIndex, pnCount)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_INT L_FAR * pnCount; | /* address of the variable to be updated */

Gets the number of zones in the zone list of the specified page

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page for which to get the number of zones.
pnCount | Address of the variable to be updated with total number of zones in the specified page.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets the number of zones in the zone list of the specified page

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

For an example, refer to L_DocAddZone.


L_DocGetZoneOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocGetZoneOptions(hDoc, pZoneOpts, uStructSize)

L_HDOC hDoc; | /* handle to the OCR document */
pAUTOZONEOPTS pZoneOpts; | /* pointer to AUTOZONEOPTS */
L_UINT uStructSize; | /* size of the structure */

Gets Auto zones options for the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pZoneOpts | Pointer to AUTOZONEOPTS structure to be updated with auto zone options.
uStructSize | Specifies the size of the structure pointed to by pZoneOpts, use sizeof(AUTOZONEOPTS) to calculate this value.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Gets auto zones options from the OCR document engine.

Call L_DocFindZones to activate automatic zone detection.

To update the current auto zones options, call L_DocSetZoneOptions.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

For an example, refer to L_DocFindZones.


L_DocImportZones

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocImportZones(hDoc, nPageIndex, pszFileName)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_TCHAR L_FAR * pszFileName; | /* file name */

Imports the zone list from a zone file.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page into which the settings will be loaded. This is a zero-based index.
pszFileName | Character string containing the name of the zone file that contains the zones to import.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Imports the zone list from a zone file into the specified page.

Calling this function removes any zone list already attached to the specified page.

To save the zone list to a file, call L_DocExportZones.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

void TestZoneFile(L_HDOC hDoc, L_INT nPageIndex, L_TCHAR * pszZoneFile)
{
L_INT nRet = L_DocImportZones(hDoc, nPageIndex, pszZoneFile);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("Imports the zone file into the specified page."), TEXT("Notice!"), MB_OK);

//...
// work with zones...
//

// exports page zone list to Zone file...
nRet = L_DocExportZones (hDoc, nPageIndex, pszZoneFile);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("Exports the zone list into a zone file."), TEXT("Notice!"), MB_OK);
}


L_DocIsCharEnabled

#include "ltdoc.h"

L_BOOL EXT_FUNCTION L_DocIsCharEnabled(hDoc, ch)

L_HDOC hDoc; | /* handle to the OCR document */
L_WCHAR ch; | /* character to be checked */

Determines whether the specified character is enabled in the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
ch | Character to be checked in the OCR document engine.

Returns

TRUE | Character is validated for recognition.
FALSE | Character is disabled in the OCR document engine

Comments

Inquires whether a given character is validated for the current page by its Language environment and any filtering, which may include FilterPlus characters for one or more zones on the pages.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSelectLanguages, L_DocGetSelectedLanguages, L_DocFreeLanguages, L_DocSetCharLangsOptions, L_DocGetCharLangsOptions, L_DocGetDefaultSpellLanguages
Topics: | OCR Functions: Languages
 | Working with Languages

Example

For an example, refer to L_DocGetSelectedLanguages.


L_DocIsParallelRecognitionEnabled

#include "ltdoc.h"

L_BOOL EXT_FUNCTION L_DocIsParallelRecognitionEnabled (hDoc)

L_HDOC hDoc;

/* handle to the OCR document */

Determines whether the Parallel Recognition Mode is enabled.

Parameter | Description
hDoc | Handle to the OCR document.

Returns

Value | Meaning
TRUE | The Parallel Recognition Mode is enabled.
FALSE | The Parallel Recognition Mode is disabled.

Comments

For more information on the Parallel Recognition Mode, refer to L_DocEnableParallelRecognition.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocRecognize, L_DocEnableParallelRecognition
Topics: | Recognizing Document Pages
 | Working with Zones
 | OCR Functions: Recognition
 | OCR Functions: Zones

Example

void TestParallelRecognition(L_HDOC hDoc)
{
L_BOOL bEnable = L_DocIsParallelRecognitionEnabled(hDoc);
if (!bEnable)
L_DocEnableParallelRecognition(hDoc, TRUE);

MessageBox(NULL, TEXT("The Parallel recognition mode is enabled."), TEXT("Notice!"), MB_OK);
}


L_DocLoadSettings

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocLoadSettings(hDoc, pszFileName)

L_HDOC hDoc; | /* handle to the OCR document */
L_TCHAR L_FAR * pszFileName; | /* file name */

Loads settings from an OCR engine settings file.

Parameter | Description
hDoc | Handle to the OCR document.
pszFileName | Character string that contains the name of the OCR engine settings file.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Loads settings from a settings file that was previously saved by a call to L_DocSaveSettings.

To save engine settings to a file, call L_DocSaveSettings.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSaveSettings
Topics: | OCR Functions: Starting and Shutting Down
 | Starting and Shutting Down the Engine

Example

For an example, refer to L_DocStartUp.


L_DocLockPage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocLockPage(hDoc, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */

Locks a specific page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page to be locked. This index is zero-based.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Locks the specified page so you can update its bitmap using L_DocUpdatePage function.

After updating the page’s bitmap, you should unlock the page by calling L_DocUnlockPage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone, L_DocUpdatePage
Topics: | OCR Functions: Pages
 | Working with Pages

Example

For an example, refer to L_DocUpdatePage.


L_DocOffsetZones

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocOffsetZones(hDoc, pt)

L_HDOC hDoc; | /* handle to the OCR document */
POINT pt; | /* pointer to a POINT structure */

Scrolls the zones of the currently displayed page, by the specified values.

Parameter | Description
hDoc | Handle to the OCR document.
pt | POINT structure that contains values that represent the amount of vertical and horizontal scrolling.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When a page is scrolled, the zones on that page must also be scrolled and redrawn in their new locations, relative to the page. The amount the page was scrolled indicates the amount by which the zones must be scrolled. This amount is specified in the X and Y parameters.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocRemoveSelectedZone, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

void TestSelectZoneByPoint(L_HDOC hDoc, HWND hWnd)
{
HDC hdc = GetDC(hWnd);
L_INT nSelZone;
POINT pt;
POINT ptScroll;

ptScroll.x = 0;
ptScroll.y = 0;

pt.x = 100;
pt.y = 100;

L_DocOffsetZones(hDoc, ptScroll);
L_INT nRet = L_DocSelectZoneByPoint(hDoc, hdc, 0, pt, &nSelZone);
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[200];
memset(szBuffer, 0, sizeof(szBuffer));

wsprintf(szBuffer, TEXT("The selected zone index = %d\n"), nSelZone);
MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
}

ReleaseDC(hWnd, hdc);
}


L_DocRecognize

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocRecognize(hDoc, pRecogOpts, pfnCallback, pUserData)

L_HDOC hDoc; | /* handle to the OCR document */
pRECOGNIZEOPTS pRecogOpts; | /* pointer to RECOGNIZEOPTS */
RECOGNIZESTATUSCALLBACK pfnCallback; | /* callback function */
L_VOID L_FAR * pUserData; | /* pointer to more parameters for the callback */

Recognizes the specified page(s)

Parameter | Description
hDoc | Handle to the OCR document.
pRecogOpts | Pointer to a RECOGNIZEOPTS structure that contains recognition options.
pfnCallback | Optional callback function for reporting recognition status.
 | If you do not provide a callback function, use NULL as the value of this parameter. Use NULL if no progress reporting is needed.
 | If you do provide a callback function, use the function pointer as the value of this parameter.
 | L_DocRecognize calls this callback function as it reports recognition status for each recognized page.
 | The callback function must adhere to the following function prototype: RECOGNIZESTATUSCALLBACK.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer to the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will recognize the specified page or pages from the OCR document.

Always set the pszFileName member of the RECOGNIZEOPTS structure to a valid file name.

To save the recognition results to memory, call L_DocSaveResultsToMemory.

To save the recognition result to a file, call L_DocSaveResultsToFile.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, RECOGNIZESTATUSCALLBACK, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: User Dictionary
 | Recognizing Document Pages

Example

L_INT EXT_CALLBACK RecognizeStatusCB(L_INT nRecogPage, L_INT nError, L_VOID L_FAR * pUserData)
{
L_TCHAR szBuffer[100];

memset(szBuffer, 0, sizeof(szBuffer));
wsprintf(szBuffer, TEXT("Recognized page index = %d\nRecognition Return value = %d\n"), nRecogPage, nError);
MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);

return SUCCESS;
}

void TestRecognizePage(L_HDOC hDoc, L_INT nPageIndex)
{
LANGIDS * pLangIds = NULL;
L_INT nLangCount = 0;
RECOGNIZEOPTS RecogOpts;
RECOGMODULE_TRADEOFF TradeOff;

L_INT nRet = L_DocGetDefaultSpellLanguages (hDoc, &pLangIds, &nLangCount);
if (nRet == SUCCESS)
{
L_DocGetRecognizeModuleTradeOff(hDoc, &TradeOff);
if (TradeOff != RECGMD_ACCURATE)
L_DocSetRecognizeModuleTradeOff(hDoc, RECGMD_ACCURATE);

RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = nPageIndex;
RecogOpts.nPagesCount = 1;
RecogOpts.bEnableSubSystem = TRUE;
RecogOpts.bEnableCorrection = TRUE;
RecogOpts.SpellLangId = pLangIds[0];
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

L_DocRecognize(hDoc, &RecogOpts, RecognizeStatusCB, NULL);
L_DocFreeLanguages (hDoc, &pLangIds);
}
}


L_DocRemoveItemFromUserDictionary

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocRemoveItemFromUserDictionary(hDoc, pSection, pUDitem, uMask)

L_HDOC hDoc; | /* handle to the OCR document */
L_CHAR L_FAR * pSection; | /* section name */
L_WCHAR * pUDitem; | /* UNICODE string containing the section item to be deleted */
L_UINT32 uMask; | /* mask */

Removes the specified section item from the specified section in the user dictionary.

Parameter | Description
hDoc | Handle to the OCR document.
pSection | Name of the section from which the item should be deleted.
pUDitem | Pointer to a UNICODE string containing the word to be deleted. (The string must be terminated with a double zero.)
uMask | Attribute for the pUDitem to be deleted. Valid values are:
 | Value | Meaning
 | USER_DICT_LITERAL | [0x0000] Used literal
 | USER_DICT_REGULAR_EXPRESSION | [0x0001] used regular expression

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When the characters to be deleted are contained in the ANSI (1252) Code Page, the easiest way to define the pUDitem string is with a wide-character-string literal, L"characters".

When there are two pUDItems items in the pSection with the same name, but with different attributes, the uMask parameter will determine the item to be deleted.

Deleting the last user dictionary item from a section causes the section to be removed automatically from the User dictionary.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetUserDictionary, L_DocGetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySection, L_DocGetUserDictionarySectionItem, L_DocAddItemToUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

void TestRemoveItem(L_HDOC hDoc)
{
L_CHAR * pszSectName = "cities";
L_WCHAR * pwcItem = L"Peabody";

L_INT nRet = L_DocRemoveItemFromUserDictionary(hDoc, pszSectName, pwcItem, USER_DICT_LITERAL);
if (nRet == SUCCESS)
{
USERDICTIONARY UDict;
UDict.uStructSize = sizeof(USERDICTIONARY);
UDict.pszFileName = TEXT("USERDIC1.DIC");
UDict.pszDefSection = pszSectName;

// save the updated dictionary into a file
L_DocSetUserDictionary(hDoc, &UDict, FALSE);
}
}


L_DocRemovePage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocRemovePage(hDoc, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* index of the page to be deleted */

Removes the specified page from the OCR document.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Index of the page to be deleted. This is a zero-based index.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To get the number of pages in the OCR document, call L_DocGetPageCount.

To add one or more new pages, call L_DocAddPage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddPage, L_DocGetPageCount, L_DocUpdatePage, L_DocExportPage, L_DocGetPageInfo
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestRemovePage(L_HDOC hDoc, L_INT nPageIndex)
{
L_INT nRet = L_DocRemovePage(hDoc, nPageIndex);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The specified page is deleted from the OCR document."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("The engine couldn't delete the specified page from the OCR document."), TEXT("Error!"), MB_OK);
}


L_DocRemoveSelectedZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocRemoveSelectedZone(hDoc, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */

Deletes the selected zone from the zone list in the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page which contains the selected zone. This index is zero-based.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Deletes the selected zone from the zone list in the specified page.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

void TestRemoveSelZone(L_HDOC hDoc)
{
L_INT nRet = L_DocRemoveSelectedZone(hDoc, 0);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The selected zone has been deleted from the Zone list in the page."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("Can't delete the selected zone or there is no selected zone."), TEXT("Error!"), MB_OK);
}


L_DocRemoveZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocRemoveZone(hDoc, nPageIndex, nZoneIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_INT nZoneIndex; | /* zone index */

Removes one or more zones from the zone list for the specified page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page for which the zone(s) will be deleted. This is a zero-based index.
nZoneIndex | Specifies the index of the zone(s) to be deleted. This is a zero-based index.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The nZoneIndex parameter specifies the zone that will be deleted. If you pass –1 for the nZoneIndex parameter, then this function will delete all zones in the zone list for the specified page.

The index of the first zone in the zone list is zero (0).

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

void TestRemoveZone(L_HDOC hDoc, L_INT nPageIndex, L_INT nZoneIndex)
{
L_INT nRet = L_DocRemoveZone(hDoc, nPageIndex, nZoneIndex);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The specified zone is deleted from the specified page."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("The engine couldn't delete the specified zone."), TEXT("Error!"), MB_OK);
}


L_DocSaveResultsToFile

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSaveResultsToFile(hDoc, pszFileName)

L_HDOC hDoc; | /* handle to the OCR document */
L_TCHAR L_FAR * pszFileName; | /* the output file name */

Saves the recognition results to a file.

Parameter | Description
hDoc | Handle to the OCR document.
pszFileName | Character string which contains the name of the output file to be saved.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Saves the recognition results to a file.

To recognize a page(s), call L_DocRecognize.

To set save recognition results options, call L_DocSetRecognitionResultOptions.

To get the current save recognition results options, call L_DocGetRecognitionResultOptions.

To get all supported output formats, call L_DocEnumOutputFileFormats.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestSaveResultsToFile(L_HDOC hDoc, L_INT nPageIndex)
{
RECOGNIZEOPTS RecogOpts;
RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = nPageIndex;
RecogOpts.nPagesCount = 1;
RecogOpts.SpellLangId = LANG_ID_ENGLISH;
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

L_INT nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
if (nRet == SUCCESS)
{
RESULTOPTIONS ResOpts;
memset(&ResOpts, 0, sizeof(RESULTOPTIONS));
L_DocGetRecognitionResultOptions(hDoc, &ResOpts, sizeof(RESULTOPTIONS));

ResOpts.Format = DOC_RTF_WORD_2000;
ResOpts.FormatLevel = FORMAT_LEVEL_FULL;
ResOpts.DocOptions.PaperSize = SEL_PREDEFINED;
ResOpts.DocOptions.PaperType = PAPER_TYPE_A4;

L_DocSetRecognitionResultOptions(hDoc, &ResOpts);

nRet = L_DocSaveResultsToFile(hDoc, TEXT("c:\\test.doc"));
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The recognition results were saved to a file."), TEXT("Notice!"), MB_OK);
}
}


L_DocSaveResultsToMemory

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSaveResultsToMemory(hDoc, ppBuffer, plSize)

L_HDOC hDoc; | /* handle to the OCR document */
L_UCHAR L_FAR ** ppBuffer; | /* address to buffer to be updated */
L_INT32 L_FAR * plSize; | /* pointer to be updated */

Saves the last recognition process result to memory.

Parameter | Description
hDoc | Handle to the OCR document.
ppBuffer | Address of a pointer to be filled with the address of the final output document in memory.
plSize | Address of a variable to be updated with the length of the final output document.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Saves the results of the last recognition process to memory.

To free the memory associated with the recognition results, call L_DocFreeMemoryResults.

Call L_DocSaveResultsToMemory after the recognition process is complete to save the results to memory.

To recognize a page(s), call L_DocRecognize.

To save the recognition results to a file, call L_DocSaveResultsToFile.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestSaveResultsToMemory(L_HDOC hDoc, L_INT nPageIndex)
{
RECOGNIZEOPTS RecogOpts;
RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = nPageIndex;
RecogOpts.nPagesCount = 1;
RecogOpts.SpellLangId = LANG_ID_ENGLISH;
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

L_INT nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
if (nRet == SUCCESS)
{
L_UCHAR * pResult = NULL;
L_INT32 lResultSize = 0;
nRet = L_DocSaveResultsToMemory(hDoc, &pResult, &lResultSize);
if (nRet == SUCCESS)
{
//...
//... process the results that available in pResult
//...

L_DocFreeMemoryResults(hDoc, &pResult);
}
}
}


L_DocSaveSettings

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSaveSettings(hDoc, pszFileName)

L_HDOC hDoc; | /* handle to the OCR document */
L_TCHAR L_FAR * pszFileName; | /* file name */

Saves the current engine settings to a file.

Parameter | Description
hDoc | Handle to the OCR document
pszFileName | Character string that contains the name of the settings file to save.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To load the engine settings from a file, call L_DocLoadSettings.

You must call L_DocStartUp before calling L_DocSaveSettings. However, if you call L_DocSaveSettings after calling L_DocStartUp, but before you have set any of the engine settings, the settings file will contain the default settings.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLoadSettings, L_DocStartUp
Topics: | OCR Functions: Starting and Shutting Down
 | Starting and Shutting Down the Engine

Example

For an example, refer to L_DocStartUp.


L_DocSelectLanguages

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSelectLanguages(hDoc, pLangIds, nLangCount)

L_HDOC hDoc; | /* handle to the OCR document */
LANGIDS * pLangIds; | /* pointer to languages to be activated */
L_INT nLangCount; | /* language count */

Activates the specified languages into the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pLangIds | Array of language ids that will be activated.
nLangCount | Number of language array elements in pLangIds

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Defines the main part of the Language environment of the Character Set.

If this function is not called to specify the language(s) to be recognized, the default value, the English language, is applied.

To get the current activated languages, call L_DocGetSelectedLanguages.

To get the character options for the current activated languages, call L_DocGetCharLangsOptions function.

To recognize page or set of pages, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetSelectedLanguages, L_DocFreeLanguages, L_DocSetCharLangsOptions, L_DocGetCharLangsOptions, L_DocIsCharEnabled, L_DocGetDefaultSpellLanguages
Topics: | OCR Functions: Languages
 | Working with Languages

Example

void TestSelectLang(L_HDOC hDoc)
{
CHAROPTIONS CharOpts;
LANGIDS SelLangs[1];

SelLangs[0] = LANG_ID_ENGLISH;

L_INT nRet = L_DocSelectLanguages(hDoc, SelLangs, 1);
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("Couldn't set English as the default language."), TEXT("Error!"), MB_OK);

memset(&CharOpts, 0, sizeof(CHAROPTIONS));
nRet = L_DocGetCharLangsOptions(hDoc, &CharOpts, sizeof(CHAROPTIONS));

if (CharOpts.CharFilter != ZONE_CHAR_FILTER_ALL)
CharOpts.CharFilter = ZONE_CHAR_FILTER_ALL;

L_DocSetCharLangsOptions (hDoc, &CharOpts);
}


L_DocSelectZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSelectZone(hDoc, hDC, nPageIndex, nZoneIndex, bSelect)

L_HDOC hDoc; | /* handle to the OCR document */
HDC hDC; | /* handle to the target device context */
L_INT nPageIndex; | /* page index */
L_INT nZoneIndex; | /* zone index */
L_BOOL bSelect; | /* flag to select or deselect */

Selects or deselects the specified zone and draws it in the specified hDC.

Parameter | Description
hDoc | Handle to the OCR document.
hDC | Handle to a device context, such as a screen, to use as the display surface. The mapping mode of the device context must be MM_TEXT.
nPageIndex | Specifies the index of the page which contains the zone.This index is zero-based.
nZoneIndex | Specifies the index of the zone that will be selected or deselected. This index is zero-based.
bSelect | Flag which determines the function behavior. Valid values are:
 | Value | Meaning
 | TRUE | Select the specified zone by nZoneIndex parameter.
 | FALSE | Deselect the specified zone by nZoneIndex parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Selects or deselects the specified zone in the specified page and draws the results into the device context (HDC).

To draw a page, call L_DocDrawPage.

To select a zone by specifying a hit point, call L_DocSelectZoneByPoint.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

For an example, refer to L_DocDrawPage.


L_DocSelectZoneByPoint

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSelectZoneByPoint(hDoc, hDC, nPageIndex, pt, pnZoneIndex)

L_HDOC hDoc; | /* handle to the OCR document */
HDC hDC; | /* handle to the target device context */
L_INT nPageIndex; | /* page index */
POINT pt; | /* specifies the point */
L_INT L_FAR * pnZoneIndex; | /* pointer to be updated */

Draws a selection rectangle around the zone located at the specified point.

Parameter | Description
hDoc | Handle to the OCR document.
hDC | Handle to a device context, such as a screen, to use as the display surface. The mapping mode of the device context must be MM_TEXT.
nPageIndex | Specifies the index of the page that contains the zones. This index is zero-based.
pt | Specifies the X and Y coordinates that specify a point inside a zone.
pnZoneIndex | Pointer to a variable to be updated with the index of the selected zone.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Draws a selection rectangle around the zone that contains the specified point.

This function will return the selected zone index if it finds a zone that contains the specified point.

To draw a page, call L_DocDrawPage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

void TestSelectZoneByPoint(L_HDOC hDoc, HWND hWnd)
{
HDC hdc = GetDC(hWnd);
L_INT nSelZone;
POINT pt;
pt.x = 100;
pt.y = 100;

L_INT nRet = L_DocSelectZoneByPoint(hDoc, hdc, 0, pt, &nSelZone);
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[200];
memset(szBuffer, 0, sizeof(szBuffer));

wsprintf(szBuffer, TEXT("The selected zone index = %d\n"), nSelZone);
MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
}

ReleaseDC(hWnd, hdc);
}


L_DocSetActivePage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetActivePage(hDoc, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */

Sets the active page that will be drawn by L_DocDrawPage.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page that will be drawn. This index is zero-based.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

You can call this function to set the active page before drawing a page using L_DocDrawPage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

For an example, refer to L_DocDrawPage.


L_DocSetCharLangsOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetCharLangsOptions(hDoc, pCharOpts)

L_HDOC hDoc; | /* handle to the OCR document */
pCHAROPTIONS pCharOpts; | /* pointer to a CHAROPTIONS structure */

Sets character options for the activated languages in the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pCharOpts | Pointer to a CHAROPTIONS structure which contains the options to be set in the OCR document engine.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets character options for the current activated languages in the OCR document engine.

To activate your recognized languages, call L_DocSelectLanguages.

To get the character options for the current activated languages, call L_DocGetSelectedLanguages.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSelectLanguages, L_DocGetSelectedLanguages, L_DocFreeLanguages, L_DocGetCharLangsOptions, L_DocIsCharEnabled, L_DocGetDefaultSpellLanguages
Topics: | OCR Functions: Languages
 | Working with Languages

Example

For an exmple, refer to L_DocSelectLanguages.


L_DocSetFillMethod

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetFillMethod(hDoc, FillMethod)

L_HDOC hDoc; | /* handle to the OCR document */
FILLMETHOD FillMethod; | /* fill method to be set */

Sets the default fill method to the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
FillMethod | Fill method to be set. For a list of possible values, refer to FILLMETHOD.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Specifies the default filling method for the engine. The default filling method is applied to all zones on the page with the FILL_DEFAULT value in the ZONEDATA.FillMethod field.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetFillMethod, L_DocFindDefaultFillMethod
Topics: | OCR Functions: Pages
 | Working with Pages

Example

For an example, refer to L_DocStartUp.


L_DocSetHandPrintOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetHandPrintOptions(hDoc, pHandOpts)

L_HDOC hDoc; | /* handle to the OCR document */
pHANDPRINTOPTIONS pHandOpts; | /* pointer to a HANDPRINTOPTIONS structure */

Sets the hand print options to be used in the next recognition process.

Parameter | Description
hDoc | Handle to the OCR document.
pHandOpts | Pointer to a HANDPRINTOPTIONS structure which contains the options to be set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets the Hand print options to be used in the next recognition process.

This function will be used only when the recognition module is RECOGMODULE_HAND_PRINTED_NUMERAL.

To get the current hand print options, call L_DocGetHandPrintOptions.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocGetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocGetMOROptions, L_DocGetHandPrintOptions, L_DocSetOMROptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestHANDPrintOptions(L_HDOC hDoc)
{
HANDPRINTOPTIONS HandOpts;

memset(&HandOpts, 0, sizeof(HANDPRINTOPTIONS));

L_DocGetHandPrintOptions (hDoc, &HandOpts, sizeof(HANDPRINTOPTIONS));
if (HandOpts.style != HAND_STYLE_US)
HandOpts.style = HAND_STYLE_US;

HandOpts.bSpace = FALSE;
L_DocSetHandPrintOptions(hDoc, &HandOpts);
}


L_DocSetMOROptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetMOROptions(hDoc, pMOROpts)

L_HDOC hDoc; | /* handle to the OCR document */
pMOROPTIONS pMOROpts; | /* pointer to a MOROPTIONS structure */

Sets MOR recognition options in the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pMOROpts | Pointer to a MOROPTIONS structure which contains the options to be set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets MOR options to be used in the next recognition process.

This function will be used only when the recognition module is RECOGMODULE_MULTI_LINGUAL_OMNIFONT.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocGetRecognizeModuleTradeOff, L_DocGetMOROptions, L_DocSetHandPrintOptions, L_DocGetHandPrintOptions, L_DocSetOMROptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestMOROptions(L_HDOC hDoc)
{
MOROPTIONS MOROpts;

memset(&MOROpts, 0, sizeof(MOROPTIONS));

L_DocGetMOROptions(hDoc, &MOROpts, sizeof(MOROPTIONS));
if (!MOROpts.bEnableFax)
MOROpts.bEnableFax = TRUE;

L_DocSetMOROptions(hDoc, &MOROpts);
}


L_DocSetOMROptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetOMROptions(hDoc, pOMROpts)

L_HDOC hDoc; | /* handle to the OCR document */
pOMROPTIONS pOMROpts; | /* pointer to OMROPTIONS */

Sets the OMR options to be used in next recognition process.

Parameter | Description
hDoc | Handle to the OCR document.
pOMROpts | Pointer to an OMROPTIONS structure which contains the options to be set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets the OMR options to be used in the next recognition process.

This function will be used only when the recognition module is RECOGMODULE_OMR.

To get the current hand print options, call L_DocGetOMROptions.

To recognize a page, call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetRecognizeModuleTradeOff, L_DocGetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocGetMOROptions, L_DocSetHandPrintOptions, L_DocGetHandPrintOptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestOMROptions(L_HDOC hDoc)
{
OMROPTIONS OMROpts;

memset(&OMROpts, 0, sizeof(OMROPTIONS));

L_DocGetOMROptions(hDoc, &OMROpts, sizeof(OMROPTIONS));

if (!OMROpts.bFill)
OMROpts.bFill = TRUE;

if (OMROpts.Frame != OMR_FRAME_YES)
OMROpts.Frame = OMR_FRAME_YES;

if (OMROpts.Sense != OMR_SENSE_NORMAL)
OMROpts.Sense = OMR_SENSE_NORMAL;

L_DocSetOMROptions(hDoc, &OMROpts);
}


L_DocSetPaintZoomFactor

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetPaintZoomFactor (hDoc, nPageIndex, fZoomFactor)

L_HDOC hDoc; | /* handle to the OCR document. */
L_INT nPageIndex; | /* page index */
L_FLOAT fZoomFactor; | /* zoom factor */

Sets the zoom factor used to draw the specified OCR page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page for which to set the zoom factor. This index is zero-based.
fZoomFactor | Specifies the zoom factor used when drawing the specified OCR page. A value of 100 represents normal display; a value of 200 represents a 2X display; a value of 50 represents a 1/2X display; etc.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The page specified in the nPageIndex may or may not have zones. If the page has zones, the zones will be drawn using the zoom factor too.

To draw the specified page, using the specified zoom factor, call L_DocDrawPage.

To get the zoom factor of a specific page, call L_DocGetPaintZoomFactor.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetPaintZoomFactor, L_DocRecognize, L_DocDrawPage, L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | Drawing Pages and Zones
 | OCR Functions: Drawing Zones and Pages

Example

void TestDrawing(L_HDOC hDoc, HWND hWnd)
{
HDC hdc = NULL;
PAGEINFO PageInfo;
RECT rcDst;
L_FLOAT fZoom;

memset(&PageInfo, 0, sizeof(PAGEINFO));
hdc = GetDC(hWnd);

L_DocSetActivePage(hDoc, 0);

L_DocGetPaintZoomFactor(hDoc, 0, &fZoom);
if (fZoom != 100.0)
L_DocSetPaintZoomFactor(hDoc, 0, 100);

L_DocGetPageInfo (hDoc, 0, &PageInfo, sizeof(PAGEINFO));
SetRect(&rcDst, 0, 0, PageInfo.nWidth, PageInfo.nHeight);

L_DocDrawPage(hDoc, hdc, 0, NULL, NULL, &rcDst, NULL, SRCCOPY, TRUE);
ReleaseDC(hWnd, hdc);
}


L_DocSetProgressCB

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetProgressCB(hDoc, pfnCallback, pUserData)

L_HDOC hDoc; | /* handle to the OCR document */
PROGRESSCALLBACK pfnCallback; | /* callback function */
L_VOID L_FAR * pUserData; | /* pointer to more parameters for the callback */

Sets the progress callback function that should be used by the OCR engine to report progress and offer the client the chance to cancel.

Parameter | Description
hDoc | Handle to the OCR document
pfnCallback | Optional callback function for reporting progress of a specific operation.
 | If you do not provide a callback function, use NULL as the value of this parameter. Use NULL if no progress reporting is needed. If you do provide a callback function, use the function pointer as the value of this parameter.
 | The OCR engine calls this callback function as it reports the progress of a specific operation.
 | The callback function must adhere to the following function prototype: PROGRESSCALLBACK.
pUserData | Void pointer that you can use to pass one or more additional parameters that the callback function needs.
 | To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID L_FAR *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer to the appropriate data type to access your variable or structure.
 | If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To get the current process, check the Id member of the PROGRESSDATA structure, which is passed to the PROGRESSCALLBACK function.

Refer to the OCRPROCID enum for the event types that can be reported to the progress callback.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocStartUp, L_DocShutDown, PROGRESSCALLBACK
Topics: | OCR Functions: Starting and Shutting Down
 | Starting and Shutting Down the Engine

Example

L_BOOL EXT_CALLBACK ProgressFunction(pPROGRESSDATA pProgressData, L_VOID L_FAR * pUserData)
{
if (pProgressData->Id == PROC_FIND_ZONES)
MessageBox(NULL, TEXT("The current process is finding zones in a specific page."), TEXT("Notice!"), MB_OK);

//...
//... Your code here
//...

return TRUE;
}

void TestProgressFunction(L_HDOC hDoc)
{
L_DocSetProgressCB(hDoc, ProgressFunction, NULL);
}


L_DocSetRecognitionResultOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetRecognitionResultOptions(hDoc, pResOpts)

L_HDOC hDoc; | /* handle to the OCR document */
pRESULTOPTIONS pResOpts; | /* pointer to RESULTOPTIONS */

Sets the recognition result options.

Parameter | Description
hDoc | Handle to the OCR document.
pResOpts | Pointer to a RESULTOPTIONS structure that contains the options to set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets options that will be used in saving recognition results to a file.

These options will be used with L_DocSaveResultsToFile.

To recognize a page(s), call L_DocRecognize.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocSaveResultsToFile.


L_DocSetRecognizedCharacters

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetRecognizedCharacters(hDoc, nPageIndex, pRecogChars, lCharsCount)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
pRECOGCHARS pRecogChars; | /* array of RECOGCHARS */
L_INT32 lCharsCount; | /* number of recognized characters */

Update the recognized characters for specific recognized page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page that will be updated with the recognized characters. This index is zero-based.
pRecogChars | Array of RECOGCHARS structures which contains the updated recognized characters.
lCharsCount | Specifies the number of recognized characters in the pRecogChars array.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This function will update the recognized characters for specific recognized page using the pRecogChars array. The number of updated recognized characters should equal the count passed in lCharsCount.

You should free the memory associated with pRecogChars when it is no longer needed by calling L_DocFreeRecognizedCharacters.

This function can be called after a successful recognition process started by calling L_DocRecognize.

This function should not be called before calling L_DocRecognize.

To get the recognized characters for a specific recognized page, call L_DocGetRecognizedCharacters. To save the recognized characters to a file, call L_DocSaveResultsToFile. To save the results into memory, call L_DocSaveResultsToMemory.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocGetRecognizedWords, L_DocFreeRecognizedWords
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocGetRecognizedCharacters.


L_DocSetRecognizeModuleTradeOff

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetRecognizeModuleTradeOff(hDoc, TradeOff)

L_HDOC hDoc; | /* handle to the OCR document */
RECOGMODULE_TRADEOFF TradeOff; | /* trade-off setting */

Specifies the tradeoff setting of the OCR document engine that will be applied during auto-zoning and recognition.

Parameter | Description
hDoc | Handle to the OCR document.
TradeOff | Value that represents the trade-off setting to be set. For a list of possible values, refer to RECOGMODULE_TRADEOFF.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Specifies the tradeoff setting of the OCR document engine that will be applied during auto-zoning and recognition.

To apply auto-zone detection in a specific page, call L_DocFindZones. To recognize a page, call L_DocRecognize.

The OCR document engine trade-off setting is effective for the following recognition modules:

RECOGMODULE_MTEXT_OMNIFONT: omnifont multi-lingual module.

RECOGMODULE_MULTI_LINGUAL_OMNIFONT: omnifont module.

RECOGMODULE_HAND_PRINTED_NUMERAL: handprinted numeral module.

RECOGMODULE_RER_PRINTED: handprint module.

This setting does not influence the behavior of any other RECOGMODULE recognition module. Not all of the above modules interpret the settings in the same way.

If this function is not called, the default value RECGMD_ACCURATE is applied.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetRecognizeModuleTradeOff, L_DocSetMOROptions, L_DocGetMOROptions, L_DocSetHandPrintOptions, L_DocGetHandPrintOptions, L_DocSetOMROptions, L_DocGetOMROptions
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

For an example, refer to L_DocRecognize.


L_DocSetSelectedZonePen

#include "ltdoc.h"

HPEN EXT_FUNCTION L_DocSetSelectedZonePen(hDoc, hPen)

L_HDOC hDoc; | /* handle to the OCR document */
HPEN hPen; | /* handle to Pen */

Sets the HPEN object to be used in drawing the selected zone.

Parameter | Description
hDoc | Handle to the OCR document.
hPen | Handle to an HPEN object that will be used in drawing the selected zone.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets the HPEN object that will be used in drawing the selected zone.

To draw zones with the page, call L_DocDrawPage.

To draw a specific selected zone call L_DocSelectZone or L_DocSelectZoneByPoint.

To specify the HPEN object for all zones, call L_DocSetZonePen.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

For an example, refer to L_DocDrawPage.


L_DocSetSpecialChar

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetSpecialChar(hDoc, pSpecialChar)

L_HDOC hDoc; | /* handle to the OCR document */
pSPECIALCHAR pSpecialChar; | /* pointer to a SPECIALCHAR structure */

Sets the special characters.

Parameter | Description
hDoc | Handle to the OCR document.
pSpecialChar | Pointer to a SPECIALCHAR structure which contains the characters to be set.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets the special characters to be used in the next recognition process and save results process.

To get the current special characters, call L_DocGetSpecialChar.

To recognize a page(s), call L_DocRecognize.

Call this function after the recognition process has completed. When L_DocSetSpecialChar is called with the specified characters, the engine will replace all missing or rejected characters with these newly set special characters. This helps the user find the missing or rejected characters with minimal effort when the recognition results are saved to a file.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters
Topics: | OCR Functions: Recognition
 | Recognizing Document Pages

Example

void TestSpecialChar(L_HDOC hDoc, L_INT nPageIndex)
{
RECOGNIZEOPTS RecogOpts;
RecogOpts.uStructSize = sizeof(RECOGNIZEOPTS);
RecogOpts.nPageIndexStart = nPageIndex;
RecogOpts.nPagesCount = 1;
RecogOpts.SpellLangId = LANG_ID_ENGLISH;
RecogOpts.pszFileName = TEXT("c:\\testrdf.rdf");

L_INT nRet = L_DocRecognize (hDoc, &RecogOpts, NULL, NULL);
if (nRet == SUCCESS)
{
SPECIALCHAR SpecialChar;

memset(&SpecialChar, 0, sizeof(SPECIALCHAR));
L_DocGetSpecialChar(hDoc, &SpecialChar, sizeof(SPECIALCHAR));

if (SpecialChar.chMissSym != L'^')
SpecialChar.chMissSym = L'^';

L_DocSetSpecialChar(hDoc, &SpecialChar);
}

//...
//... save recognition results using L_DocSaveResultsToFile
//...
}


L_DocSetUserDictionary

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetUserDictionary(hDoc, pUDOpts , bCreateUD)

L_HDOC hDoc; | /* handle to the OCR document */
pUSERDICTIONARY pUDOpts; | /* pointer to USERDICTIONARY */
L_BOOL bCreateUD; | /* flag */

Sets the User dictionary and its default section for the checking subsystem.

Parameter | Description
hDoc | Handle to the OCR document.
pUDOpts | Pointer to a USERDICTIONARY structure which contains the user dictionary to be set.
bCreateUD | Flag to determine function behavior. Valid values as follows:
 | Value | Meaning
 | TRUE | Creates new user dictionary in memory
 | FALSE | Saves the current user dictionary into the file indicated in the pUDOpts parameter.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Specifies a User dictionary and its default section for the checking subsystem.

This function can also be used to initiate the creation of a new, empty User dictionary in memory.

To disable a previously enabled User dictionary, pass TRUE for bCreateUD when calling L_DocSetUserDictionary.

When creating a new, empty User dictionary, pass TRUE for bCreateUD.

If you save a user dictionary by calling this function with bCreateUD set to FALSE the user dictionary is saved to the file specified in pUDOpts. If you later want to set the user dictionary to use this file, call L_DocSetUserDictionary with the name of the file that contains the user dictionary set in the pUDOpts parameter of this function and pass FALSE for the bCreateUD parameter.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetUserDictionary, L_DocGetUserDictionaryState, L_DocGetUserDictionarySection, L_DocGetUserDictionarySectionItem, L_DocAddItemToUserDictionary, L_DocRemoveItemFromUserDictionary
Topics: | OCR Functions: User Dictionary
 | Working with a Dictionary

Example

void TestCreateUD(L_HDOC hDoc)
{
USERDICTIONARY UDict;

UDict.pszFileName = NULL;
UDict.pszDefSection = NULL;

// creates new user dictionary in memory
L_INT nRet = L_DocSetUserDictionary(hDoc, &UDict, TRUE);
if (nRet == SUCCESS)
{
L_CHAR * pszSectName = "cities";
L_WCHAR * pwcItem1 = L"Peabody";
L_WCHAR * pwcItem2 = L"Budapest";

L_DocAddItemToUserDictionary(hDoc, pszSectName, pwcItem1, USER_DICT_LITERAL);
L_DocAddItemToUserDictionary(hDoc, pszSectName, pwcItem2, USER_DICT_LITERAL);

UDict.uStructSize = sizeof(USERDICTIONARY);
UDict.pszFileName = TEXT("USERDIC1.DIC");
UDict.pszDefSection = pszSectName;

nRet = L_DocSetUserDictionary(hDoc, &UDict, FALSE);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The user dictionary is saved into a file."), TEXT("Notice!"), MB_OK);
}
}


L_DocSetZoneOptions

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocSetZoneOptions(hDoc, pZoneOpts)

L_HDOC hDoc; | /* handle to the OCR document */
pAUTOZONEOPTS pZoneOpts; | /* pointer to an AUTOZONEOPTS structure */

Sets Auto zones options for the OCR document engine.

Parameter | Description
hDoc | Handle to the OCR document.
pZoneOpts | Pointer to an AUTOZONEOPTS structure which contains options that will be used in L_DocFindZones.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Sets auto-zoning options in the OCR document engine.

Call L_DocFindZones after setting the auto-zoning options.

To get the current auto zones options, call L_DocGetZoneOptions.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

For an example, refer to L_DocFindZones.


L_DocSetZonePen

#include "ltdoc.h"

HPEN EXT_FUNCTION L_DocSetZonePen(hDoc, hPen)

L_HDOC hDoc; | /* handle to the OCR document */
HPEN hPen; | /* handle to Pen */

Sets the HPEN object to be used when drawing the zones.

Parameter | Description
hDoc | Handle to the OCR document.
hPen | Handle to the HPEN object to be used in drawing the zones.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To draw zones with the page, call L_DocDrawPage.

Call this function before calling L_DocDrawPage function if you need to use new HPEN object for drawing zones.

To specify the HPEN object for the selected zone, call L_DocSetSelectedZonePen. To draw a specific selected zone call L_DocSelectZone or L_DocSelectZoneByPoint.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone
Topics: | OCR Functions: Drawing Zones and Pages
 | Drawing Pages and Zones

Example

For an example, refer to L_DocDrawPage.


L_DocShutDown

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocShutDown(phDoc)

L_HDOC * phDoc;

/* pointer to an existing OCR document handle*/

Shuts down the OCR document engine and frees the allocated OCR document data.

Parameter | Description
phDoc | Pointer to an existing OCR document handle. This handle is obtained by calling L_DocStartUp.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

The OCR document handle is allocated by calling L_DocStartUp.

For each call to L_DocStartUp there must be a call to L_DocShutDown. This function should be the last OCR function to be called in your application. It will clean up and free memory allocated during the OCR session and will close (shut down) the OCR document engine.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocStartUp
Topics: | OCR Functions: Starting and Shutting Down
 | Starting and Shutting Down the Engine

Example

For an example, refer to L_DocStartUp.


L_DocStartUp

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocStartUp(phDoc)

L_HDOC * phDoc;

/* pointer to document handle to be updated */

Starts the OCR document engine and initializes the handle.

Parameter | Description
phDoc | Pointer to a document handle to be updated with the initialized OCR document handle. Use this handle in other OCR functions.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

L_DocStartUp must be called before calling any other LEADTOOLS OCR document toolkit functions.

The user must unlock the OCR document toolkit using the L_UnlockSupport function. If the OCR document toolkit is locked then the L_DocStartUp function will fail and will not initialize the OCR document toolkit.

This function will load and start the OCR document engine. When the handle to the OCR document is no longer needed, it should be freed by calling L_DocShutDown. For every call to L_DocStartUp there must be an associated call to L_DocShutDown.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocShutDown
Topics: | OCR Functions: Starting and Shutting Down
 | Starting and Shutting Down the Engine

Example

L_HDOC hDoc;

L_INT TestOCR(L_TCHAR L_FAR * pszSettingFile)
{
L_INT nRet = SUCCESS;

nRet = L_DocStartUp(&hDoc);
if (nRet != SUCCESS)
return nRet;

/* Unlock OCR support.
Note that this is a sample key, which will not work in your toolkit. */
L_UnlockSupport (L_SUPPORT_OCR, TEXT("TestKey"));

L_DocLoadSettings(hDoc, pszSettingFile);

FILLMETHOD fm;
nRet = L_DocGetFillMethod(hDoc, &fm);
if (nRet == SUCCESS)
{
if (fm != FILL_HANDPRINT)
L_DocSetFillMethod(hDoc, FILL_HANDPRINT);
}

nRet = L_DocSaveSettings (hDoc, pszSettingFile);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The engine saved the updated settings to a file."), TEXT("Notice!"), MB_OK);
else
MessageBox(NULL, TEXT("The engine couldn't save the updated settings to a file."), TEXT("Error!"), MB_OK);

L_DocShutDown (&hDoc);
return SUCCESS;
}


L_DocUnlockPage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocUnlockPage(hDoc, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */

Unlocks the specified locked page.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page to be unlocked. This index is zero-based.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Unlocks the specified locked page.

Before updating the page’s bitmap, you must lock it by calling L_DocLockPage.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone, L_DocUpdatePage
Topics: | OCR Functions: Pages
 | Working with Pages

Example

For an example, refer to L_DocUpdatePage.


L_DocUpdatePage

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocUpdatePage(hDoc, pBitmap, nPageIndex)

L_HDOC hDoc; | /* handle to the OCR document */
pBITMAPHANDLE pBitmap; | /* pointer to the bitmap handle*/
L_INT nPageIndex; | /* page position */

Updates the current page with a new bitmap.

Parameter | Description
hDoc | Handle to the OCR document.
pBitmap | Pointer to the bitmap handle that references the new page to be updated into the internal OCR list of pages.
nPageIndex | Index of the page to be updated. This is a zero-based index.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Use this function to update a page’s content after applying any image processing function(s).

For Example, if you flip your page using L_FlipBitmap , then you should update the OCR page by calling this function.

You must lock the page to be updated by calling L_DocLockPage before calling this function, and should unlock the page by calling L_DocUnlockPage after the update is complete.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddPage, L_DocGetPageCount, L_DocRemovePage, L_DocExportPage, L_DocGetPageInfo, L_DocLockPage, L_DocUnlockPage
Topics: | OCR Functions: Pages
 | Working with Pages

Example

void TestUpdatePage(L_HDOC hDoc, L_INT nPageIndex, pBITMAPHANDLE pBitmap)
{
L_DocLockPage (hDoc, nPageIndex);

L_INT nRet = L_DocUpdatePage(hDoc, pBitmap, nPageIndex);
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("An error occurred during L_DocUpdatePage."), TEXT("Error!"), MB_OK);
else
MessageBox(NULL, TEXT("The specified page is updated."), TEXT("Notice!"), MB_OK);

L_DocUnlockPage (hDoc, nPageIndex);
}


L_DocUpdateZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocUpdateZone(hDoc, nPageIndex, nZoneIndex, pZoneData);

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_INT nZoneIndex; | /* zone index */
pZONEDATA pZoneData; | /* pointer to a ZONEDATA structure */

Updates the zone data of a single zone in the zone list.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Specifies the index of the page that contains the zone to be updated. This is a zero-based index.
nZoneIndex | Specifies the index of the zone to be updated. This is a zero-based index.
pZoneData | Pointer to the ZONEDATA structure that contains information used to update the zone.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

When adding a zone, the application should directly initialize the following members of ZONEDATA structure, since these members will not take their default values:

uStructSize
rcArea
FillMethod
CharFilter
Type
RecogModule

The application should not modify the ID zone member, except for OMR zones using the "filled-in-error" facility.

The Type member of the ZONEDATA structure should be one of the following values:

ZONE_FLOWTEXT

ZONE_TABLE

ZONE_GRAPHIC

The index of the first zone in the zone list is zero (0).

To update only the zone area, call L_DocZone.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Zones
 | Working with Zones

Example

For an example, refer to L_DocGetZone.


L_DocZone

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocZone(hDoc, nPageIndex, nZoneIndex, lpArea)

L_HDOC hDoc; | /* handle to the OCR document */
L_INT nPageIndex; | /* page index */
L_INT nZoneIndex; | /* zone index */
LPRECT lpArea; | /* pointer to a RECT structure */

Updates the specified zone area.

Parameter | Description
hDoc | Handle to the OCR document.
nPageIndex | Page index. This index is zero-based.
nZoneIndex | Zone index that will be updated. This index is zero-based.
lpArea | Pointer to the Windows RECT structure which contains the new zone area.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

Updates the specified zone area in the specified page.

To update general zone information, call L_DocUpdateZone.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocDrawPage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone
Topics: | OCR Functions: Zones
 | Drawing Pages and Zones

Example

void UpdateSelectedZone(L_HDOC hDoc, HWND hWnd)
{
HDC hdc = GetDC(hWnd);
L_INT nSelZone;
POINT pt;

pt.x = 100;
pt.y = 100;

L_INT nRet = L_DocSelectZoneByPoint(hDoc, hdc, 0, pt, &nSelZone);
if (nRet == SUCCESS)
{
ZONEDATA ZoneData;

memset(&ZoneData, 0, sizeof(ZONEDATA));

// gets the zone data for the current selected zone...
nRet = L_DocGetSelectedZone(hDoc, 0, &ZoneData, sizeof(ZONEDATA));
if (nRet == SUCCESS)
{
// update the area for the current selected zone...

ZoneData.rcArea.left += 10;
ZoneData.rcArea.top += 10;
ZoneData.rcArea.right += 50;
ZoneData.rcArea.bottom += 50;
nRet = L_DocZone(hDoc, 0, nSelZone, &ZoneData.rcArea);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The selected zone area is updated."), TEXT("Notice!"), MB_OK);
}

ReleaseDC(hWnd, hdc);
}
}


ENUMOUTPUTFILEFORMATS Function

#include "ltdoc.h"

L_INT pEXT_FUNCTION YourFunction(Format, pUserData)

FORMAT_TYPE Format; | /* format type */
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Enumerates the available file formats. The address of this callback is passed as an argument to L_DocEnumOutputFileFormats.

Parameter | Description
Format | Specifies the output format that is available in OCR document engine.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of L_DocEnumOutputFileFormats.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

To get all available output formats, call L_DocEnumOutputFileFormats. Pass the address of your callback function of ENUMOUTPUTFILEFORMATS to pfnCallback parameter.

To get extra information about any format, call L_DocGetTextFormatInfo.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocRecognize, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocEnumOutputFileFormats
Topics: | Recognizing Document Pages
 | OCR Functions: Callbacks

Example

For an Example, refer to L_DocEnumOutputFileFormats.


PROGRESSCALLBACK Function

#include "ltdoc.h"

L_BOOL pEXT_CALLBACK YourFunction(pProgressData, pUserData)

pPROGRESSDATA pProgressData; | /* pointer to PROGRESSDATA structure */
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Reports the progress of a specific operation and offers the client an opportunity to cancel. The address of this callback is passed as an argument to L_DocSetProgressCB.

Parameter | Description
pProgressData | Pointer to a PROGRESSDATA structure that contains progress data for the current process.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of L_DocSetProgressCB.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

TRUE | The function was successful. Continue processing.
FALSE | An error occurred or the user cancelled.

Comments

This function is called periodically by the OCR engine.

To activate the progress callback function, call L_DocSetProgressCB.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocSetProgressCB.
Topics: | Starting and Shutting Down the Engine
 | OCR Functions: Callbacks

Example

For an Example, refer to L_DocSetProgressCB.


RECOGNIZESTATUSCALLBACK Function

#include "ltdoc.h"

L_INT pEXT_FUNCTION YourFunction(nRecogPage, nError, pUserData)

L_INT nRecogPage; | /* recognized page index */
L_INT nError; | /* error code for the last recognized page */
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Reports the recognized page status.

Parameter | Description
nRecogPage | Specifies the index for the recognized page. This index is zero-based.
nError | Specifies the error that will be returned from the recognition process.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of L_DocRecognize function.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This callback will be invoked after recognizing each page. It will report the recognized page index with the error code (status) that was returned from the recognition process.

This callback will be invoked by a call to L_DocRecognize.

If this callback function return an error code < SUCCESS, the recognition process will be terminated, and no more pages will be processed.

Return SUCCESS from this callback to continue the recognition process.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocGetStatus, L_DocSaveResultsToMemory, L_DocFreeMemoryResults, L_DocSetRecognitionResultOptions, L_DocGetRecognitionResultOptions, L_DocEnumOutputFileFormats, L_DocGetTextFormatInfo, L_DocSaveResultsToFile, L_DocSetSpecialChar, L_DocGetSpecialChar, L_DocGetRecognizedCharacters, L_DocSetRecognizedCharacters, L_DocFreeRecognizedCharacters, L_DocRecognize
Topics: | Recognizing Document Pages
 | OCR Functions: Callbacks

Example

For an Example, refer to L_DocRecognize.


VERIFICATIONCALLBACK Function

#include "ltdoc.h"

L_INT pEXT_FUNCTION YourFunction(nZoneIndex, pszWord, pVerify, pUserData)

L_INT nZoneIndex; | /* zone index */
L_TCHAR L_FAR * pszWord; | /* string contains suggested word */
VERIFYCODE * pVerify; | /* pointer to be updated */
L_VOID L_FAR * pUserData; | /* pointer to additional parameters */

Reports the suggested word for the last recognized word in a specific zone.

Parameter | Description
nZoneIndex | Specifies the index of the zone that contains the recognized word.
pszWord | Character string that contains the suggested word for the recognized word.
pVerify | Pointer to be updated with user verification answer for the suggested word.
pUserData | A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData member of ZONEDATA structure.)
 | Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

SUCCESS | The function was successful.
< 1 | An error occurred. Refer to Return Codes.

Comments

This callback reports the suggested word of the recognized word in a zone.

This callback will be called during the recognition process.

To enable this callback, call L_DocAddZone or L_DocUpdateZone, and pass your callback function in the pfnCallback member of the ZONEDATA structure.

When calling L_DocRecognize, set the bEnableSubSystem and bEnableCorrection members of the RECOGNIZEOPTS structures to TRUE.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions: | L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocFindZones, L_DocSetZoneOptions, L_DocGetZoneOptions
Topics: | OCR Functions: Callbacks

Example

For an Example, refer to L_DocAddZone.


Raster Pro/Document/Medical Features

Raster Pro:

LEADTOOLS Raster Imaging Pro provides some imaging capabilities that are not available in the LEADTOOLS Raster Imaging product. In order to access these features, you must unlock them by calling L_UnlockSupport(L_SUPPORT_LTPRO, L_KEY_LTPRO). L_KEY_LTPRO can be found in ltkey.h.

If you are a licensed user of LEADTOOLS Raster Imaging, and would like to access Raster Imaging Pro features, you must contact Tech Support for information on obtaining a license and the unlock key for calling L_UnlockSupport.

Document/Medical:

LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite are the most comprehensive imaging toolkits on the market. No other toolkit provides as many imaging features for color, gray-scale and black & white images in one development package, and for one price. These toolkits comprise LEAD's best code and are designed for the programmer who is looking for the fastest performance, and/or the most extensive color, document, and medical imaging capabilities available.

These toolkits contain powerful annotation capabilities and optimized document image processing filters, and high performance compression, decompression and viewing of JPEG, LEAD CMP, MRC and CCITT G3/G4. The annotation capabilities enable the programmer to add text, highlights, sticky notes, audio, ellipses, buttons, lines, arrows, rectangles, polygons, redaction (blackout), hotspots, freehand scribble, pointers, bitmap and text stamps, to black & white and color images. Programmers working with document imaging will also find special processing filters such as despeckle, deskew, favor black, and scale to gray to enhance their black and white 1 bit images. Additionally, you can achieve faster rotation in 90-degree increments by applying a rotated view perspective to the bitmap. These LEADTOOLS toolkits offer the fastest software-only JPEG decoder available.

LEADTOOLS Document Imaging

The LEADTOOLS Document Imaging toolkit contains all the features available in the LEADTOOLS Raster Imaging Pro. In addition, it contains the following capabilities:

Special functions for Document (bitonal) images. The LEADTOOLS functions for bitonal images are especially useful for working with images from black-and-white scanners or FAX machines. These functions let you do things such as automatically straighten (deskew) an image, remove spots (despeckle), or clarify a scaled display (using scale-to-gray and favor-black features).

Annotation. LEADTOOLS supports annotation of images by letting you overlay images with text, lines, shapes, arrows, buttons, highlights, hot spots, sticky notes, stamps, buttons, and sounds.

Fast rotation. LEADTOOLS achieves fast rotation in 90-degree increments by applying a rotated view perspective to the bitmap.

ISIS support. LEADTOOLS supports ISIS interfaces for driving scanning devices.

Faster compression and decompression. The Document/Medical editions work faster when loading and saving LEAD CMP, JPEG, and CCITT Group 3 and Group 4 images. The LEADTOOLS functions for loading and saving are the same in all products. The only difference is in performance.

1-bit Image Clean-up. The Document toolkits include support for removing dots, blobs, holes, inverted text, lines, borders, bumps and nicks from 1-bit images.

Region Clean-up. [Document/Medical] Remove all the holes from a region.

Embedded Messages. The Document toolkits include support for embedding messages in lossless image formats like bmp, tiff, lossless jpeg, etc. The message is embedded without any visible changes to the image, and does not appreciably increase the size of the image. The message is password-protected.

Image Conversion. The Document toolkits include support for transforming a bitmap into a binary image using specified thresholds or a threshold calculated automatically based on statistical features of the bitmap.

12 and 16 bit grayscale images. [Document/Medical] Load, process, display, window level and save 12 and 16 bit grayscale images (including support for 16-bit grayscale TIFF).

48 and 64 bit color images. [Document/Medical] Load, process, display, and save 48 and 64 bit color images.

MRC Support. [Document/Medical] LEADTOOLS supports the Mixed Raster Content format for color documents containing mixed image and text components. For more information, refer to the .

Halftoning. [Document/Medical] Convert 1-, 4-, 8-, 16-, 24-, or 32-bit bitmaps to a halftoned bitmap, with a specified pattern rotation. A halftoned bitmap is a 1-bit bitmap that has been dithered for black and white printing or display.

LEADTOOLS Document Imaging Suite

The LEADTOOLS Document Imaging Suite toolkit contains all the capabilities of LEADTOOLS Document Imaging, and includes the features listed below. Please note that the OCR features are included in this toolkit, however they can also be purchased as a plug-in for the LEADTOOLS Document Imaging toolkit. Also, JBIG support is provided in this toolkit, however a JBIG Module may be added on to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite.

OCR features. [Document/Medical] LEAD offers OCR features that use Scansoft Textbridge technology. Support for these features is included in the LEADTOOLS Document Imaging Suite, and can be added, via plug-in to the LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite toolkits. The OCR features allow you to perform optical character recognition and turn images into documents. Features include preset confidence and accuracy levels for controlling how sensitive the engine is to unrecognized text, artificial intelligence for improving recognition on documents of the same type, and built-in and user-defined lexicons for limiting the type of text to recognize within a particular zone. LEADTOOLS provides the ability to verify or correct text during, and (using LEAD's unique OCR editor) after recognition. LEAD's OCR editor ties the text being edited directly to the image, providing a visual reference to the original bitmap data. The OCR engine can perform Automatic area segmentation creating multi-layered zones, recognizing areas such as tables, rules, images and text. Or, you can manually designate up to 250 such zones. The OCR features support different fonts, sizes (5 to 72 point) and styles. Fax, dot matrix and halftones can be preprocessed to improve recognition results. The OCR Engine supports major European and Scandinavian languages (Danish, Dutch, Finnish, French, German, Italian, Norwegian, Portuguese, Russian, Spanish, and Swedish) as well as English. Support for dialects such as US. English, French Canadian, Latin American Spanish, Swiss German, and Brazilian Portuguese is also provided.

Recognized text can be exported to more than 40 different formats, including MS Word, MS Excel, Dbase andWordPerfect. The LEADTOOLS OCR features contain superior OCR processing speeds, for use in form recognition and processing applications.

LEAD's JBIG filter. [Document/Medical] LEAD includes support for this filter in the LEADTOOLS Document Imaging Suite toolkit. Support for this filter can be added to LEADTOOLS Document Imaging, LEADTOOLS Medical Imaging or LEADTOOLS Medical Imaging Suite by purchasing the JBIG Module. JBIG defines a method for lossless compression encoding of a bi-level image (two-color image). This method can also be used for coding grayscale and color images. LEADTOOLS completely supports all three types of images, giving you the ability to make full use of this powerful compression technology. LEADTOOLS also supports the progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead.

LEADTOOLS Medical Imaging

LEADTOOLS Medical Imaging contains all the capabilities of LEADTOOLS Document Imaging. It also includes general medical imaging technologies (1-16,24,32 bit color, 1-16 bit grayscale and window leveling of 12 and 16-bit grayscale images) and support for the DICOM file format.

DICOM file support. [Medical] LEADTOOLS Medical Imaging provides COMPLETE support for the DICOM 3.0 specification, including all standard IOD classes and modalities (CR, CT, MR, NM, US, RF, SC, VL, etc.) and complete DICOM Basic Directory support.

Window leveling. [Document/Medical] Detect and set LowBit and HighBit for image data, display images with automatic LUT intensity expansion, or set LUT entries and ranges with specific values and gradients. Display images through the LUT without changing the data, or process the image data using the LUT. Linearize the number of pixels locally in a bitmap, based on the specified color space in order to bring out the detail in dark areas of an image, and smooth the edges between blocks.

Medical Imaging Processing. [Medical] LEADTOOLS Medical Imaging provides image processing functionality designed specifically to allow you to examine and improve the quality of medical images.

LEADTOOLS Medical Imaging Suite

LEADTOOLS Medical Imaging Suite contains all the capabilities of LEADTOOLS Medical Imaging. In addition, it supports the following:

DICOM Communication support. [Medical Suite] LEADTOOLS provides COMPLETE support for DICOM Communications, including all Service Classes (Verification, Storage, Query/Retrieve, Patient Management, etc), and contains high-level communications functions simplifying the creation of DICOM client/server applications.

(Document/Medical) is used in the documentation to designate the features that are available in LEADTOOLS Document Imaging, LEADTOOLS Document Imaging Suite, LEADTOOLS Medical Imaging and LEADTOOLS Medical Imaging Suite. Those features that are available only in the Medical toolkits are indicated in the documentation by (Medical). Features available only in the LEADTOOLS Medical Imaging Suite toolkit are indicated in the documentation by (Medical Suite).

(Internet only) is used in the documentation to designate the features that are available only in the LEADTOOLS Internet toolkit.

For more information, refer to Document/Medical Edition Support and Licensing Requirements .


LEADTOOLS Reference Manuals

LEADTOOLS provides reference manuals that contain the same information as the online help. You can print them from PDF files. Please note that due to the large size of the PDF files that contain the LEADTOOLS manuals, these files are no longer included in the setup. Instead, these PDF files can be downloaded from our website at http://support.leadtools.com/SupportPortal/DesktopDefault.aspx?tabindex=3&tabid=27.

To print the PDF files, you must use the Adobe Acrobat Reader 3.0 or higher. You can download a copy of the Acrobat Reader from the Adobe web site (http://www.adobe.com). Note that different versions of the Acrobat Reader are available for different operating systems, but they all can read the same PDF files.


Topic Selection

LEAD Technologies, Inc.
1201 Greenwood Cliff, Suite 400
Charlotte, NC 28204

Sales@Leadtools.com
www.leadtools.com

(704) 332-5532
FAX: (704) 372-8161
Tech Support: (704) 372-9681

LEADTOOLS is ideal for developers involved in still frame, multimedia, document, medical, and vector imaging projects, including Internet/Intranet applications. Independent of the specific application requirement – scanning, file format support/conversion, compression, image processing, annotation, database support, multimedia, etc. – LEADTOOLS provides the most comprehensive, robust, flexible, and powerful imaging solution available.

Click this button to start the Licensing help file to review the License Agreements governing your use of the software.

Click this button to start the Products help file to review the full line of LEADTOOLS Products.

Click this button to start the Imaging help file to review the full line of LEADTOOLS Image Categories.