RecAPI
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Modules Pages
Document

The document-level processing is supported on: Windows, Linux, Embedded Linux, MacOS.

The document is a page container containing a set of pages HPAGE in User-defined order. The document can be accessed through handles HDOC, which can come from the creation of a new document (RecCreateDoc) or from the opening of an existing one (RecOpenDoc). The integrating application can insert pages into a document (RecInsertPage) or remove them (RecDeletePage). To modify a document, open it with RecOpenDoc. The document always must be closed (RecCloseDoc). The recognition should be run on pages. The aim of the document is only to collect the recognized pages so they are passed to the output conversion as a unit.

The recognition of each HPAGE is performed by kRecRecognize of the page-level processing. Another way to recognize pages is to use one-step processing, but it works at page level and not document level.

The integrating application can also save the document into an OPD file (the format of the application ScanSoft OmniPage 2025) or load a document from such a file.

When the document is ready, the application can export it by RecConvert2Doc. The format of the created output file can be set by RecSetOutputFormat. The Capture SDK provides many format-specific settings and fine-tuning controls that influence the properties of the output document. For more information, see the topic output.

Note
The following example shows a typical multi-page processing:
RECERR rc;
HPAGE hPage;
HIMGFILE hIFile;
HDOC hDoc;
int pageCnt, i;
// Initialize engine.
rc = RecInitPlus(YOUR_COMPANY, YOUR_PRODUCT);
// Create a new document.
rc = RecCreateDoc(0, "test.opd", &hDoc, DOC_NORMAL);
// Load image.
rc = kRecOpenImgFile("multipage.tif", &hIFile, IMGF_READ, (IMF_FORMAT)0);
// Get number of pages.
rc = kRecGetImgFilePageCount(hIFile, &pageCnt);
// Cycle through the pages.
for(i=0;i<pageCnt;i++)
{
// Load current page.
rc = kRecLoadImg(0, hIFile, &hPage, i);
// Preprocess image.
rc = kRecPreprocessImg(0, hPage);
// Recognize image.
rc = kRecRecognize(0, hPage, NULL);
// Add page to document. Don't have to free up HPAGE, because RecInsertPage frees it up.
rc = RecInsertPage(0, hDoc, hPage, -1);
}
// Close file.
rc = kRecCloseImgFile(hIFile);
// Set output format and level.
rc = RecSetOutputFormat(0, "Converters.Text.Rtf2000");
// Convert document to and RTF file
rc = RecConvert2Doc(0, hDoc, "test.rtf");
// Close document.
rc = RecCloseDoc(0, hDoc);
// Stop engine.
rc = RecQuitPlus();
RECERR
Error codes.
Definition RECERR_doc.h:19
RECERR RECAPIKRN kRecPreprocessImg(int sid, HPAGE hPage)
Image preprocessing.
struct RECPAGESTRUCT * HPAGE
Handle of a page in memory.
Definition KernelApi.h:289
struct tagIMGFILEHANDLE * HIMGFILE
Handle of image files.
Definition KernelApi.h:11244
IMF_FORMAT
Image formats.
Definition KernelApi.h:11179
RECERR RECAPIKRN kRecCloseImgFile(HIMGFILE hIFile)
Closing an image file.
RECERR RECAPIKRN kRecLoadImg(int sid, HIMGFILE hIFile, HPAGE *phPage, int iPage)
Loading a page from an opened image file.
RECERR RECAPIKRN kRecGetImgFilePageCount(HIMGFILE hIFile, int *lpPageCount)
Getting the number of pages in an image file.
RECERR RECAPIKRN kRecOpenImgFile(LPCTSTR pFilename, HIMGFILE *pHIMGFILE, int mode, IMF_FORMAT filetype)
Opening an image file.
#define IMGF_READ
Opening file for reading only. The file can be shared. (Use it with kRecOpenImgFile....
Definition KernelApi.h:11253
RECERR RECAPIKRN kRecRecognize(int sid, HPAGE hPage, LPCTSTR pFilename)
Recognizing a page.
struct RECDOCSTRUCT * HDOC
Document handle.
Definition RecAPIPlus.h:244
RECERR RECAPIPLS RecCloseDoc(int sid, HDOC hDoc)
Close an OmniPage document.
RECERR RECAPIPLS RecInsertPage(int sid, HDOC hDoc, HPAGE hPage, int iPage)
Insert an HPAGE as a new page into a document.
RECERR RECAPIPLS RecCreateDoc(int sid, LPCTSTR pDocFile, HDOC *phDoc, int mode)
Create an OmniPage document file or folder.
RECERR RECAPIPLS RecConvert2Doc(int sid, HDOC hDoc, LPCTSTR pOutputFilename)
Convert and export an OmniPage document to the final output document.
#define DOC_NORMAL
Normal Storage mode: The document is a compound file. This mode is supported on: Windows....
Definition RecAPIPlus.h:253
RECERR RECAPIPLS RecQuitPlus(void)
Uninitialize the RecAPIPlus.
RECERR RECAPIPLS RecInitPlus(LPCTSTR pCompanyName, LPCTSTR pProductName)
Initialize the RecAPIPlus.
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_FLOWINGPAGE
Definition RecAPIPlus.h:1130