L_Doc2AddPage

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2AddPage(hDoc, pBitmap, nPageIndex)

Adds a new page to the OCR document.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

pBITMAPHANDLE  pBitmap

Pointer to the bitmap handle, that references the new page being inserted into the internal OCR list of pages.

L_INT 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

Value Meaning
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

See Also

Functions

Topics

Example

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; 
} 
Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help