# PagesApi.rotate()

```ts
rotate(pageIndex: number, by: PageTurn, options?: SignedDocumentOptions): Promise<void>
```

Turns the page by `by` clockwise degrees from where it stands. Needs the `edit-pages` feature.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `pageIndex` | `number` | Zero-based page index. |
| `by` | `PageTurn` | Clockwise degrees from where the page stands: `90`, `180`, `270`, or negative for counter-clockwise. |
| `options?` | `SignedDocumentOptions` | `{ invalidateSignatures? }`. |

Returns `Promise<void>`

Throws:

- `INVALID_ARGUMENT` — a page index out of range, or `by` is `0` or anything but a multiple of 90.
- `PAGE_ERROR` — the page could not be loaded.
- `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
await doc.pages.rotate(0, 90);
await doc.pages.rotate(1, -90); // counter-clockwise
```

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