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

# AddNewFromPage Method of the Documents Object

This method creates a new document at the specified position in the batch by extracting the specified page from an existing document.

> [!NOTE]
>
> If the document in question has only one page, it will not be duplicated. The number of documents in the batch will stay the same.

## Syntax

```vb Visual Basic .NET theme={null}
Function AddNewFromPage( _
  page As Page, _
  pos As Integer
) As Document
```

```cpp C++ theme={null}
HRESULT AddNewFromPage(
  IPage*      page,
  int         pos,
  IDocument** result
);
```

## Parameters

**page**

\[in] Refers to the [**Page**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/page.md) object, which contains the page from which a new document should be created.

**pos**

\[in] Specifies the index of the new document in the current batch. If the document is inserted in place of the existing document, the documents in the batch are shifted to the right. The document may also be inserted at the end of the batch, in which case the value of this parameter must be equal to the value of the [**IDocuments::Count**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/count.md) property.

**result**

\[out, retval] A pointer to the [**IDocument**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/document.md)**\*** variable that receives the interface pointer for the new document.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FlexiCapture SDK functions](https://docs.abbyy.com/flexi-capture/sdk/api-reference/errorcodes.md).

## See also

[**Documents**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/documents.md)
