#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.


L_HDOC2 hDoc

Handle to the OCR document.

L_INT nPageIndex

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

L_INT * 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.


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:



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

See Also




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); 
      return nRet; 
   return SUCCESS; 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help