L_Doc2GetZone

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2GetZone(hDoc, nPageIndex, nZoneIndex, pZoneData, uStructSize)

L_HDOC2 hDoc;

/* handle to the OCR document */

L_INT nPageIndex;

/* page index */

L_INT nZoneIndex;

/* zone index */

pZONEDATA2 pZoneData;

/* pointer to a ZONEDATA2 structure */

L_UINT uStructSize;

/* size of the structure */

Gets information about the zone at the specified index in the zone list of the specified page

Parameter

Description

hDoc

Handle to the OCR document

nPageIndex

Index of the page from which to get the zone information. This is a zero-based index.

nZoneIndex

Index of the zone for which to get the information. This is a zero-based index.

pZoneData

Pointer to a ZONEDATA2 structure that will be updated with zone information.

uStructSize

Size in bytes, of the structure pointed to by pZoneData, use sizeof(ZONEDATA2) to calculate this value.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Retrieves zone information for the specified zone index in the specified page.

To remove a specific zone, call the L_Doc2RemoveZone function.

To add a zone, call the L_Doc2AddZone function.

Required DLLs and Libraries

LTDOC2

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_Doc2AddZone, L_Doc2GetZoneCount, L_Doc2UpdateZone, L_Doc2RemoveZone, L_Doc2ImportZones, L_Doc2ExportZones, L_Doc2FindZones, L_Doc2SetZoneOptions, L_Doc2GetZoneOptions

Topics:

OCR Functions: Zones

 

Working with Zones

Example

L_LTDOC2TEX_API  L_INT Doc2GetZoneExample(L_HDOC2 hDoc,
                                        L_INT nPageIndex,
                                        L_INT nZoneIndex)
{
   L_INT nRet;
   ZONEDATA2 ZoneData;
   ZeroMemory(&ZoneData, sizeof(ZONEDATA2));

   nRet = L_Doc2GetZone(hDoc, nPageIndex, nZoneIndex, &ZoneData, sizeof(ZONEDATA2));
   if (nRet != SUCCESS)
   {
      MessageBox(NULL, TEXT("Couldn't get the specified zone information."), TEXT("Error!"), MB_OK);
      return nRet;
   }

   if (ZoneData.FillMethod != DOC2_FILL_OCRA)
      ZoneData.FillMethod = DOC2_FILL_OCRA;

   if (ZoneData.Type != DOC2_ZONE_GRAPHIC)
      ZoneData.Type = DOC2_ZONE_GRAPHIC;

   nRet = L_Doc2UpdateZone(hDoc, nPageIndex, nZoneIndex, &ZoneData);
   if (nRet == SUCCESS)
      MessageBox(NULL, TEXT("The specified zone is updated."), TEXT("Notice!"), MB_OK);
   else
      return nRet;

   return SUCCESS;
}