# PdfViewerApi reference

Imperative viewer API, available through `ref` and passed to `renderToolbar`. Values are a
snapshot of the render that produced the object.

## Used by

- [Imperative API](https://react-pdf-viewer-chi.vercel.app/react-pdf-viewer/imperative-api.md)

## Import

```ts
import type { PdfViewerApi } from '@kingtech/react-pdf-viewer';
```

## Properties

| Name | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `status` | `PdfDocumentStatus` | — | Yes | Document status. |
| `numPages` | `number` | — | Yes | Page count; `0` without a document. |
| `page` | `number` | — | Yes | Current 1-based page, clamped to the document. |
| `scale` | `number` | — | Yes | Current scale (`1` = 100%). |
| `rotation` | `Rotation` | — | Yes | Current user rotation. |
| `fullscreen` | `boolean` | — | Yes | Whether the viewer is in fullscreen. |
| `canZoomIn` | `boolean` | — | Yes | Whether `zoomIn()` would change the scale. |
| `canZoomOut` | `boolean` | — | Yes | Whether `zoomOut()` would change the scale. |
| `goToPage` | `(page: number) => void` | — | No | Go to a page (clamped). |
| `nextPage` | `() => void` | — | No | Next page. |
| `previousPage` | `() => void` | — | No | Previous page. |
| `zoomIn` | `() => void` | — | No | One step (or preset) up. |
| `zoomOut` | `() => void` | — | No | One step (or preset) down. |
| `setScale` | `(scale: number) => void` | — | No | Set the scale, clamped to `[minScale, maxScale]`. |
| `resetZoom` | `() => void` | — | No | Return to `defaultScale`. |
| `rotate` | `(direction?: 'cw' \| 'ccw') => void` | — | No | Rotate by 90°, clockwise by default. |
| `toggleFullscreen` | `() => void` | — | No | Enter or leave fullscreen. |
| `download` | `() => Promise<void>` | — | No | Save the loaded document (no second request). |
| `print` | `() => Promise<void>` | — | No | Print according to `printMode`. |
| `reload` | `() => void` | — | No | Load the source again, e.g. after an error. |
| `getDocument` | `() => PDFDocumentProxy \| null` | — | No | The loaded PDF.js document, for advanced use. Do not destroy it. |

## Source

[packages/react-pdf-viewer/src/types.ts](https://github.com/kiralygyula92/react-pdf-viewer/blob/main/packages/react-pdf-viewer/src/types.ts#L153)

