L_Doc2AddZoneExt

#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2AddZoneExt(hDoc, nDocId, nPageIndex, nZoneIndex, pZoneData)

Adds a new zone to the zone list for the specified page.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

L_INT nDocId

The Document ID created by calling L_Doc2CreateDocument.

L_INT nPageIndex

Zero-based index of the page on which to add the zone.

L_INT nZoneIndex

Zero-based position in the list of zones at which to add new zone. Use -1 to append the page to the end of the list.

pZONEDATA2 pZoneData

Pointer to a ZONEDATA2 structure, which contains the zone data to be added.

Returns

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

Comments

Adds a new zone to the zone list for the specified page. After the zone is added, the zone list is recalculated automatically.

When adding a zone, the application should directly initialize the following members of the ZONEDATA2 structure, since the following members will not take default values:

uStructSize   
rcArea   
FillMethod   
CharFilter   
Type   
RecogModule 

The OCR engine manages the ID member of the ZONEDATA2 structure.

The Type member of the ZONEDATA2 structure should be one of the following values:

For successful zone addition:

To find all zones in a specific page, call L_Doc2FindZones / L_Doc2FindZonesExt.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT EXT_CALLBACK VerificationCBExt(L_INT nZoneIndex, 
                                  L_TCHAR* pszWord, 
                                  DOC2_VERIFYCODE* pVerify, 
                                  L_VOID* pUserData) 
{ 
   UNREFERENCED_PARAMETER(nZoneIndex); 
   UNREFERENCED_PARAMETER(pszWord); 
   UNREFERENCED_PARAMETER(pVerify); 
   UNREFERENCED_PARAMETER(pUserData); 
 
   //... 
   //... Set your code here 
   //... 
   return SUCCESS; 
} 
 
L_INT Doc2AddZoneExampleExt(L_HDOC2 hDoc, L_INT nDocId, L_INT nPageIndex) 
{ 
   L_INT nRet; 
   ZONEDATA2 ZoneData; 
   L_INT nZoneCount = 0; 
   L_TCHAR szBuffer[100]; 
 
   memset(szBuffer, 0, sizeof(szBuffer)); 
   memset(&ZoneData, 0, sizeof(ZONEDATA2)); 
 
   ZoneData.uStructSize = sizeof(ZONEDATA2); 
   ZoneData.rcArea.left = 100; 
   ZoneData.rcArea.top = 100; 
   ZoneData.rcArea.right = 200; 
   ZoneData.rcArea.bottom = 200; 
   ZoneData.FillMethod = DOC2_FILL_DEFAULT; 
   ZoneData.RecogModule = DOC2_RECOGMODULE_AUTO; 
   ZoneData.CharFilter = DOC2_ZONE_CHAR_FILTER_DEFAULT; 
   ZoneData.Type = DOC2_ZONE_FLOWTEXT; 
   ZoneData.uFlags = 0; 
   ZoneData.pfnCallback = VerificationCBExt; 
   ZoneData.pUserData = NULL; 
 
   nRet = L_Doc2AddZoneExt(hDoc, nDocId, nPageIndex, 0, &ZoneData); 
   if (nRet == SUCCESS) 
      MessageBox(NULL, TEXT("The specified zone is added."), TEXT("Notice!"), MB_OK); 
   else 
      return nRet; 
   nRet = L_Doc2GetZoneCountExt (hDoc, nDocId, nPageIndex, &nZoneCount); 
   if (nRet != SUCCESS) 
   { 
      MessageBox(NULL, TEXT("An error occurred during L_Doc2GetZoneCountExt"), TEXT("Error!"), MB_OK); 
      return nRet; 
   } 
   else 
   { 
      wsprintf(szBuffer, TEXT("Total zones in the specified page = %d\n"), nZoneCount); 
      MessageBox(NULL, szBuffer, TEXT("Zone 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