#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2AddPage(hDoc, pBitmap, nPageIndex)

Adds a new page to the OCR document.


L_HDOC2 hDoc

Handle to the OCR document.


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.


Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.


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




L_INT Doc2AddPageExample(L_HDOC2 hDoc,L_TCHAR* pszFileName) 
   L_INT nRet; 
   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); 
      wsprintf(szBuffer, TEXT("Total pages in the OCR document = %d\n"), nPageCount); 
      MessageBox(NULL, szBuffer, TEXT("Page Count!"), MB_OK); 
   return SUCCESS; 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help