#include "ltdoc2.h"

L_LTDOC2_API L_INT L_Doc2GetZoneNodesExt(hDoc, nDocId, nPageIndex, nZoneIndex, ppPoints, pnNodesCount)

Gets the polygon of the user zone.


L_HDOC2 hDoc

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

L_INT nDocId

Document ID created by calling L_Doc2CreateDocument.

L_INT nPageIndex

Zero-based index of the page.

L_INT nZoneIndex

Zero-based index of the zone.

PPOINT * ppPoints

Address of an array of POINT structures to be updated with polygon points

L_INT * pnNodesCount

Address of a variable to be updated with the number of polygon points.


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



This function does not work on OMR zones, because OMR zones need a regular shape.

This function retrieves a polygon, which consists of the vertices of a user zone. This can be useful for an application with a GUI when drawing irregular zones.

To use the function properly:

  1. Call it with passing NULL to ppPoints to get the number of polygon points.
  2. Allocate an array of POINT structures using the obtained number.
  3. Call it a second time, passing the address of the allocated array to the ppPoints parameter to obtain the polygon points.

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

To get zone rectangles, call the L_Doc2GetZoneLayout / L_Doc2GetZoneLayoutExt function. To set zone rectangles call the L_Doc2SetZoneLayout / L_Doc2SetZoneLayoutExt function.

Required DLLs and Libraries

See Also




L_INT Doc2ZoneNodesExample(L_HDOC2 hDoc, L_INT nDocId, L_INT nPageIndex, L_INT nZoneIndex) 
   L_INT nRet; 
   L_INT nNodesCount; 
   POINT * pNodes = NULL; 
   nRet = L_Doc2GetZoneNodesExt(hDoc, nDocId, nPageIndex, nZoneIndex, NULL, &nNodesCount); 
   if (nRet != SUCCESS) 
      return nRet; 
   pNodes = (POINT *)GlobalAllocPtr(GHND, sizeof(POINT) * nNodesCount); 
   nRet = L_Doc2GetZoneNodesExt(hDoc, nDocId, nPageIndex, nZoneIndex, &pNodes, &nNodesCount); 
   if (nRet != SUCCESS) 
      return nRet; 
   L_TCHAR szBuffer[100]; 
   for(int i=0; i<nNodesCount; i++) 
      memset(szBuffer, 0, sizeof(szBuffer)); 
      wsprintf(szBuffer, TEXT("Zone Nodes # %d\nx = %d\ny = %d\n"), 
      MessageBox(NULL, szBuffer, TEXT("Notice"), MB_OK); 
   return SUCCESS; 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help