RecAPI
|
General operations and data. More...
Topics | |
Error Handling Module | |
Error information. | |
Settings Manager Module | |
This is the manager of settings at the KernelAPI level. | |
Profile Module | |
Profile handling for setting the environment according to each workflow. | |
Classes | |
struct | KRECMODULEINFO |
Module info. More... | |
struct | PROGRESSMONITOR |
Progress information. More... | |
Typedefs | |
typedef KRECMODULEINFO * | LPKRECMODULEINFO |
Pointer to a structure KRECMODULEINFO. | |
typedef PROGRESSMONITOR * | LPPROGRESSMONITOR |
Pointer to a PROGRESSMONITOR. | |
typedef RECERR RECKRNCALL | PROGMON_CB(LPPROGRESSMONITOR mod, void *pContext) |
The user-written progress monitoring callback function. | |
typedef PROGMON_CB * | LPPROGMON_CB |
Pointer to a callback PROGMON_CB. | |
Enumerations | |
enum | KRECMODULES { INFO_API = 0 , INFO_MOR , INFO_DOT , INFO_BAR , INFO_OMR , INFO_HNR , INFO_DCM , INFO_IMG , INFO_IMF , INFO_CHR , INFO_DTXT , INFO_SPL , INFO_RSD , INFO_RER , INFO_MGR , INFO_MTX , INFO_MAT , INFO_RESERVED_P , INFO_PLUS2W , INFO_FRX , INFO_PLUS3W , INFO_ASN , INFO_XOCR , INFO_LFR , INFO_ASP , INFO_ARA , INFO_SIZE } |
Module identifiers. More... | |
enum | PROCESSID { PID_IMGINPUT = 0 , PID_IMGSAVE , PID_IMGPREPROCESS , PID_DECOMPOSITION , PID_RECOGNITION1 , PID_RECOGNITION2 , PID_RECOGNITION3 , PID_SPELLING , PID_FORMATTING , PID_WRITEFOUTDOC , PID_CONVERTIMG , PID_SCANNER_WARMUP } |
Progress identifiers. More... | |
Functions | |
RECERR RECAPIKRN | kRecSetLibraryPath (LPCTSTR libpath) |
Setting the path of the library files. | |
RECERR RECAPIKRN | kRecSetDataPath (LPCTSTR datapath) |
Setting the path of the data files. | |
RECERR RECAPIKRN | kRecSetSandboxHomePath (const char *homepath) |
Setting the Sandbox path on MacOS. | |
RECERR RECAPIKRN | kRecSetSandboxTempPath (const char *temppath) |
Setting the Sandbox temporary path on MacOS. | |
RECERR RECAPIKRN | kRecSetLicense (LPCTSTR pLicenseFile, LPCTSTR pCode) |
Setting the OEM license information. | |
RECERR RECAPIKRN | kRecInit (LPCTSTR pCompanyName, LPCTSTR pProductName) |
Initializing KernelAPI. | |
RECERR RECAPIKRN | kRecQuit (void) |
Closing KernelAPI. | |
RECERR RECAPIKRN | kRecSetUILang (const char *lang) |
Setting the language of displayed information. | |
RECERR RECAPIKRN | kRecGetUILang (char *langbuff, size_t buffersize) |
int RECAPIKRN | kRecCreateSettingsCollection (int sid) |
Creating a new Settings Collection. | |
RECERR RECAPIKRN | kRecDeleteSettingsCollection (int sid) |
Deleting a Settings Collection. | |
RECERR RECAPIKRN | kRecGetSerialNumber (LPTSTR pSn, size_t buflen) |
int RECAPIKRN | kRecGetVersion (void) |
Getting version. | |
RECERR RECAPIKRN | kRecSetCBProgMon (int sid, LPPROGMON_CB pCallBack, void *pContext) |
Setting progress monitor. | |
RECERR RECAPIKRN | kRecSetTimeOut (int sid, DWORD TimeOut) |
Setting timeout period. | |
RECERR RECAPIKRN | kRecGetTimeOut (int sid, LPDWORD pTimeOut) |
Getting timeout period. | |
RECERR RECAPIKRN | kRecFree (void *pArray) |
Freeing memory objects. | |
RECERR RECAPIKRN | kRecGetModulesInfo (LPKRECMODULEINFO *ppModules, size_t *pSize) |
Getting module information. | |
RECERR RECAPIKRN | kRecLoadSettings (int sid, LPCTSTR pFileName) |
Loading settings. | |
RECERR RECAPIKRN | kRecSaveSettings (int sid, LPCTSTR pFileName) |
Saving settings of KernelAPI. | |
RECERR RECAPIKRN | kRecSetDefaults (int sid) |
Changing settings of KernelAPI to default. | |
RECERR RECAPIKRN | kRecSetIntSetting (int sid, LPCTSTR setting, int new_value) |
Setting the value of an STS_INT or STS_ENUM or STS_BOOL setting. | |
RECERR RECAPIKRN | kRecGetIntSetting (int sid, LPCTSTR setting, int *the_value) |
Accessing the current value of an STS_INT or STS_ENUM or STS_BOOL setting. | |
RECERR RECAPIKRN | kRecSetDoubleSetting (int sid, LPCTSTR setting, double new_value) |
Setting the value of an STS_DOUBLE setting. | |
RECERR RECAPIKRN | kRecGetDoubleSetting (int sid, LPCTSTR setting, double *the_value) |
Accessing the current value of an STS_DOUBLE setting. | |
RECERR RECAPIKRN | kRecSetStringSetting (int sid, LPCTSTR setting, LPCTSTR new_value) |
Setting the value of an STS_STRING or STS_USTRING setting. | |
RECERR RECAPIKRN | kRecGetStringSetting (int sid, LPCTSTR setting, LPTSTR *the_value) |
Accessing the current value of an STS_STRING or STS_USTRING setting. | |
General operations and data.
This module contains the basic types and functions necessary to use the general services of the KernelAPI. Initialization (kRecInit, kRecQuit) is an essential prerequisite for utilizing KernelAPI functionality. User authorization can also be performed in this module.
Useful information can be got about itself the Engine (e.g. accessible modules by kRecGetModulesInfo).
Most RecAPI operations work through Settings Collections. A Settings Collection acts as a kind of profile. It is a separate storage for operation settings (handled by Settings Manager Module). Distinct Settings Collections can store different values for given settings. A Settings Collection is authorized by an identifier. This identifier must be passed to all operations using that Settings Collection. The Collection with the ID 0 is cretaed automatically during the initialization of the Capture SDK. Settings Collections can be user-created or deleted, using the functions kRecCreateSettingsCollection, kRecDeleteSettingsCollection, respectively. You can also save or load settings here.
The same Settings Collections can be used from different threads. (Multi-threading is supported on: Windows, Linux.) Furthermore, one thread can use more than one Settings Collection. For more information, see the topic Multi-threading in RecAPI.
Kernel.Timeout.Hard is an additional amount of time over the normal Kernel.Timeout time. The addition of the two values provides a hard timeout limit. This is designed this way in order to have a single kRecSetTimeOut call effectively change both the normal and hard timeout values. By default the hard timeout setting adds 10 seconds to the normal one.
Normally the timeout is checked at clean processing places inside recognition. If the engine detects that the normal timeout limit has been passed, it returns API_TIMEOUT_ERR if it can safely and cleanly return from the middle of a long recognition before the hard timeout is reached. If it cannot then a separate thread terminates the possible infinite loop when the additional hard timeout period is over and the engine returns API_HARDTIMEOUT_ERR. In this case the engine might be in an unstable state so further normal functioning is not guaranteed. We suggest that the user terminates and restarts the process to be in a clean state again.
See also timeout handling in the tutorial.
typedef RECERR RECKRNCALL PROGMON_CB(LPPROGRESSMONITOR mod, void *pContext) |
The user-written progress monitoring callback function.
This user-written callback procedure for progress monitoring must be registered by the kRecSetCBProgMon function. The Engine will continually invoke this registered callback procedure during different workflow processes (PROCESSID), providing a pointer to a PROGRESSMONITOR structure that contains the current processing stage and a percentage indicator value. The application can provide progress indication for this procedure.
[in] | mod | This variable holds the current state of the activated action (ProcessID, progress information etc). |
[in] | pContext | User data passed to the callback function by the Engine. The data to be passed can be set with kRecSetCBProgMon. |
API_PROCESS_ABORTED_ERR | The user has requested the current processing to be aborted: processing will stop at the first suitable moment. |
REC_OK | Process can be continued normally. |
enum KRECMODULES |
Module identifiers.
Use the kRecGetModulesInfo function to get information on the current Engine configuration.
enum PROCESSID |
Progress identifiers.
Identifiers of the most important internal processes of the Engine, such as image loading, image saving, recognizing, etc. Each process listed below represents one of the fundamental services provided by the Engine. Applications will use one or more of these processes. Each process can be initiated by the relevant function (see below). The PROGMON_CB callback function can be used to generate progress monitoring for any of these processes.
kRecSetXX
and kRecGetXX
),Enumerator | |
---|---|
PID_IMGINPUT | Identifies the Image loading process. The source can be the scanner, image file or image stored in the application buffer (application memory); kRecLoadImg, kRecLoadImgF. |
PID_IMGSAVE | Identifies the image saving process. During this process the image or a part of it is saved to an image file; kRecSaveImg. |
PID_IMGPREPROCESS | Identifies the Image preprocessing process; kRecPreprocessImg. |
PID_DECOMPOSITION | Identifies the page-layout decomposition process; kRecLocateZones. |
PID_RECOGNITION1 | Identifies the 1st pass of the Recognition process; kRecRecognize. |
PID_RECOGNITION2 | Identifies the 2nd pass of the Recognition process; kRecRecognize using recognition engine PLUS2W or PLUS3W. |
PID_RECOGNITION3 | 3rd pass of the Recognition process using recognition engine PLUS3W. |
PID_SPELLING | Identifies the Checking process. |
PID_FORMATTING | Page and Document formatting. |
PID_WRITEFOUTDOC | Identifies the process for writing the recognized text to the final output document (to file or to memory); RecConvert2Doc. |
PID_CONVERTIMG | Identifies the image conversion process activated by the PID_WRITEFOUTDOC process for saving the image of a graphical image zone to the word processor output document; RecConvert2Doc. |
PID_SCANNER_WARMUP | scanner is warming up. |
int RECAPIKRN kRecCreateSettingsCollection | ( | int | sid | ) |
Creating a new Settings Collection.
A Settings Collection is a container of the values of all settings of all modules of KernelAPI/APIPlus. See the settings API in KrnStsApi.h
. All functions that have an effect on settings or are affected by settings receive a Settings Collection ID in the parameter list.
[in] | sid | The parent collection. If it is -1, the new collection will contain the settings with their default values. If it is the ID of an already existing collection, the values will be copied from it. |
int | ID of the created Settings Collection. -1 means CSDK cannot create new Settings Collection. The upper limit of the number of Settings Collections is 1000, however CSDK cannot create a new one also after kRecQuit (or before kRecInit). |
RECERR RECAPIKRN kRecDeleteSettingsCollection | ( | int | sid | ) |
Deleting a Settings Collection.
The kRecDeleteSettingsCollection function deletes the specified collection.
[in] | sid | Settings Collection ID. |
RECERR |
RECERR RECAPIKRN kRecFree | ( | void * | pArray | ) |
Freeing memory objects.
The kRecFree function frees the memory object previously made available to the application with the assistance of a KernelAPI function.
[in] | pArray | Pointer to the data to be released. |
RECERR |
pArray
could be a pointer retrieved by any of the following functions: kRecGetLetters, kRecGetChoiceStr, kRecGetSuggestionStr, kRecGetFontFaceStr, kRecGetLetterPalette, kRecGetOCRZoneText, kRecGetOCRTableCellText, kRecGetImgArea, kRecGetImgAreaEx, kRecRotateImgArea, kRecRemovePunchHoles, kRecGetZoneLayout, kRecGetOCRZoneLayout, kRecGetZoneNodeArray, kRecGetOCRZoneNodeArray, kRecGetHSplitters, kRecGetVSplitters, kRecGetCombCells, kRecGetZoneName, kRecGetOCRZoneName, kRecGetCellName, kRecGetOCRCellName, kRecGetZoneAttribute, kRecGetOCRZoneAttribute, kRecGetNextZoneAttribute, kRecGetNextOCRZoneAttribute, kRecGetZoneFormFieldName, kRecGetOCRZoneFormFieldName, kRecGetFormTemplateName, kRecGetTemplateAttribute, kRecGetNextTemplateAttribute, kRecGetAnchorText, kRecGetAnchorRegExp, kRecGetFindFormTemplateInfo, kRecGetMatchingInfo, kRecGetOCRZoneFormRecognitionState, kRecClassifyPage, kRecClassifyText, kRecClassifyDocument, kRecConvertUnicode2CodePageEx, kRecConvertCodePage2UnicodeEx, kRecGetStringSetting, kRecGetLastErrorEx. RECERR RECAPIKRN kRecGetDoubleSetting | ( | int | sid, |
LPCTSTR | setting, | ||
double * | the_value ) |
Accessing the current value of an STS_DOUBLE setting.
This function gets the value of the named double setting in the given Settings Collection.
[in] | sid | Settings Collection ID. |
[in] | setting | Name of the setting. |
[out] | the_value | Address of a variable to get the value of the setting. |
RECERR |
RECERR RECAPIKRN kRecGetIntSetting | ( | int | sid, |
LPCTSTR | setting, | ||
int * | the_value ) |
Accessing the current value of an STS_INT or STS_ENUM or STS_BOOL setting.
This function gets the value of the named integer, enum or boolean setting in the given Settings Collection.
[in] | sid | Settings Collection ID. |
[in] | setting | Name of the setting. |
[out] | the_value | Address of a variable to get the value of the setting. |
RECERR |
RECERR RECAPIKRN kRecGetModulesInfo | ( | LPKRECMODULEINFO * | ppModules, |
size_t * | pSize ) |
Getting module information.
The kRecGetModulesInfo function obtains information about the available modules of Engine.
[in] | ppModules | Address of a pointer to the module information array. |
[in] | pSize | Address of a variable holding the number of module information structures. |
RECERR |
RECERR RECAPIKRN kRecGetSerialNumber | ( | LPTSTR | pSn, |
size_t | buflen ) |
The kRecGetSerialNumber function is used to learn the serial number string of the OmniPage CSDK v2025.1. The Serial number is unique for each OmniPage CSDK v2025.1 package.
[out] | pSn | Pointer to a buffer containing the serial number string. |
[in] | buflen | Size of the buffer. |
RECERR |
RECERR RECAPIKRN kRecGetStringSetting | ( | int | sid, |
LPCTSTR | setting, | ||
LPTSTR * | the_value ) |
Accessing the current value of an STS_STRING or STS_USTRING setting.
This function gets the value of the named string setting in the given Settings Collection.
[in] | sid | Settings Collection ID. |
[in] | setting | Name of the setting. |
[out] | the_value | Address of a pointer to a string which is allocated and filled by this function. The allocated memory must be released with kRecFree. |
RECERR |
RECERR RECAPIKRN kRecGetTimeOut | ( | int | sid, |
LPDWORD | pTimeOut ) |
Getting timeout period.
The kRecGetTimeOut function gets the timeout period.
[in] | sid | Settings Collection ID. |
[out] | pTimeOut | Time out period in milliseconds. |
RECERR |
RECERR RECAPIKRN kRecGetUILang | ( | char * | langbuff, |
size_t | buffersize ) |
The kRecGetUILang function gets the language of message strings.
[out] | langbuff | Contains the ISO/DIS 639-3 3-letter language ID of the UI language with a terminating zero. The default value is the machine's UI language. |
[in] | buffersize | Size of the langbuff buffer. Should be 4 or more. |
RECERR |
int RECAPIKRN kRecGetVersion | ( | void | ) |
Getting version.
The kRecGetVersion function gets the version of RecAPI.
int | The version number. |
RECERR RECAPIKRN kRecInit | ( | LPCTSTR | pCompanyName, |
LPCTSTR | pProductName ) |
Initializing KernelAPI.
The kRecInit function initializes the OmniPage CSDK. Except for (kRecSetLicense, kRecGetVersion) the functions of KernelAPI should not be called before initialization. This function enumerates the modules installed in the Engine Binary directory, determines the configuration of the Engine and initializes its modules. Use this function to implicitly bind the Engine to the application. When this function is used for the Engine initialization, the KernelAPI.lib
(on Windows), libkernelapi.so
(on Linux), or libkernelapi.dylib
(on MacOS) import library must be linked to the application.
[in] | pCompanyName | Name of the User's Company. It can be NULL. Default value on Windows systems: OmniPage , on Linux systems: omnipage , on MacOS: OmniPage . It is used for creating a company-specific working folder for temporary and other files generated by KernelAPI. |
[in] | pProductName | Name of the Product or Application. It can be NULL. Default value on Windows systems: CSDK22 , on Linux systems: csdk-2025.1 , on MacOS: CSDK-2025.1 . It is used for creating an application-specific working folder for temporary and other files generated by KernelAPI. |
RECERR |
RECERR RECAPIKRN kRecLoadSettings | ( | int | sid, |
LPCTSTR | pFileName ) |
Loading settings.
This function loads settings from a settings file into StsMan.
[in] | sid | Settings Collection ID. |
[in] | pFileName | Filename of the setting file to be loaded. |
RECERR |
RECERR RECAPIKRN kRecQuit | ( | void | ) |
Closing KernelAPI.
The kRecQuit function stops the OmniPage CSDK. It frees all the resources allocated by the Engine.
RECERR |
kRecQuit
removes all the Settings Collections, pending and user settings, and sets the remaining settings to default, so the setting states are the same after every subsequent kRecQuit - kRecInit
pair. In previous versions of CSDK the kRecQuit
did not perform these steps, thus after a subsequent kRecInit all the settings existed and had the same value as before the previous kRecQuit
. This behaviour can be simulated in CSDK v16 or later doing a workaround: Before kRecQuit:
kRecInit:
RECERR RECAPIKRN kRecSaveSettings | ( | int | sid, |
LPCTSTR | pFileName ) |
Saving settings of KernelAPI.
This function saves the settings.
[in] | sid | Settings Collection ID. |
[in] | pFileName | File name of the setting file to be saved. |
RECERR |
NULL
for root HSETTING
with a FALSE save-all and a FALSE append parameter. kRecSaveSettings
is only for compatibility. RECERR RECAPIKRN kRecSetCBProgMon | ( | int | sid, |
LPPROGMON_CB | pCallBack, | ||
void * | pContext ) |
Setting progress monitor.
The kRecSetCBProgMon functions sets the progress monitor callback function. The callback function is implemented by the application.
[in] | sid | Settings Collection ID. |
[in] | pCallBack | Pointer to a function. This function will be called for every progress indication. |
[in] | pContext | This pointer value will be passed to the callback function as the 2nd parameter. |
RECERR |
RECERR RECAPIKRN kRecSetDataPath | ( | LPCTSTR | datapath | ) |
Setting the path of the data files.
There may be some cases, when the library files and the data files cannot be in the same folder (e.g. on Android platform). In such a case this function can be used for specifying the path of the data files.
[in] | datapath | absolute path name of the data path. |
RECERR |
RECERR RECAPIKRN kRecSetDefaults | ( | int | sid | ) |
Changing settings of KernelAPI to default.
This function changes the settings of the KernelAPI (i.e. the subtree under the node "Kernel" of the setting tree) to their default values.
[in] | sid | Settings Collection ID. |
RECERR |
RECERR RECAPIKRN kRecSetDoubleSetting | ( | int | sid, |
LPCTSTR | setting, | ||
double | new_value ) |
Setting the value of an STS_DOUBLE setting.
This function sets the value of the named double setting in the given Settings Collection.
[in] | sid | Settings Collection ID. |
[in] | setting | Name of the setting. |
[in] | new_value | The new value to be set. |
RECERR |
RECERR RECAPIKRN kRecSetIntSetting | ( | int | sid, |
LPCTSTR | setting, | ||
int | new_value ) |
Setting the value of an STS_INT or STS_ENUM or STS_BOOL setting.
This function sets the value of the named integer, enum or boolean setting in the given Settings Collection.
[in] | sid | Settings Collection ID. |
[in] | setting | Name of the setting. |
[in] | new_value | The new value to be set. |
RECERR |
RECERR RECAPIKRN kRecSetLibraryPath | ( | LPCTSTR | libpath | ) |
Setting the path of the library files.
There may be some cases, when the library files and the data files cannot be in the same folder (e.g. on Android platform). In such a case this function may be used for specifying the path of the library files.
[in] | libpath | absolute path name of the library path. |
RECERR |
RECERR RECAPIKRN kRecSetLicense | ( | LPCTSTR | pLicenseFile, |
LPCTSTR | pCode ) |
Setting the OEM license information.
The kRecSetLicense function sets the OEM license information. In the case of an OEM distribution this function must be called before kRecInit.
[in] | pLicenseFile | Name of the license file or the fully qualified path to the license file (an LCX or LCXZ file). This parameter can be NULL if the OEM license file is loaded by OPLicMgr or OmniPage License Agent used, but this functioning is not suggested. |
[in] | pCode | OEM Code string. (It is a pointer to the string itself, not to the file name containing the OEM Code!) |
RECERR |
kRecInit
. NULL
nor a full path file name but a relative path or simply a file name without any path components then the Engine searches for the license file in different directories in the following order:RECERR RECAPIKRN kRecSetSandboxHomePath | ( | const char * | homepath | ) |
Setting the Sandbox path on MacOS.
The kRecSetSandboxHomePath function sets the Sandbox Home path. This function must be called before any other functions.
[in] | homepath | The application's Home path as returned by the NSHomeDirectory function. The string must be converted to UTF-8 by the UTF8String message. |
RECERR |
RECERR RECAPIKRN kRecSetSandboxTempPath | ( | const char * | temppath | ) |
Setting the Sandbox temporary path on MacOS.
The kRecSetSandboxTempPath function sets the Sandbox Temporary path. This function must be called after kRecSetSandboxHomePath and before any other functions.
[in] | temppath | The application's Temporary path as returned by the NSTemporaryDirectory function. The string must be converted to UTF-8 by the UTF8String message. |
RECERR |
RECERR RECAPIKRN kRecSetStringSetting | ( | int | sid, |
LPCTSTR | setting, | ||
LPCTSTR | new_value ) |
Setting the value of an STS_STRING or STS_USTRING setting.
This function sets the value of the named string setting in the given Settings Collection.
[in] | sid | Settings Collection ID. |
[in] | setting | Name of the setting. |
[in] | new_value | The new value to be set. It will be copied into an internal buffer in StsMan. |
RECERR |
RECERR RECAPIKRN kRecSetTimeOut | ( | int | sid, |
DWORD | TimeOut ) |
Setting timeout period.
The kRecSetTimeOut function sets the time out period for different tasks.
[in] | sid | Settings Collection ID. |
[in] | TimeOut | Timeout period in milliseconds. The suggested minimum limit of this setting is 50 milliseconds, but it may be useful to set the timeout higher on server operating systems. |
RECERR |
RECERR RECAPIKRN kRecSetUILang | ( | const char * | lang | ) |
Setting the language of displayed information.
The kRecSetUILang function sets the language of message strings.
[in] | lang | ID of the language. This is any language description string accepted by kRecFindLanguage or kRecFindLanguageEx. Use NULL to reset to the default UI language of the user's machine. |
RECERR |