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

# FindPageSplitPosition Method of the FRPage Object

This method finds the position of splitting the image on pages, if it exists. It is used to detect the possibility of splitting dual pages in a book.

To find the position where the image can be split:

1. Detect orientation of the image using the [IFRPage::DetectOrientation](/fine-reader/engine/api-reference/document-related-objects/frpage/detectorientation-method) method.
2. Pass the returned [TextOrientation](/fine-reader/engine/api-reference/text-related-objects/textorientation) object to the FindPageSplitPosition method.

The split position is defined by two lines, the coordinates of which are returned in the startSplitPosition and endSplitPosition parameters. The image area between these two lines should be removed when splitting image on pages. This area usually contains some garbage.

## Syntax

### C++

```cpp theme={null}
HRESULT FindPageSplitPosition(
  IObjectsExtractionParams* ExtractionParams,
  ITextOrientation*         TextOrientation,
  PageSplitDirectionEnum*   SplitDirection,
  int*                      StartSplitPosition,
  int*                      EndSplitPosition
);
```

### C\#

```csharp theme={null}
void FindPageSplitPosition(
  IObjectsExtractionParams    ExtractionParams,
  ITextOrientation            TextOrientation,
  out PageSplitDirectionEnum SplitDirection,
  out int                    StartSplitPosition,
  out int                    EndSplitPosition
);
```

### Visual Basic .NET

```vb theme={null}
Sub FindPageSplitPosition( _
  ExtractionParams As IObjectsExtractionParams, _
  TextOrientation As TextOITextOrientationrientation, _
  ByRef SplitDirection As PageSplitDirectionEnum, _
  ByRef StartSplitPosition As Integer, _
  ByRef EndSplitPosition As Integer _
)
```

## Parameters

ExtractionParams

\[in] 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.

TextOrientation

\[in] Refers to the [TextOrientation](/fine-reader/engine/api-reference/text-related-objects/textorientation) object that specifies orientation of the text on the image. If this parameter is 0, ABBYY FineReader Engine presumes that the image has normal orientation.

SplitDirection

\[out] This variable receives the type of possible split: vertical split, horizontal split, or no split. Refer to the [PageSplitDirectionEnum](/fine-reader/engine/api-reference/enumerations/pagesplitdirectionenum) description for details.

StartSplitPosition

\[out] The coordinate of the first line which defines split position (if a split is possible). The meaning of this value depends on the value of the splitDirection variable. If the possibility of vertical split is detected, it contains the horizontal coordinate of the split line. If the possibility of horizontal split is detected, it contains the vertical coordinate of the split line. Coordinate is given against the deskewed black-and-white page of the image.

EndSplitPosition

\[out] The coordinate of the second line which defines split position (if a split is possible). The meaning of this value depends on the value of the splitDirection variable. If the possibility of vertical split is detected, it contains the horizontal coordinate of the split line. If the possibility of horizontal split is detected, it contains the vertical coordinate of the split line. Coordinate is given against the deskewed black-and-white page of the image.

## 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}
  private bool splitImage(FREngine.IFRPage page, FREngine.IFRDocument frDoc, FREngine.IPageProcessingParams ppp)
  {
   int splitStartPosition = 0;
   int splitEndPosition = 0;
   bool isVerticalSplit = true;
   // Detect text orientation
   FREngine.ITextOrientation ori = page.DetectOrientation(null, ppp.ObjectsExtractionParams, ppp.RecognizerParams);
   // Find split position
   FREngine.PageSplitDirectionEnum pageSplitDirection;
   page.FindPageSplitPosition(ppp.ObjectsExtractionParams, ori, out pageSplitDirection, out splitStartPosition, out splitEndPosition);
   if (pageSplitDirection == FREngine.PageSplitDirectionEnum.PSD_NoSplit)
   {
    return false;
   }
   else if (pageSplitDirection == FREngine.PageSplitDirectionEnum.PSD_HorizontalSplit)
   {
    isVerticalSplit = false;
   }
   // Split the image in two pages
   // Image dimensions
   int width = page.ImageDocument.ColorImage.Width;
   int height = page.ImageDocument.ColorImage.Height;
   // Duplicate page
   frDoc.AddPage(page);
   FREngine.IFRPage secondPage = frDoc.Pages[frDoc.Pages.Count - 1];
   // Crop first and second pages
   FREngine.IImageModification firstModification = engine.CreateImageModification();
   FREngine.IRegion firstClipRegion = engine.CreateRegion();
   FREngine.IImageModification secondModification = engine.CreateImageModification();
   FREngine.IRegion secondClipRegion = engine.CreateRegion();
   if (isVerticalSplit)
   {
    firstClipRegion.AddRect(0, 0, splitStartPosition, height - 1 );
    secondClipRegion.AddRect(splitEndPosition, 0, width - 1, height - 1);
   }
   else
   {
    firstClipRegion.AddRect(0, 0, width - 1, splitStartPosition);
    secondClipRegion.AddRect(0, splitEndPosition, width - 1, height - 1);
   }
   firstModification.AddClipRegion(firstClipRegion);
   page.ImageDocument.Modify(firstModification);
   secondModification.AddClipRegion(secondClipRegion);
   secondPage.ImageDocument.Modify(secondModification);
   return true;
  }
  ```
</Accordion>

## See also

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

[DetectOrientation](/fine-reader/engine/api-reference/document-related-objects/frpage/detectorientation-method)

[PageSplitDirectionEnum](/fine-reader/engine/api-reference/enumerations/pagesplitdirectionenum)

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