#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2FindZonesExt(hDoc, nDocId, nPageIndex)

Finds all zones in the specific page.


L_HDOC2 hDoc

Handle to the OCR document.

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

L_INT nPageIndex

Zero-based index of the page to search.


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


Use L_Doc2FindZonesExt to parse (or auto-zone) the specified page (i.e., it analyzes the structure of the page layout and locates blocks for further processing).

L_Doc2FindZonesExt performs the analysis within the page area of the image. It finds text or graphics blocks within the page area, builds an OCR zone list, and then connects it to the specified page.

Zones found by L_Doc2FindZonesExt are entered in a sequential list, called the OCR zone list, which is attached to the specified page. When L_Doc2FindZonesExt is called, any previously inserted zones are deleted from this list.

To retrieve the number of OCR zones list and number of user zones, call L_Doc2GetZoneCount / L_Doc2GetZoneCountExt.

Zones can be deleted from this list using the L_Doc2RemoveZone / L_Doc2RemoveZoneExt function. Get the zone's parameters by calling the L_Doc2GetZone / L_Doc2GetZoneExt function. After modifying some zone attributes, use the L_Doc2UpdateZone / L_Doc2UpdateZoneExt function to apply the changes to the zone.

When working with zones from the OCR zone list, the following members cannot be updated:

L_Doc2FindZonesExt finds the zone coordinates and the type of the zone.

A new zone created by L_Doc2FindZonesExt always takes the value DOC2_ZONE_CHAR_FILTER_DEFAULT, meaning that the zone will take on the global filter setting (which is by default DOC2_ZONE_CHAR_FILTER_DEFAULT to have no filtering).

New zones located by this function always have the DOC2_FILL_DEFAULT and DOC2_RECOGMODULE_AUTO values in their FillMethod and RecogModule fields, respectively. The "meaning" of the DOC2_FILL_DEFAULT filling method is specified with the L_Doc2SetFillMethod / L_Doc2SetFillMethodExt function. There is no corresponding function for specifying the default recognition module.

A new zone created by L_Doc2FindZonesExt always has empty strings in its ZONEDATA2.szSection member, which specifies the use of the default section of any enabled User dictionary.


User words and dictionaries are no longer supported in the LEADTOOLS OCR Module - OmniPage Engine.

The L_Doc2FindDefaultFillMethod / L_Doc2FindDefaultFillMethodExt function can be used if you do not know the type of page to be processed.

To set Auto Zone options, call the L_Doc2SetZoneOptions / L_Doc2SetZoneOptionsExt function.

To get Auto Zone options, call the L_Doc2GetZoneOptions / L_Doc2GetZoneOptionsExt function.

Required DLLs and Libraries

See Also




L_INT Doc2FindZonesExampleExt(L_HDOC2 hDoc, L_INT nDocId, L_INT nPageIndex) 
   L_INT nRet; 
   ZeroMemory(&ZoneOpts, sizeof(AUTOZONEOPTS2)); 
   nRet = L_Doc2GetZoneOptionsExt(hDoc, nDocId, &ZoneOpts, sizeof(AUTOZONEOPTS2)); 
   if(nRet != SUCCESS) 
      return nRet; 
   ZoneOpts.bEnableForceSingleColumn = TRUE; 
   ZoneOpts.bDetectNonGridedTables = TRUE; 
   nRet = L_Doc2SetZoneOptionsExt(hDoc, nDocId, &ZoneOpts); 
   if(nRet != SUCCESS) 
      return nRet; 
   nRet = L_Doc2FindZonesExt(hDoc, nDocId, nPageIndex); 
   if (nRet == SUCCESS) 
      MessageBox(NULL, TEXT("The engine finds all available zones in the specified page."), TEXT("Notice!"), MB_OK); 
   L_INT nOcrZoneCount=0; 
   nRet = L_Doc2GetZoneCountExt(hDoc, nDocId, nPageIndex, &nOcrZoneCount); 
   if (nRet != SUCCESS) 
      return nRet; 
   L_TCHAR szBuffer[100]; 
   memset(szBuffer, 0, sizeof(szBuffer)); 
   wsprintf(szBuffer, TEXT("Total zones in the specified page = %d\n"), nOcrZoneCount); 
   MessageBox(NULL, szBuffer, TEXT("Zones 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.