L_Doc2CopyOCRZones

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2CopyOCRZones(hDoc, nPageIndex)

L_HDOC2 hDoc;

/* handle to the OCR document */

L_INT nPageIndex;

/* page index */

Copies the OCR zones to the User Zones list.

Parameter

Description

hDoc

Handle to the OCR document.

nPageIndex

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

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function will automatically copy all zones that the engine detects to the User Zones list by calling L_Doc2FindZones. This allows you to update all of the zone data. Note that before copying the detected zones it will remove all existing zones in the user list.

L_Doc2CopyOCRZones

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_Doc2FindZones, L_Doc2AddZone, L_Doc2GetZoneCount, L_Doc2GetZone, L_Doc2UpdateZone, L_Doc2RemoveZone, L_Doc2ImportZones, L_Doc2ExportZones, L_Doc2SetZoneOptions, L_Doc2GetZoneOptions

Topics:

OCR Functions: Zones

 

Working with Zones

Example

L_LTDOC2TEX_API  L_INT DocCopyZonesExample(L_HDOC2 hDoc, L_INT nPageIndex)
{
   L_INT nRet;
   AUTOZONEOPTS2 ZoneOpts;

   ZeroMemory(&ZoneOpts, sizeof(AUTOZONEOPTS2));
   nRet = L_Doc2GetZoneOptions (hDoc, &ZoneOpts, sizeof(AUTOZONEOPTS2));
   if(nRet != SUCCESS)
      return nRet;
   ZoneOpts.bEnableForceSingleColumn = TRUE;
   ZoneOpts.bDetectNonGridedTables = TRUE;
   nRet = L_Doc2SetZoneOptions (hDoc, &ZoneOpts);
   if(nRet != SUCCESS)
      return nRet;

   nRet = L_Doc2FindZones(hDoc, nPageIndex);
   if (nRet == SUCCESS)
      MessageBox(NULL, TEXT("The engine finds all available zones in the specified page."), TEXT("Notice!"), MB_OK);

   L_Doc2CopyOCRZones(hDoc, nPageIndex);

   ZONEDATA2 ZoneData;
   ZeroMemory(&ZoneData, sizeof(ZONEDATA2));

   L_Doc2GetZone(hDoc, nPageIndex, 0, &ZoneData, sizeof(ZONEDATA2));
   ZoneData.rcArea.left += 50;
   ZoneData.rcArea.top += 50;
   ZoneData.Type = DOC2_ZONE_FLOWTEXT;

   L_Doc2UpdateZone(hDoc, nPageIndex, 0, &ZoneData);

   return SUCCESS;
}