RecAPI
|
Simple document handling functions. RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, Mac OS X. More...
Typedefs | |
typedef struct RECDOCSTRUCT * | HDOC |
Document handle. | |
Enumerations | |
enum | HPAGESaveFlags { HPSF_Default = 0x0000, HPSF_SaveAll = 0xFFFF } |
Possible enumerations for the "APIPlus.HPAGE.SaveFlags" setting. More... | |
Functions | |
RECERR RECAPIPLS | RecCreateDoc (int sid, LPCTSTR pDocFile, HDOC *phDoc, int mode) |
Create an OmniPage document file or folder. | |
RECERR RECAPIPLS | RecOpenDoc (int sid, LPCTSTR pDocFile, HDOC *phDoc) |
Open an OmniPage document file or folder. | |
RECERR RECAPIPLS | RecCloseDoc (int sid, HDOC hDoc) |
Close an OmniPage document. | |
RECERR RECAPIPLS | RecDeleteDoc (LPCTSTR pDocName) |
Deletes an OmniPage document file or folder. | |
RECERR RECAPIPLS | RecSaveDoc (int sid, HDOC hDoc, LPCTSTR pDocFile) |
Save an OmniPage document to file. | |
RECERR RECAPIPLS | RecGetPageCount (int sid, HDOC hDoc, int *pnPages) |
Get the number of pages of 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 | RecUpdatePage (int sid, HDOC hDoc, int iPage, HPAGE hPage) |
Update a page in a document specified by an HPAGE. | |
RECERR RECAPIPLS | RecGetPage (int sid, HDOC hDoc, int iPage, HPAGE *phPage) |
Retrieve HPAGE from a document. | |
RECERR RECAPIPLS | RecDeletePage (int sid, HDOC hDoc, int iPage) |
Delete a page from a document. | |
RECERR RECAPIPLS | RecMovePage (int sid, HDOC hDoc, int iPageFrom, int iPageTo) |
Move a page in a document. | |
RECERR RECAPIPLS | RecConvert2Doc (int sid, HDOC hDoc, LPCTSTR pOutputFilename) |
Convert and export an OmniPage document to the final output document. | |
RECERR RECAPIPLS | RecGetPageStatistics (int sid, HDOC hDoc, int iPage, STATISTIC *stat) |
Getting recognition statistics. | |
RECERR RECAPIPLS | RecCreatePageStore (int sid, HDOC hDoc, int storeId, HPAGE hPage) |
Create a Page Store inside a document and attach a page to it. | |
RECERR RECAPIPLS | RecDeletePageStore (int sid, HDOC hDoc, int storeId) |
Delete a Page Store from inside a document. | |
RECERR RECAPIPLS | RecGetPageStore (int sid, HDOC hDoc, int storeId, HPAGE *phPage) |
Create a handle for an existing Page Store inside a document. | |
RECERR RECAPIPLS | RecFormatPageStore (int sid, HPAGE hPage) |
Run Format Detection on a page attached to a Page Store. | |
Document Storage Mode | |
These values can be used as the | |
#define | DOC_NORMAL 0 |
Normal Storage mode: The document is a compound file. This mode is supported on: Windows. On other platforms it works as DOC_FOLDER . | |
#define | DOC_FOLDER 1 |
Folder Storage mode: The document is a set of files in a folder. |
Simple document handling functions. RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, Mac OS X.
With these functions the User's application can implement document-based solutions. The application can create (RecCreateDoc) multi-page documents. The application can insert recognized pages (HPAGE's) that have been processed using KernelAPI functions.
The RecAPIPlus Document can be handled at two levels:
It is not necessary to step to the Document level; an HDOC can be used exclusively on the Page level, too. This is useful when pages are processed in multiple processes, saved to Page Stores, then when all the pages are done, converted to a file or files with kRecConvert2DTXT calls.
typedef struct RECDOCSTRUCT* HDOC |
Document handle.
This is handle for an OmniPage document. Every function which handles a document needs it as an input parameter.
enum HPAGESaveFlags |
Close an OmniPage document.
This closes an OmniPage document when it is no longer being used. The document handle becomes invalid.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
RECERR |
RECERR RecCloseDoc(int sid, IntPtr hDoc);
Convert and export an OmniPage document to the final output document.
This creates a document file from an OmniPage document. The new document file's type and format can be given by RecSetOutputFormat.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | pOutputFilename | Pointer to an output file name. |
RECERR |
*.rtf
and *.docx
and *.pptx
file extensions. These formats try to retain the original page size and layout. If you try to save this, you will get an error message and the file will not be saved. RECERR RecConvert2Doc(int sid, IntPtr hDoc, string outputFilename);
Create an OmniPage document file or folder.
This creates a new OmniPage document, and also a disk file or folder for it. It also generates a document handle for this document.
[in] | sid | Settings Collection ID. |
[in] | pDocFile | Path to the OPD file (DOC_NORMAL mode) or folder (DOC_FOLDER mode). In DOC_NORMAL mode if pDocFile is an empty string, OPD file will not be created at the end. If you are not interested in persistent OPD files, use empty string as file name. It speeds up RecCreateDoc/RecInsertPage/RecConvert2Doc/RecCloseDoc workflow. In DOC_FOLDER mode pDocFile cannot be an empty string. |
[out] | phDoc | Contains the handle of the created document. |
[in] | mode | Specifies the Document Storage Mode. Can be either DOC_NORMAL or DOC_FOLDER . |
RECERR |
DOC_NORMAL
mode is supported on: Windows. On other platforms it works as DOC_FOLDER
. RECERR RecCreateDoc(int sid, string DocFile, out IntPtr hDoc, DOCOPENMODE mode);
Create a Page Store inside a document and attach a page to it.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | storeId | Page Store identifier. |
[in] | hPage | Handle of a page. |
RECERR |
hPage
is saved to the Page Store. Any future changes done to hPage
will also be saved to the store when hPage
is kRecFreeImg'd. The Page Store is not removed even when hPage
is freed; it is removed only by RecDeletePageStore or RecDeleteDoc. storeId
identifier can be any positive number. (It could be the 1 based serial number of the given page, but this is not necessary.) A second call of this function with the same storeId
overwrites the previous content. Take care not to have the previous hPage
still in memory as multiple Page Store handles are not supported. hDoc
must have been created in DOC_FOLDER mode. RECERR RecCreatePageStore(int sid, IntPtr hDoc, int storeId, IntPtr hPage);
RECERR RECAPIPLS RecDeleteDoc | ( | LPCTSTR | pDocName | ) |
Deletes an OmniPage document file or folder.
This deletes an existing OmniPage document file or folder in the file system.
[in] | pDocName | Path to the OPD file or folder. |
RECERR |
RECERR RecDeleteDoc(string DocName);
Delete a page from a document.
This removes a page from an open OmniPage document. The page will be deleted.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Page index. |
RECERR |
RECERR RecDeletePage(int sid, IntPtr hDoc, int iPage);
Delete a Page Store from inside a document.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | storeId | Page Store identifier. |
RECERR |
RECERR RecDeletePageStore(int sid, IntPtr hDoc, int storeId);
Run Format Detection on a page attached to a Page Store.
[in] | sid | Settings Collection ID. |
[in] | hPage | Page Store handle. |
RECERR |
RECERR RecFormatPageStore(int sid, IntPtr hPage);
Retrieve HPAGE from a document.
It copies most of the information from a document page to a HPAGE.
[in] | sid | Session ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Index of the requested page. |
[out] | phPage | Contains the handle of the requested page. |
RECERR |
RECERR RecGetPage(int sid, IntPtr hDoc, int iPage, out IntPtr hPage);
Get the number of pages of an OmniPage document.
This asks the current number of pages in the OmniPage document.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[out] | pnPages | Contains the page number. |
RECERR |
RECERR RecGetPageCount(int sid, IntPtr hDoc, out int nPages);
Getting recognition statistics.
This function retrieves the statistics of the recognition of the specified page. The values are the number of characters, words and rejected characters and time information for each part of the recognition process.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Index of the page to be examined. |
[out] | stat | Buffer for statistics. |
RECERR |
RECERR RecGetPageStatistics(int sid, IntPtr hDoc, int iPage, out STATISTIC stat);
Create a handle for an existing Page Store inside a document.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | storeId | Page Store identifier. |
[out] | phPage | Contains the handle of the requested Page Store. |
RECERR |
HPAGE
are written to the store. The handle must be freed by kRecFreeImg when not needed any more. Freeing the handle does not remove the Page Store itself! RECERR RecGetPageStore(int sid, IntPtr hDoc, int storeId, out IntPtr hPage);
Insert an HPAGE as a new page into a document.
This inserts an HPAGE into an opened document. During insertion, PageFormatter is applied and at the end of the process, this function frees the HPAGE. The HPAGE must contain a BW or OCR image. By default you must not free HPAGE, because RecInsertPage
frees it (see also notes). This page will no longer be accessible via KernelAPI functions.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | hPage | Handle of a page. |
[in] | iPage | Insert before this page. -1 append the page. |
RECERR |
hPage
can be either a simple page handle or a Page Store handle. In the first case the page is saved to a Page Store then formatted. In the latter case the existing Page Store is just assigned to the specified page number then formatted. HPAGE
and the HDOC
after the function returns, i.e. modifications on either do not affect on the other. RECERR RecInsertPage(int sid, IntPtr hDoc, IntPtr hPage, int iPage);
Move a page in a document.
This changes the page index of a page in an open OmniPage document.
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPageFrom | Starting page index. |
[in] | iPageTo | Destination page index. |
RECERR |
RECERR RecMovePage(int sid, IntPtr hDoc, int iPageFrom, int iPageTo);
Open an OmniPage document file or folder.
This opens an existing OmniPage document file or folder in the file system. It also generates a document handle for this document.
[in] | sid | Settings Collection ID. |
[in] | pDocFile | Path to the OPD file or folder. |
[out] | phDoc | Contains the handle of the opened document. |
RECERR |
RECERR RecOpenDoc(int sid, string DocFile, out IntPtr hDoc);
Save an OmniPage document to file.
This saves an OmniPage document to another file.
[in] | sid | Settings Collection ID. |
[in] | pDocFile | Path to the OPD file. |
[in] | hDoc | Document handle. |
RECERR |
pDocFile
must be the same folder as specified in RecCreateDoc. RECERR RecSaveDoc(int sid, IntPtr hDoc, string DocFile);
Update a page in a document specified by an HPAGE.
This overwrites a page in an open OmniPage document. The input page is HPAGE which will be freed at the end of the function, and cannot be used anymore (see also notes).
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Page index. |
[in] | hPage | Handle of a page. |
RECERR |
HPAGE
and the HDOC
after the function returns, i.e. modifications on either do not affect on the other. RECERR RecUpdatePage(int sid, IntPtr hDoc, int iPage, IntPtr hPage);