L_DocAddPage
#include "ltdoc.h"
L_LTDOC_API L_INT L_DocAddPage(hDoc, pBitmap, nPageIndex)
L_HDOC hDoc; |
/* handle to the OCR document */ |
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
L_INT nPageIndex; |
/* position at which to insert the page */ |
Adds a new page to the OCR document.
Parameter |
Description |
hDoc |
Handle to the OCR document. |
pBitmap |
Pointer to the bitmap handle that references the new page to insert into the internal OCR list of pages. |
nPageIndex |
Position in the list of pages at which to insert the new page. Use -1 to append the page to the end of the list. |
|
Use zero-based indexing. For Example, if there are 10 pages in the list, the index of the last page is 9. If you insert a page within the list, the indices of other pages will change automatically to accommodate the insertion. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
The function converts the inserted page(s) to be matched with the OCR requirements.
In addition, this function checks the color order for each bitmap loaded. If a bitmap has the color order reversed (i.e. white to black) then the function will convert the color order to be normal (i.e. black to white).
Required DLLs and Libraries
LTDOC For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
See Also
Functions: |
L_DocGetPageCount, L_DocUpdatePage, L_DocRemovePage, L_DocExportPage, L_DocGetPageInfo, L_DocCleanupPages |
Topics: |
|
|
Example
L_INT DocAddPageExample(L_HDOC hDoc,L_TCHAR* pszFileName) { L_INT nRet; BITMAPHANDLE Bitmap; L_INT nPageCount = 0; L_TCHAR szBuffer[100]; memset(szBuffer, 0, sizeof(szBuffer)); nRet = L_InitBitmap(&Bitmap, sizeof(BITMAPHANDLE), 0, 0, 0); if(nRet != SUCCESS) return nRet; nRet = L_LoadBitmap(pszFileName, &Bitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL); if (nRet != SUCCESS) return nRet; nRet = L_DocAddPage(hDoc, &Bitmap, -1); if (nRet != SUCCESS) { MessageBox(NULL, TEXT("The engine can't add the specified bitmap."), TEXT("Notice!"), MB_OK); return nRet; } nRet = L_DocGetPageCount (hDoc, &nPageCount); if (nRet != SUCCESS) MessageBox(NULL, TEXT("An error occurred during L_DocGetPageCount "), TEXT("Error!"), MB_OK); else { wsprintf(szBuffer, TEXT("Total pages in the OCR document = %d\n"), nPageCount); MessageBox(NULL, szBuffer, TEXT("Page Count!"), MB_OK); } return SUCCESS; }