PagesApi.duplicate()
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.methodStructuresince 1.0.0
Signature
duplicate(pageIndex: number, options?: SignedDocumentOptions): Promise<number>
Parameters
| 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 lacksedit-pages.DOCUMENT_CLOSED— the document has been closed.INVALID_STATE— a certified document whose certification forbids it, unlessoptions.invalidateSignatures; or a progressive document still downloading.
Example
TypeScript
const copyIndex = await doc.pages.duplicate(0);