Finds all zones in the specific page.
Handle to the OCR document.
Index of the page to search. This is a zero-based index.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
The L_Doc2FindZones function is used for parsing the specified page (also called: auto-zoning), i.e. it analyzes the structure of the page layout and locates blocks for further processing.
The function 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 this function are entered in a sequential list, called the OCR zone list, which is attached to the specified page. When this function is called, any previously inserted zones are deleted from this list.
Zones can be deleted from this list using the L_Doc2RemoveZone / L_Doc2RemoveZoneExt function. You can get the zone 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:
This function finds the zone coordinates and the type of the zone.
New zones created by this function always take 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 can be specified with the L_Doc2SetFillMethod / L_Doc2SetFillMethodExt function. There is no corresponding function for specifying the default recognition module.
New zones created by this function always have empty strings in their 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.
Required DLLs and Libraries
L_INT Doc2FindZonesExample(L_HDOC2 hDoc,L_INT nPageIndex)
nRet = L_Doc2GetZoneOptions (hDoc, &ZoneOpts, sizeof(AUTOZONEOPTS2));
if(nRet != SUCCESS)
ZoneOpts.bEnableForceSingleColumn = TRUE;
ZoneOpts.bDetectNonGridedTables = TRUE;
nRet = L_Doc2SetZoneOptions (hDoc, &ZoneOpts);
if(nRet != SUCCESS)
nRet = L_Doc2FindZones(hDoc, nPageIndex);
if (nRet == SUCCESS)
MessageBox(NULL, TEXT("The engine finds all available zones in the specified page."), TEXT("Notice!"), MB_OK);
nRet = L_Doc2GetZoneCount(hDoc, nPageIndex, &nOcrZoneCount);
if (nRet != SUCCESS)
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);