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

# ReplacePageImage

> ReplacePageImage method in the ABBYY FlexiCapture web services API swaps the image of an existing page in a document with a new File supplied by the caller.

## What it does

Replaces a page image.

<Warning>
  The added images will become accessible only after they are pre-processed. Use the [ProcessBatch](/flexi-capture/api/methods/process-batch) method to initiate batch processing after you have added the images or use the [CloseTask](/flexi-capture/api/methods/close-task) method to close the task and to send it in the Import stage if the images were added into the documents of a task that was opened with the [OpenTask](/flexi-capture/api/methods/open-task) method.
</Warning>

## Definition

```
void ReplacePageImage( int sessionId, int batchId, int documentId, int pageId, File file );
```

## Parameters

| **Name**   | **Type**                                   | **Description**                                         |
| ---------- | ------------------------------------------ | ------------------------------------------------------- |
| sessionId  | int                                        | The ID of the connection to the Application Server      |
| batchId    | int                                        | The ID of the batch that contains the document          |
| documentId | int                                        | The ID of the document in which to replace a page image |
| pageId     | int                                        | The ID of the page whose image is to be replaced        |
| file       | [File](/flexi-capture/api/structures/file) | The file of the image                                   |

<Note>
  You can also use a [POST request](/flexi-capture/api/files/files) to add page image. Call this method and then execute a POST request with the following parameters:
</Note>

* Action = Save
* objectType = 0
* objectId = documentId
* version = 0
* streamName = "Page pageId", where pageId the ID of the page whose image is to be replaced

## Returned value

None.
