# PDFViewer.undo()

```ts
undo(): Promise<void>
```

Restore previous document state. Edit Text edits pending are written first, as one step, and that step is what this undo backs out; nothing is undone when the write is refused.

- Kind: method
- Since: 1.0.0

Returns `Promise<void>`: Resolves once restored.

Throws:

- `INVALID_STATE` after `destroy()`.

```ts
if (viewer.canUndo()) await viewer.undo();
```

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

Web page: https://kernstra.com/docs/web-sdk/api/pdfviewer/undo
