# PagesApi.import()

```ts
import(bytes: Uint8Array, options?: ImportPagesOptions): Promise<number>
```

Inserts every page of another PDF. A page with form fields comes in flattened, as it prints: its fields do not join this document's form. Needs the `edit-pages` feature.

Importing is a load for the license, once the imported file has opened: under a stopped license (paused, revoked, expired, a copied or forged key) it is refused with `LICENSE_REQUIRED`, as opening a document is.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `bytes` | `Uint8Array` | The source PDF. |
| `options?` | `ImportPagesOptions` | `position` (`{ after }` or `{ before }`; appended when omitted), `password` (the source's, if it is encrypted) and `invalidateSignatures`. |

Returns `Promise<number>`: How many pages came in.

Throws:

- `FEATURE_NOT_LICENSED` — the license lacks `edit-pages`.
- `LICENSE_REQUIRED` — the license is stopped.
- `FORMAT_ERROR` — the imported bytes are not a PDF, or a corrupt one.
- `PASSWORD_ERROR` — the imported file needs a password, or `options.password` is wrong.
- `SECURITY_ERROR` — the imported file is encrypted with a security handler the SDK cannot open.
- `INVALID_ARGUMENT` — the position is not a whole number (one past the ends is clamped).
- `PAGE_ERROR` — a page could not be copied in, its form fields could not be flattened, or the page tree is nested too deeply.
- `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 other = new Uint8Array(await (await fetch('/terms.pdf')).arrayBuffer());
const added = await doc.pages.import(other); // appended at the end
```

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/import
