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

# AddNewPageEx

> Add a page image from a file to a FlexiCapture document with the AddNewPageEx Web Services API method.

## What it does

Adds a page image from a file into a document. This method replaces the [AddNewPage](/flexi-capture/api/methods/add-new-page) method from the previous version of the Web Services API.

The added images become accessible only after they are pre-processed. Use the [ProcessBatch](/flexi-capture/api/methods/process-batch) method to start batch processing after you add the images. Alternatively, if the images were added to the documents of a task opened with the [OpenTask](/flexi-capture/api/methods/open-task) method, use the [CloseTaskEx](/flexi-capture/api/methods/close-task-ex) method to close the task and send it to the **Import** stage.

## Definition

```csharp theme={null}
int AddNewPageEx(int sessionId, int batchId, int documentId, PageEx page, 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 into which a page is to be added |
| `page`       | [PageEx](/flexi-capture/api/structures/page-ex) | A description of the page                               |
| `file`       | [File](/flexi-capture/api/structures/file)      | The file that contains the page image                   |

## Add a page image with a POST request

You can also use a [POST request](/flexi-capture/api/files/files) to add a page image. First, add a page without an image using this method.

Then execute a POST request with the following parameters:

* `Action = Save`
* `objectType = 0`
* `objectId = documentId`
* `version = 0`
* `streamName = "Page pageId"`, where `pageId` is the page ID returned by the `AddNewPageEx` method

## Returned value

| Type  | Description              |
| ----- | ------------------------ |
| `int` | The ID of the added page |
