L_DocDetectOrientationDegree

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocDetectOrientationDegree (hDoc, nPageIndex, * pnRotate)

L_HDOC hDoc;

/* handle to the OCR document.*/

L_INT nPageIndex;

/* page index */

L_INT * pnRotate;

/* pointer to a variable */

Determines the angle by which the specified page needs to be oriented.

Parameter

Description

hDoc

Handle to the OCR document.

nPageIndex

Specifies the index of the page for which to get the orientation angle. This index is zero-based.

pnRotate

Pointer to a variable to be updated with the orientation angle, in degrees. Possible values are: +90, +180, and +270. The rotation is clockwise.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The purpose of orientation is to make the page more readable during recognition by making sure the top of the page is positioned properly. That is, a page that is oriented correctly like this:

image\orientpage1.gif

is much more readable than the same page oriented like this:

image\orientpage2.gif

Please note that this function just provides the angle of orientation that is needed. It does not actually orient the page. To orient the page, call L_DocAutoOrientPage.

If the specified page does not need to be oriented the pnRotate parameter is updated with 0.

To automatically orient a page, call L_DocAutoOrientPage.

Required DLLs and Libraries

LTDOC

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_DocLockPage, L_DocUnlockPage, L_DocSetActivePage, L_DocSelectZoneByPoint, L_DocSelectZone, L_DocRemoveSelectedZone, L_DocSetZonePen, L_DocSetSelectedZonePen, L_DocGetSelectedZone, L_DocZone, L_DocCleanUpPages

Topics:

OCR Functions: Pages

 

Working with Pages

Example

void TestOrientPage(L_HDOC hDoc, L_INT nPageIndex)
{
   L_INT nRotate=0;
   L_INT nRet = L_DocDetectOrientationDegree(hDoc, nPageIndex, &nRotate);

   if (nRet == SUCCESS)
   {
      L_TCHAR szBuffer[1024];

      wsprintf(szBuffer, TEXT("Orientation degree = %d"), nRotate);
      AfxMessageBox(szBuffer);
   }
}