RecAPI
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Modules Pages
One Step Functions Module

One step functions. RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS. More...

Functions

RECERR RECAPIPLS RecProcessPagesEx (int sid, LPCTSTR pDocFile, LPCTSTR *pImageFiles, LPONETOUCH_CB pCallback, void *pContext)
 Load, Preprocess, Recognize, Format, Export input images.
 
RECERR RECAPIPLS RecGetRPPErrorList (RPPERRORS **rppErrs)
 Getting errors from last RecProcessPagesEx.
 
RECERR RECAPIPLS RecExecuteWorkflow (int sid, LPCTSTR pWFfilename)
 Execute a predefined workflow.
 

Detailed Description

One step functions. RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.

RecAPIPlus has two one-step functions. The RecProcessPagesEx function uses the 1-2-3 workflow from OmniPage 2025.1. It can process multiple image files with multiple pages or it can work from scanner. During the process, it uses all settings as previously set by the application. It does the following in one step: loading, image preprocessing, recognition, page/document formatting, exporting. RecExecuteWorkflow function executes workflow files created by OmniPage 2025.1 and ITest.

One-step functions manage their tasks across multiple threads, striving to achieve the optimal synchronization of the components. For more information about multi-threading see the topic Multi-threading in RecAPI.

Multi-threading is supported on: Windows, Linux only. Thus on other platforms RecExecuteWorkflow is not supported, and RecProcessPagesEx performs a sequential workflow.

See also the details about support of different output formats on different platforms.

Function Documentation

◆ RecExecuteWorkflow()

RECERR RECAPIPLS RecExecuteWorkflow ( int sid,
LPCTSTR pWFfilename )

Execute a predefined workflow.

Workflows can be created using the Workflow Assistant application (AssistantApp.exe) or using the same interface through OmniPage 2025.1 or ITest.

Parameters
[in]sidSettings Collection ID.
[in]pWFfilenameFull path to the workflow file.
Return values
RECERR
Note
The Workflow may interact with the user by means of dialog boxes. These dialogs require a HWND. This HWND can be set with a setting:
HSETTING hSts;
HWND hWnd = Application main HWND or GetDesktopWindow();
kRecSettingGetHandle(NULL, "APIPlus.HWND", &hSts, NULL);
kRecSettingSetInt(0, hSts, (int)hWnd);
RECERR RSTSAPI kRecSettingGetHandle(HSETTING root_of_query, const char *symb_name, HSETTING *ret_handle, INTBOOL *has_setting)
Getting the handle of a node.
RECERR RSTSAPI kRecSettingSetInt(int sid, HSETTING sett, int new_value)
Setting the value of an STS_INT or STS_ENUM or STS_BOOL setting.
struct RECSTSSTRUCT * HSETTING
Handle of a setting.
Definition KrnStsApi.h:287
This function is supported on: Windows.
See details about size limits of input images.
The specification of this function in C# is:
RECERR RecExecuteWorkflow(int sid, string workflowFilename);
RECERR
Error codes.
Definition RECERR_doc.h:19
RECERR RECAPIPLS RecExecuteWorkflow(int sid, LPCTSTR pWFfilename)
Execute a predefined workflow.
.
The specification of this function in Java is:
int RecExecuteWorkflow(int sid, String pWFfilename)
The specification of this function in Python is:
def RecExecuteWorkflow(sid: int, pWFfilename: str) -> int

◆ RecGetRPPErrorList()

RECERR RECAPIPLS RecGetRPPErrorList ( RPPERRORS ** rppErrs)

Getting errors from last RecProcessPagesEx.

The RecGetRPPErrorList function returns the error list of last RecProcessPagesEx call.

Parameters
[out]rppErrsPointer of a variable to store a pointer of an internal array. This array contains data for the errors happened.
Return values
RECERR
Note
RPPERRORS *rppErrs;
while (rppErrs != NULL)
{
LPCSTR p = NULL;
kRecGetErrorInfo(rppErrs->rc, &p);
printf("RC:%d/%s, obj:%S - page:%d\n", rppErrs->rc, p, rppErrs->obj, rppErrs->page);
rppErrs = rppErrs->next;
}
RETCODEINFO RECAPIKRN kRecGetErrorInfo(RECERR ErrCode, LPCSTR *lpErrSym)
Getting additional information about an error.
RECERR RECAPIPLS RecGetRPPErrorList(RPPERRORS **rppErrs)
Getting errors from last RecProcessPagesEx.
Error list item.
Definition KernelApi.h:9900
LPWSTR obj
Definition KernelApi.h:9903
struct _RPPERRORS * next
Definition KernelApi.h:9904
int page
Definition KernelApi.h:9902
RECERR rc
Definition KernelApi.h:9901
The specification of this function in C# is:
RECERR kRecGetRPPErrorList(out RPPERROR[] rppErrs);
RECERR RECAPIKRN kRecGetRPPErrorList(RPPERRORS **rppErrs)
Getting errors from last kRecProcessPagesEx.
The specification of this function in Java is:
int kRecGetRPPErrorList(RPPErrorsArray ppErrors)
The specification of this function in Python is:
def kRecGetRPPErrorList() -> Tuple[int, "RPPErrorsArray"]

◆ RecProcessPagesEx()

RECERR RECAPIPLS RecProcessPagesEx ( int sid,
LPCTSTR pDocFile,
LPCTSTR * pImageFiles,
LPONETOUCH_CB pCallback,
void * pContext )

Load, Preprocess, Recognize, Format, Export input images.

This is a high-level function. It loads, preprocesses, recognizes, formats and exports every input image to a single document file.

Parameters
[in]sidSettings Collection ID.
[in]pDocFileFull path of the final output document.
[in]pImageFilesPointer to an array of string pointers that define a set of image files with full path. Wildcard symbols can be used, e.g. *.tif. The last element must be NULL. If a single empty string is specified, the image file open dialog will appear. If pImageFiles is NULL the images come from scanner.
[in]pCallbackOne-touch callback function for calling back by the Engine page-by-page.
[in]pContextUser data passed to the callback function by the Engine.
Return values
RECERR
Note
There are two special return values at this function: API_ERRORS_HAPPENED_WARN and API_WARNINGS_HAPPENED_WARN. These warnings sign that there are errors or warnings happened during the RecProcessPagesEx call, but some of the pages have been processed correctly. The program can query the complete list of errors occured using RecGetRPPErrorList.
RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS. However multithreading is supported on: Windows, Linux only, so this function performs a sequential workflow on other platforms.
It uses the programmed OmniPage 1-2-3 Workflow.
See details about size limits of input images.
The progress monitor callback function is called as usual independently of the one-touch callback. Use one-touch callback function for calling back by the Engine page-by-page If you do not want to abort the current process return TRUE.
The parameter notused of the ONETOUCH_CB is not considered at all.
The maximum number of recognition threads started by this function can be specified by the setting Kernel.RPP.RecThreadCount.
The format of the output document can be set by the RecSetOutputFormat function.
// ONETOUCH_CB
INTBOOL __declspec(dllexport) RECKRNCALL onetouch_cb(INTBOOL bMore, void *pContext, LPCSTR *notused)
{
INTBOOL r = FALSE;
//bMore is FALSE
return (Abort) ? FALSE : TRUE;
}
...
{
RECERR rc = REC_OK;
RecSetOutputFormat(0, "converters.text.rtf2000");
#ifdef INPUT_FROM_FILES
LPCSTR ifiles[6] = { NULL, NULL, NULL };
ifiles[0] = "path/test1.tif";
ifiles[1] = "path/test2.tif";
// or
ifiles[0] = "path/test*.*"; // all test image files will be processed
// or
ifiles[0] = ""; // the workflow will ask for input files
rc = RecProcessPagesEx(0, "test.rtf", ifiles, NULL, NULL);
// or
#else
// NULL is used, the function will scan from the default scanner.
// The function will scan until the ADF becomes empty.
rc = RecProcessPagesEx(0, "test.rtf", NULL, onetouch_cb, NULL);
#endif
...
}
@ REC_OK
Successful operation, no error.
Definition RECERR_doc.h:20
RECERR RECAPIPLS RecProcessPagesEx(int sid, LPCTSTR pDocFile, LPCTSTR *pImageFiles, LPONETOUCH_CB pCallback, void *pContext)
Load, Preprocess, Recognize, Format, Export input images.
RECERR RECAPIPLS RecSetOutputLevel(int sid, OUTPUTLEVEL outLevel)
Set the level of format retention for the final output document.
RECERR RECAPIPLS RecSetOutputFormat(int sid, LPCTSTR pFormatname)
Set the output format.
@ OL_RFP
Definition RecAPIPlus.h:1128
The specification of this function in C# is:
RECERR RecProcessPagesEx(int sid, string pDocFile, string[] pImageFiles, ONETOUCH_CB callback);
INTBOOL RECKRNCALL ONETOUCH_CB(INTBOOL bMore, void *pContext, LPCTSTR *notused)
The user-written "One-touch" callback function.
Definition KernelApi.h:929
The specification of this function in Java is:
int RecProcessPagesEx(int sid, String pDocFile, String[] pImageFiles, OneTouchCallback pCallback)
The specification of this function in Python is:
def RecProcessPagesEx(sid: int, pDocFile: str, pImageFiles: List[str], pCallback: "OneTouchCallback") -> int