L_Doc2AddPageExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2AddPageExt(hDoc, nDocId, pBitmap, nPageIndex)

Adds a new page to the OCR document.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

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

L_Doc2AddPageExt converts the inserted page(s) to match OCR requirements.

In addition, it 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 Doc2AddPageExampleExt(L_HDOC2 hDoc, L_INT nDocId, 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_Doc2AddPageExt(hDoc, nDocId, &Bitmap, -1); 
   if (nRet != SUCCESS) 
   { 
      MessageBox(NULL, TEXT("The engine can't add the specified bitmap."), TEXT("Notice!"), MB_OK); 
      return nRet; 
   } 
 
   nRet = L_Doc2GetPageCountExt (hDoc, nDocId, &nPageCount); 
   if (nRet != SUCCESS) 
      MessageBox(NULL, TEXT("An error occurred during L_Doc2GetPageCountExt"), 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 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.