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

# SaveToTextFile Method of the PlainText Object

This method saves the recognized text from the [PlainText](/fine-reader/engine/api-reference/text-related-objects/plaintext) object into a text file with the specified encoding.

## Syntax

### C++

```cpp theme={null}
HRESULT SaveToTextFile(
  BSTR                 Path,
  TextEncodingTypeEnum encodingType,
  CodePageEnum         codePageEnum
);
```

### C\#

```csharp theme={null}
void SaveToTextFile(
  string               Path,
  TextEncodingTypeEnum encodingType,
  CodePageEnum         codePageEnum
);
```

### Visual Basic .NET

```vb theme={null}
Sub SaveToTextFile( _
  Path As String, _
  encodingType As TextEncodingTypeEnum, _
  codePageEnum As CodePageEnum _
)
```

## Parameters

Path

\[in] A string containing the full path to the file where the text should be saved. If this file does not exist, it will be created. If it exists, it will be overwritten without prompt.

encodingType

\[in] Specifies the text encoding type. It may be set to one of the constants from the [TextEncodingTypeEnum](/fine-reader/engine/api-reference/enumerations/textencodingtypeenum) enumeration.

codePageEnum

\[in] Specifies the code page. It may be set to one of the constants from the [CodePageEnum](/fine-reader/engine/api-reference/enumerations/codepageenum) enumeration. The value of this parameter is taken into account only when the encodingType parameter has value TET\_Simple (exported text is not Unicode). If this property does not specify any code page (CP\_Null), the code page is selected automatically.

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

## See also

[PlainText](/fine-reader/engine/api-reference/text-related-objects/plaintext)
