# PagesApi.duplicate()

```ts
duplicate(pageIndex: number, options?: SignedDocumentOptions): Promise<number>
```

Copies a page and inserts the copy right after it. The copy's form fields are its original's: filling one fills both (left outside the form: a signature field's copy, and every copy in an encrypted document or one with a signed field). Needs the `edit-pages` feature.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `pageIndex` | `number` | Zero-based page index. |
| `options?` | `SignedDocumentOptions` | `{ invalidateSignatures? }`. |

Returns `Promise<number>`: The copy's index.

Throws:

- `INVALID_ARGUMENT` — a page index out of range.
- `PAGE_ERROR` — the page tree is nested too deeply, or the page could not be copied.
- `FEATURE_NOT_LICENSED` — the license lacks `edit-pages`.
- `DOCUMENT_CLOSED` — the document has been closed.
- `INVALID_STATE` — a certified document whose certification forbids it, unless `options.invalidateSignatures`; or a progressive document still downloading.

```ts
const copyIndex = await doc.pages.duplicate(0);
```

Part of [PagesApi](https://kernstra.com/docs/web-sdk/api/doc-pages) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/doc-pages/duplicate
