RecAPI
Functions
One Step Functions Module
RecAPIPlus

One step functions. RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, Mac OS X. 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, Mac OS X.

RecAPIPlus has two one-step functions. The RecProcessPagesEx function uses the 1-2-3 workflow from OmniPage 21. 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 21 and ITest.

One-step functions manage their works in more than one threads trying to achieve the best possible synchronization of the parts. For more information about multi-threading see the topic Multi-threading in RecAPI.

Multi-threading is supported on: Windows 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

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 21 or ITest.

Parameters:
[in] sid Settings Collection ID.
[in] pWFfilename Full 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);
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); 
.
The specification of this function in Java is:
 int RecExecuteWorkflow(int sid, String pWFfilename) 
RECERR RECAPIPLS RecGetRPPErrorList ( RPPERRORS **  rppErrs )

Getting errors from last RecProcessPagesEx.

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

Parameters:
[out] rppErrs Pointer 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;
    RecGetRPPErrorList(&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;
    }
The specification of this function in C# is:
 RECERR kRecGetRPPErrorList(out RPPERROR[] rppErrs); 
The specification of this function in Java is:
 int kRecGetRPPErrorList(RPPErrorsArray ppErrors) 
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] sid Settings Collection ID.
[in] pDocFile Full path of the final output document.
[in] pImageFiles Pointer 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] pCallback One-touch callback function for calling back by the Engine page-by-page.
[in] pContext User 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, Mac OS X. However multithreading is supported on: Windows 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");
        RecSetOutputLevel(0, OL_RFP);

    #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
        ...
    }
The specification of this function in C# is:
 RECERR RecProcessPagesEx(int sid, string pDocFile, string[] pImageFiles, ONETOUCH_CB callback); 
The specification of this function in Java is:
 int kRecProcessPagesEx(int sid, String pDocFile, String[] pImageFiles, OneTouchCallback pCallback, String pTemplate)