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

# SaveToFile Method of the ImageDocument Object

This method saves the contents of the [ImageDocument](/fine-reader/engine/api-reference/image-related-objects/imagedocument) object into a file. The file is saved in a format which cannot be viewed in any external program. The ImageDocument object saved using this method can be opened with the help of the [IEngine::LoadImageDocFromFile](/fine-reader/engine/api-reference/engine-object-iengine-interface/processing-methods/loadimagedocfromfile-method) method only.

## Syntax

### C++

```cpp theme={null}
HRESULT SaveToFile( BSTR FileName );
```

### C\#

```csharp theme={null}
void SaveToFile( string FileName );
```

### Visual Basic .NET

```vb theme={null}
Sub SaveToFile(FileName As String)
```

## Parameters

**FileName**

\[in] This parameter stores the full path to the file. For example, /Users/user/Documents/MyPic.imageDoc, /home/user/Pictures/MyPic.imageDoc, C:\MyPic.imageDoc. If this file already exists, it is overwritten without prompt.

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

## Remarks

This method is not suitable for saving images, as it saves the contents of the ImageDocument object in a format not suitable for viewing. It is designed for situations when it is not possible to use the [IImageDocument::SaveTo](/fine-reader/engine/api-reference/image-related-objects/imagedocument/saveto-method) method which saves the object's contents into a folder on disk.

To save an image in a format suitable for viewing, use the [IImage::WriteToFile](/fine-reader/engine/api-reference/image-related-objects/image/writetofile-method) method.

## See also

[ImageDocument](/fine-reader/engine/api-reference/image-related-objects/imagedocument)

[IEngine::LoadImageDocFromFile](/fine-reader/engine/api-reference/engine-object-iengine-interface/processing-methods/loadimagedocfromfile-method)
