Simple document handling functions. RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
More...
|
typedef struct RECDOCSTRUCT * | HDOC |
| Document handle.
|
|
|
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.
|
|
|
These values can be used as the mode at RecCreateDoc.
|
#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, MacOS.
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:
- Page level: In this case the Document is a set of Page Stores. Pages are independent of each other, not used as a connected document. (E.g. Page Stores are not assigned to a page number inside the document; they just have an identifier which is independent from their final place in a document.)
See RecCreatePageStore, RecGetPageStore.
Page level functions are needed mostly if recognition is done in multiple processes. After creating the document in one process it can be opened in other processes, too, and concurrent page level use is possible in all those processes (of course the processes should work on different pages).
- Document level: In this case pages are inserted into the document at a given page number (RecInsertPage). The application can delete or move pages or save and load the document to and from the proprietary OPD file type. When the document is ready, the application can export it (RecConvert2Doc) into the output file, using the appropriate output format like PDF, Word, etc. (RecSetOutputFormat). Document level functions must be called in a single process only.
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.
◆ HDOC
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.
◆ HPAGESaveFlags
Possible enumerations for the "APIPlus.HPAGE.SaveFlags" setting.
Enumerator |
---|
HPSF_Default | Save default elements.
|
HPSF_SaveAll | Save all HPAGE elements.
|
◆ RecCloseDoc()
RECERR RECAPIPLS RecCloseDoc |
( |
int | sid, |
|
|
HDOC | hDoc ) |
Close an OmniPage document.
This closes an OmniPage document when it is no longer being used. The document handle becomes invalid.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
In DOC_NORMAL mode the OPD file is automatically saved before closing.
-
The specification of this function in C# is:
RECERR
Error codes.
Definition RECERR_doc.h:19
RECERR RECAPIPLS RecCloseDoc(int sid, HDOC hDoc)
Close an OmniPage document.
-
The specification of this function in Java is:
struct RECDOCSTRUCT * HDOC
Document handle.
Definition RecAPIPlus.h:244
-
The specification of this function in Python is:
◆ RecConvert2Doc()
RECERR RECAPIPLS RecConvert2Doc |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
LPCTSTR | pOutputFilename ) |
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.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | pOutputFilename | Pointer to an output file name. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS. However not all the output formats are supported on all of these platforms. See details.
-
In the Microsoft Word and PowerPoint programs, the size of the page is limited. The width and height of the page must be between 0.1 and 22 inches. Because of this, if you scanned or loaded a page that is larger than this limit, you cannot save it into Flowing Page or True Page formats with
*.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.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecConvert2Doc(int sid, HDOC hDoc, LPCTSTR pOutputFilename)
Convert and export an OmniPage document to the final output document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecConvert2Doc(sid: int, hDoc:
"HDOC", pOutputFilename: str) -> int
◆ RecCreateDoc()
RECERR RECAPIPLS RecCreateDoc |
( |
int | sid, |
|
|
LPCTSTR | pDocFile, |
|
|
HDOC * | phDoc, |
|
|
int | mode ) |
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.
- Parameters
-
[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 after closing the document. 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 . |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The OmniPage document file extension is "OPD", but other extensions can be used as well.
-
DOC_NORMAL
mode is supported on: Windows. On other platforms it works as DOC_FOLDER
.
-
The created OPD file or folder can be deleted by RecDeleteDoc.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecCreateDoc(int sid, LPCTSTR pDocFile, HDOC *phDoc, int mode)
Create an OmniPage document file or folder.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecCreateDoc(sid: int, pDocFile: str, mode: int) -> Tuple[int,
"HDOC"]
◆ RecCreatePageStore()
RECERR RECAPIPLS RecCreatePageStore |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | storeId, |
|
|
HPAGE | hPage ) |
Create a Page Store inside a document and attach a page to it.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | storeId | Page Store identifier. |
[in] | hPage | Handle of a page. |
- Return values
-
- Note
- This function is supported on: Windows, Linux, Embedded Linux, MacOS.
-
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.
-
The
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.
-
This function is designed for a multiprocessing environment. Page Stores can be created in a different process, too, not only in the one that created the Document.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecCreatePageStore(int sid, HDOC hDoc, int storeId, HPAGE hPage)
Create a Page Store inside a document and attach a page to it.
-
The specification of this function in Java is:
struct RECPAGESTRUCT * HPAGE
Handle of a page in memory.
Definition KernelApi.h:289
-
The specification of this function in Python is:
◆ RecDeleteDoc()
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.
- Parameters
-
[in] | pDocName | Path to the OPD file or folder. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecDeleteDoc(LPCTSTR pDocName)
Deletes an OmniPage document file or folder.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
◆ RecDeletePage()
RECERR RECAPIPLS RecDeletePage |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | iPage ) |
Delete a page from a document.
This removes a page from an open OmniPage document. The page will be deleted.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Page index. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecDeletePage(int sid, HDOC hDoc, int iPage)
Delete a page from a document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
◆ RecDeletePageStore()
RECERR RECAPIPLS RecDeletePageStore |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | storeId ) |
Delete a Page Store from inside a document.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | storeId | Page Store identifier. |
- Return values
-
- Note
- This function is supported on: Windows, Linux, Embedded Linux, MacOS.
-
Take care not to have a handle for the Page Store in memory. Free the handle (if any) with kRecFreeImg before deleting the store.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecDeletePageStore(int sid, HDOC hDoc, int storeId)
Delete a Page Store from inside a document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
◆ RecFormatPageStore()
RECERR RECAPIPLS RecFormatPageStore |
( |
int | sid, |
|
|
HPAGE | hPage ) |
Run Format Detection on a page attached to a Page Store.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hPage | Page Store handle. |
- Return values
-
- Note
- This function is supported on: Windows, Linux, Embedded Linux, MacOS.
-
hPage must be a Page Store handle, not a simple Page handle. Detected format data is saved to the Page Store and will be used for document conversion.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecFormatPageStore(int sid, HPAGE hPage)
Run Format Detection on a page attached to a Page Store.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
◆ RecGetPage()
RECERR RECAPIPLS RecGetPage |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | iPage, |
|
|
HPAGE * | phPage ) |
Retrieve HPAGE from a document.
It copies most of the information from a document page to a HPAGE.
- Parameters
-
[in] | sid | Session ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Index of the requested page. |
[out] | phPage | Contains the handle of the requested page. If the retrieved HPAGE is no longer needed, it is necessary to call kRecFreeImg for that. |
- Return values
-
- Note
- If you want to store and retrieve a HPAGE with all its elements like recognized letters you have to change "APIPlus.HPAGE.SaveFlags" setting (HPAGESaveFlags) to HPSF_SaveAll before calling RecInsertPage.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecGetPage(int sid, HDOC hDoc, int iPage, HPAGE *phPage)
Retrieve HPAGE from a document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecGetPage(sid: int, hDoc:
"HDOC", iPage: int) -> Tuple[int,
"HPAGE"]
◆ RecGetPageCount()
RECERR RECAPIPLS RecGetPageCount |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int * | pnPages ) |
Get the number of pages of an OmniPage document.
This asks the current number of pages in the OmniPage document.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[out] | pnPages | Contains the page number. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecGetPageCount(int sid, HDOC hDoc, int *pnPages)
Get the number of pages of an OmniPage document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
◆ RecGetPageStatistics()
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.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Index of the page to be examined. |
[out] | stat | Buffer for statistics. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecGetPageStatistics(int sid, HDOC hDoc, int iPage, STATISTIC *stat)
Getting recognition statistics.
Recognition statistics.
Definition KernelApi.h:651
-
The specification of this function in Java is:
-
The specification of this function in Python is:
◆ RecGetPageStore()
RECERR RECAPIPLS RecGetPageStore |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | storeId, |
|
|
HPAGE * | phPage ) |
Create a handle for an existing Page Store inside a document.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | storeId | Page Store identifier. |
[out] | phPage | Contains the handle of the requested Page Store. |
- Return values
-
- Note
- This function is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The returned Page Store handle is attached to the Page Store. The content of the file is read only as needed, and any changes done to the returned
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!
-
Take care not to have multiple handles for the same Page Store! Close all Page Store handles before RecConvert2Doc.
-
A similar function is RecGetPage, but that one creates an independent page (a copy).
-
The specification of this function in C# is:
RECERR RECAPIPLS RecGetPageStore(int sid, HDOC hDoc, int storeId, HPAGE *phPage)
Create a handle for an existing Page Store inside a document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecGetPageStore(sid: int, hDoc:
"HDOC", storeId: int) -> Tuple[int,
"HPAGE"]
◆ RecInsertPage()
RECERR RECAPIPLS RecInsertPage |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
HPAGE | hPage, |
|
|
int | iPage ) |
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.
- Parameters
-
[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. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
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.
-
If the application changes APIPlus.FreehPageAfterInsert setting to false, HPAGE will not be freed and the application can use it, but it has to be freed later. In this case there is no connection between the
HPAGE
and the HDOC
after the function returns, i.e. modifications on either do not affect on the other.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecInsertPage(int sid, HDOC hDoc, HPAGE hPage, int iPage)
Insert an HPAGE as a new page into a document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecInsertPage(sid: int, hDoc:
"HDOC", hPage:
"HPAGE", iPage: int) -> int
◆ RecMovePage()
RECERR RECAPIPLS RecMovePage |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | iPageFrom, |
|
|
int | iPageTo ) |
Move a page in a document.
This changes the page index of a page in an open OmniPage document.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPageFrom | Starting page index. |
[in] | iPageTo | Destination page index. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecMovePage(int sid, HDOC hDoc, int iPageFrom, int iPageTo)
Move a page in a document.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecMovePage(sid: int, hDoc:
"HDOC", iPageFrom: int, iPageTo: int) -> int
◆ RecOpenDoc()
RECERR RECAPIPLS RecOpenDoc |
( |
int | sid, |
|
|
LPCTSTR | pDocFile, |
|
|
HDOC * | phDoc ) |
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.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | pDocFile | Path to the OPD file or folder. |
[out] | phDoc | Contains the handle of the opened document. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
An OPD file or folder can be deleted by RecDeleteDoc.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecOpenDoc(int sid, LPCTSTR pDocFile, HDOC *phDoc)
Open an OmniPage document file or folder.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecOpenDoc(sid: int, pDocFile: str) -> Tuple[int,
"HDOC"]
◆ RecSaveDoc()
RECERR RECAPIPLS RecSaveDoc |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
LPCTSTR | pDocFile ) |
Save an OmniPage document to file.
This saves an OmniPage document to another file.
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | pDocFile | Path to the OPD file. |
[in] | hDoc | Document handle. |
- Return values
-
- Note
- RecAPIPlus level of CSDK is supported on: Windows, Linux, Embedded Linux, MacOS.
-
In DOC_FOLDER mode
pDocFile
must be the same folder as specified in RecCreateDoc.
-
An OPD file or folder can be deleted by RecDeleteDoc.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecSaveDoc(int sid, HDOC hDoc, LPCTSTR pDocFile)
Save an OmniPage document to file.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecSaveDoc(sid: int, hDoc:
"HDOC", pDocFile: str) -> int
◆ RecUpdatePage()
RECERR RECAPIPLS RecUpdatePage |
( |
int | sid, |
|
|
HDOC | hDoc, |
|
|
int | iPage, |
|
|
HPAGE | hPage ) |
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).
- Parameters
-
[in] | sid | Settings Collection ID. |
[in] | hDoc | Document handle. |
[in] | iPage | Page index. |
[in] | hPage | Handle of a page. |
- Return values
-
- Note
- This function is supported on: Windows.
-
If the application changes APIPlus.FreehPageAfterInsert setting to false, HPAGE will not be freed and the application can use it, but it has to be freed later. In this case there is no connection between the
HPAGE
and the HDOC
after the function returns, i.e. modifications on either do not affect on the other.
-
The specification of this function in C# is:
RECERR RECAPIPLS RecUpdatePage(int sid, HDOC hDoc, int iPage, HPAGE hPage)
Update a page in a document specified by an HPAGE.
-
The specification of this function in Java is:
-
The specification of this function in Python is:
def
RecUpdatePage(sid: int, hDoc:
"HDOC", iPage: int, hPage:
"HPAGE") -> int