L_Doc2AddPage
#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2AddPage(hDoc, pBitmap, nPageIndex)
|
L_HDOC2 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 being inserted 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
This 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
|
LTDOC2 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_Doc2GetPageCount, L_Doc2UpdatePage, L_Doc2RemovePage, L_Doc2ExportPage, L_Doc2GetPageInfo, L_Doc2CleanupPages |
|
Topics: |
|
|
|
Example
L_LTDOC2TEX_API L_INT Doc2AddPageExample(L_HDOC2 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_Doc2AddPage(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_Doc2GetPageCount (hDoc, &nPageCount);
if (nRet != SUCCESS)
MessageBox(NULL, TEXT("An error occurred during L_Doc2GetPageCount "), 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;
}