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

# AddNewPage

> AddNewPage method in the ABBYY FlexiCapture web services API adds a page image and its description to a document at a chosen position within the set.

## What it does

Adds a page image to a document.

<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. Another option is to use the [CloseTask](/flexi-capture/api/methods/close-task) method to close the task and to send it at 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

```
int AddNewPage( int sessionId, int batchId, int documentId, int previousItemId, Page page, File file );
```

## Parameters

<table width="100%"><tbody><tr><td><p><strong>Name</strong></p></td><td><p><strong>Type</strong></p></td><td><p><strong>Description</strong></p></td></tr><tr><td><p>sessionId</p></td><td><p>int</p></td><td><p>The ID of the connection to the Application Server</p></td></tr><tr><td><p>batchId</p></td><td><p>int</p></td><td><p>The ID of the batch that contains the document</p></td></tr><tr><td><p>documentId</p></td><td><p>int</p></td><td><p>The ID of the document into which a page is to be added</p></td></tr><tr><td><p>previousItemId</p></td><td><p>int</p></td><td><p>The ID allowing explicit specification of the position of the new page in the set:</p><ul><li><strong>-1</strong> - the new page will be added at the end of the set</li><li><strong>0</strong> - the new page will be added at the start of the set</li><li><strong>Page ID</strong> - the new page will be added after the page with this ID<br /><strong>Note: </strong> A page with this ID must exist.</li></ul></td></tr><tr><td><p>page</p></td><td><p><a href="/flexi-capture/api/structures/page">Page</a></p></td><td><p>A description of the page. It is recommended to add pages with a predefined ID field</p></td></tr><tr><td><p>file</p></td><td><p><a href="/flexi-capture/api/structures/file">File</a></p></td><td><p>The file that contains the page image</p></td></tr></tbody></table>

<Note>
  You can also use a [POST request](/flexi-capture/api/files/files) to add a new page from the file containing an image. To do this, create a page with an empty file using this method: (file.Name = "FileName", file.Bytes = new bytes \[0]). Next, execute a POST request with the following parameters:
</Note>

* Action = Save
* objectType = 1
* objectId = documentId, where documentId represents the ID of the document, to which a page should be added
* version = 0
* streamName = "Page 1", where 1 represents the page ID returned by the AddNewPage method

## Returned value

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