#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2AddZone(hDoc, nPageIndex, nZoneIndex, pZoneData)
Adds a new zone to the zone list for the specified page.
Handle to the OCR document.
Index of the page on which to add the zone. This is a zero-based index.
Position in the list of zones at which to add new zone. Use -1 to append the page to the end of the list. This is a zero-based index.
Pointer to a ZONEDATA2 structure, which contains the zone data to be added.
| Value | Meaning |
|---|---|
| SUCCESS | The function was successful. |
| < 1 | An error occurred. Refer to Return Codes. |
After the zone is added, the zone list is recalculated automatically.
When adding a zone, the application should directly initialize the following members of the ZONEDATA2 structure, since these members will not take default values:
uStructSizercAreaFillMethodCharFilterTypeRecogModule
The OCR engine manages the ID member of the ZONEDATA2 structure.
The Type member of the ZONEDATA2 structure should be one of the following values:
For successful zone addition:
To find all zones in a specific page, use the L_Doc2FindZones / L_Doc2FindZonesExt function.
Required DLLs and Libraries
L_INT EXT_CALLBACK VerificationCB(L_INT nZoneIndex,L_TCHAR* pszWord,DOC2_VERIFYCODE* pVerify,L_VOID* pUserData){UNREFERENCED_PARAMETER(nZoneIndex);UNREFERENCED_PARAMETER(pszWord);UNREFERENCED_PARAMETER(pVerify);UNREFERENCED_PARAMETER(pUserData);//...//... Set your code here//...return SUCCESS;}L_INT Doc2AddZoneExample(L_HDOC2 hDoc, L_INT nPageIndex){L_INT nRet;ZONEDATA2 ZoneData;L_INT nZoneCount = 0;L_TCHAR szBuffer[100];memset(szBuffer, 0, sizeof(szBuffer));memset(&ZoneData, 0, sizeof(ZONEDATA2));ZoneData.uStructSize = sizeof(ZONEDATA2);ZoneData.rcArea.left = 100;ZoneData.rcArea.top = 100;ZoneData.rcArea.right = 200;ZoneData.rcArea.bottom = 200;ZoneData.FillMethod = DOC2_FILL_DEFAULT;ZoneData.RecogModule = DOC2_RECOGMODULE_AUTO;ZoneData.CharFilter = DOC2_ZONE_CHAR_FILTER_DEFAULT;ZoneData.Type = DOC2_ZONE_FLOWTEXT;ZoneData.uFlags = 0;ZoneData.pfnCallback = VerificationCB;ZoneData.pUserData = NULL;nRet = L_Doc2AddZone(hDoc, nPageIndex, 0, &ZoneData);if (nRet == SUCCESS)MessageBox(NULL, TEXT("The specified zone is added."), TEXT("Notice!"), MB_OK);elsereturn nRet;nRet = L_Doc2GetZoneCount (hDoc, nPageIndex, &nZoneCount);if (nRet != SUCCESS){MessageBox(NULL, TEXT("An error occurred during L_Doc2GetZoneCount"), TEXT("Error!"), MB_OK);return nRet;}else{wsprintf(szBuffer, TEXT("Total zones in the specified page = %d\n"), nZoneCount);MessageBox(NULL, szBuffer, TEXT("Zone Count!"), MB_OK);}return SUCCESS;}