#include "ltdoc2.h"
L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2DetectOrientationDegree(hDoc, nPageIndex, pnRotate)
Determines the angle by which the specified page needs to be oriented.
Handle to the OCR document.
Index of the page for which to get the orientation angle. This index is zero-based.
Pointer to a variable to be updated with the orientation angle, in degrees. Possible values are: +90, +180, and +270. The rotation is clockwise.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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:
is much more readable than the same page oriented like this:
✎ NOTE
This function just provides the angle of orientation that is needed. It does not actually orient the page. To automatically orient the page, call the L_Doc2AutoOrientPage / L_Doc2AutoOrientPageExt function.
If the specified page does not need to be oriented the pnRotate parameter is updated with 0.
Required DLLs and Libraries
L_INT Doc2DetectOrientationDegreeExample(L_HDOC2 hDoc,L_INT nPageIndex)
{
L_INT nRet;
L_INT nRotate = 0;
nRet = L_Doc2DetectOrientationDegree(hDoc, nPageIndex, &nRotate);
if (nRet == SUCCESS)
{
L_TCHAR szBuffer[1024];
wsprintf(szBuffer, TEXT("Orientation degree = %d"), nRotate);
MessageBox(NULL, szBuffer, TEXT("Notice!"), MB_OK);
}
else
return nRet;
return SUCCESS;
}