> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DetectOrientation Method of the FRPage Object

This method detects text orientation on the image. The method returns [TextOrientation](/fine-reader/engine/api-reference/text-related-objects/textorientation) object, if orientation has been detected successfully, and NULL, if the program failed to detect orientation.

## Syntax

### C++

```cpp theme={null}
HRESULT DetectOrientation(
  IObjectsExtractionParams*    ExtractionParams,
  IRecognizerParams*           RecognizerParams,
  ITextOrientation**           Result
);
```

### C\#

```csharp theme={null}
ITextOrientation DetectOrientation(
  IObjectsExtractionParams    ExtractionParams,
  IRecognizerParams           RecognizerParams
);
```

### Visual Basic .NET

```vb theme={null}
Function DetectOrientation( _
  [ExtractionParams As IObjectsExtractionParams = Nothing], _
  [RecognizerParams As IRecognizerParams = Nothing] _
) As ITextOrientation
```

## Parameters

ExtractionParams

\[in] This variable refers to the [ObjectsExtractionParams](/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/objectsextractionparams) object that stores parameters of objects extraction. This parameter may be 0. In this case, the objects are extracted with default parameters, or, if a [profile](/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles) has been loaded, the parameters set by this profile are used.

RecognizerParams

\[in] This variable refers to the [RecognizerParams](/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/recognizerparams) object that stores parameters of page recognition. This parameter may be 0. In this case, the default parameters are used, or, if a [profile](/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles) has been loaded, the parameters set by this profile are used.

Result

\[out, retval] A pointer to ITextOrientation\* pointer variable that receives the interface pointer of the [TextOrientation](/fine-reader/engine/api-reference/text-related-objects/textorientation) output object. This object provides access to the text orientation on the page. If orientation detection failed, NULL is returned.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## Samples

<Accordion title="C# code">
  ```csharp theme={null}
  FREngine.IFRDocument frdoc;
  // We presume that the document has been created and images have been added to it
  // Get orientation of every page in the document
  int pagesCount = frDoc.Pages.Count;
  FREngine.RotationTypeEnum[] rotations = new FREngine.RotationTypeEnum[pagesCount];
  for (int i = 0; i < pagesCount; i++)
  {
   FREngine.IFRPage page = frDoc.Pages[i];
   FREngine.ITextOrientation ori = page.DetectOrientation(null, null);
   rotations[i] = FREngine.RotationTypeEnum.RT_UnknownRotation;
   if( ori != null ) {
    rotations[i] = ori.RotationType;
   }
  }
  ```
</Accordion>

## See also

[FRPage](/fine-reader/engine/api-reference/document-related-objects/frpage)

[IPagePreprocessingParams::CorrectOrientationMode](/fine-reader/engine/api-reference/parameter-objects/preprocessing-analysis-recognition-and-synthesis-parameters/pagepreprocessingparams#correctorientationmode)

[Working with Profiles](/fine-reader/engine/guided-tour/advanced-techniques/working-with-profiles)
