L_Doc2SetZoneLayout

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2SetZoneLayout(hDoc, nPageIndex, nZoneIndex, prc, nRectCount)

L_HDOC2 hDoc;

/* handle to the OCR document */

L_INT nPageIndex;

/* page index */

L_INT nZoneIndex;

/* zone index */

RECT * prc;

/* pointer to RECT array to set */

L_INT nRectCount;

/* number of array elements */

Updates the shape of the specified zone.

Parameter

Description

hDoc

Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function.

nPageIndex

Index of the page. This is a zero-based index.

nZoneIndex

Index of the zone. This is a zero-based index.

prc

Array of rectangles to be used when setting the specified zone on the specified page.

nRectCount

Number of rectangle array elements being set.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function updates the shape of the specified zone in the user zone list of the specified page.

To get the rectangles for a zone call the L_Doc2GetZoneLayout function.

To add a user zone, call the L_Doc2AddZone function. To add rectangle(s) to a user zone, making its shape an irregular shape, call the L_Doc2AddZoneRect 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_Doc2UpdateZone, L_Doc2GetZoneCount, L_Doc2GetZone, L_Doc2RemoveZone, L_Doc2ImportZones, L_Doc2ExportZones, L_Doc2FindZones, L_Doc2SetZoneOptions, L_Doc2GetZoneOptions, L_Doc2AddZoneRect, L_Doc2GetZoneColor, L_Doc2GetZoneLayout, L_Doc2GetZoneNodes, L_Doc2ExcludeZoneRect

Topics:

Working with Zones

Example

L_LTDOC2TEX_API  L_INT Doc2ZoneLayoutExample(L_HDOC2 hDoc, L_INT nPageIndex, L_INT nZoneIndex)
{
   L_INT nRet;
   RECT rcZoneLayout[2];

   rcZoneLayout[0].left = 10;
   rcZoneLayout[0].top = 10;
   rcZoneLayout[0].right = 50;
   rcZoneLayout[0].bottom = 50;

   rcZoneLayout[1].left = 25;
   rcZoneLayout[1].top = 25;
   rcZoneLayout[1].right = 75;
   rcZoneLayout[1].bottom = 75;
   nRet = L_Doc2SetZoneLayout(hDoc, nPageIndex, nZoneIndex, rcZoneLayout, 2);
   if (nRet != SUCCESS)
      return nRet;

   COLORREF clr;
   L_Doc2GetZoneColor(hDoc, nPageIndex, nZoneIndex, &clr);
   L_TCHAR szBuffer[100];
   memset(szBuffer, 0, sizeof(szBuffer));

   wsprintf(szBuffer, TEXT("Zone color = %d"), clr);
   MessageBox(NULL, szBuffer, TEXT("Get Zone Color"), MB_OK);

   L_INT nRectCount=0;
   nRet = L_Doc2GetZoneLayout(hDoc, nPageIndex, nZoneIndex, NULL, &nRectCount);
   if (nRet != SUCCESS)
      return nRet;

   RECT * pRects = (RECT *)GlobalAllocPtr(GHND, sizeof(RECT) * nRectCount);

   nRet = L_Doc2GetZoneLayout(hDoc, nPageIndex, nZoneIndex, &pRects, &nRectCount);
   if (nRet != SUCCESS)
      return nRet;

   for(int i=0; i<nRectCount; i++)
   {
      wsprintf(szBuffer, TEXT("Zone Layout # %d\nLeft = %d\nTop = %d\nRight = %d\nBottom = %d\n"),
         i,
         pRects[i].left,
         pRects[i].top,
         pRects[i].right,
         pRects[i].bottom);

      MessageBox(NULL, szBuffer, TEXT("Notice"), MB_OK);
   }

   GlobalFreePtr(pRects);
   return SUCCESS;
}