#include "ltdoc2.h"
L_LTDOC2_API L_INT L_Doc2SetZoneLayoutExt(hDoc, nDocId, nPageIndex, nZoneIndex, prc, nRectCount)
Updates the shape of the specified zone in the user zone list of the specified page.
Handle to the OCR document. This handle is obtained by calling the L_Doc2StartUp function.
Document ID created by calling L_Doc2CreateDocument.
Zero-based index of the page.
Zero-based index of the zone.
Array of rectangles to be used when setting the specified zone on the specified page.
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
L_INT Doc2ZoneLayoutExampleExt(L_HDOC2 hDoc, L_INT nDocId, 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_Doc2SetZoneLayoutExt(hDoc, nDocId, nPageIndex, nZoneIndex, rcZoneLayout, 2);
if (nRet != SUCCESS)
return nRet;
COLORREF clr;
L_Doc2GetZoneColorExt(hDoc, nDocId, 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_Doc2GetZoneLayoutExt(hDoc, nDocId, nPageIndex, nZoneIndex, NULL, &nRectCount);
if (nRet != SUCCESS)
return nRet;
RECT * pRects = (RECT *)GlobalAllocPtr(GHND, sizeof(RECT) * nRectCount);
nRet = L_Doc2GetZoneLayoutExt(hDoc, nDocId, 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;
}