#include "ltdoc2.h"

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

Updates the shape of the specified zone in the user zone list of the specified page.


L_HDOC2 hDoc

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

L_INT nPageIndex

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

L_INT nZoneIndex

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

RECT * prc

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

L_INT nRectCount

Number of rectangle array elements being set.


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


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

To add a user zone, call the L_Doc2AddZone / L_Doc2AddZoneExt function. To add rectangle(s) to a user zone, making its shape an irregular shape, call the L_Doc2AddZoneRect / L_Doc2AddZoneRectExt function.

Required DLLs and Libraries

See Also




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"), 
      MessageBox(NULL, szBuffer, TEXT("Notice"), 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.