# PDFViewer.snapshot()

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

Save current document state for undo (called automatically after committed edits). Skipped, with an `error` event, while a progressively-loaded document is still downloading — so undo has a gap until [whenFullyLoaded()](https://kernstra.com/docs/web-sdk/api/pdfdocument/whenfullyloaded) resolves. A change whose undo step could not be recorded (an `error` with `EXPORT_FAILED`) still counts: `hasUnsavedChanges` turns true and `documentChanged` reports it. A change made through the document API while Edit Text has unwritten edits writes those edits first, then reloads; if they cannot be written, the viewer reports `INVALID_STATE` on `error` and the edits are lost.

- Kind: method
- Since: 1.0.0

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

Throws:

- `INVALID_STATE` after `destroy()`.

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