# PdfViewerActions (@salmonui/pdf-viewer)

> The PdfViewerActions interface of @salmonui/pdf-viewer: Commands (actionsRef).

Canonical: https://salmonui.dev/docs/reference/pdf-viewer/PdfViewerActions

```ts
import type { PdfViewerActions } from '@salmonui/pdf-viewer';
```

Entry index: https://salmonui.dev/docs/reference/pdf-viewer (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/pdf-viewer.md).

## Reference

Kind: interface

```ts
interface PdfViewerActions {
    goToPage(page: number): void;
    search(query: string, options?: PdfViewerSearchOptions): Promise<PdfViewerSearchResult>;
    findNext(): void;
    findPrevious(): void;
    clearSearch(): void;
    setZoom(zoom: PdfViewerZoom): void;
    print(): Promise<boolean>;
    save(): Promise<Blob>;
    download(fileName?: string): Promise<void>;
    addTextMarkup(kind: PdfTextMarkupKind, options?: {
        readonly color?: string;
        readonly opacity?: number;
        readonly comment?: string;
    }): readonly PdfTextMarkupAnnotation[];
    removeAnnotation(id: string): void;
    getState(): PdfViewerStateSnapshot;
    openFind(open?: boolean): void;
}
```

Commands (`actionsRef`).

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `goToPage` | `goToPage(page: number): void;` |  | Scrolls to a page (1-based, clamped). |
| `search` | `search(query: string, options?: PdfViewerSearchOptions): Promise<PdfViewerSearchResult>;` |  | Runs a search over every page; resolves when all pages are searched. |
| `findNext` | `findNext(): void;` |  |  |
| `findPrevious` | `findPrevious(): void;` |  |  |
| `clearSearch` | `clearSearch(): void;` |  |  |
| `setZoom` | `setZoom(zoom: PdfViewerZoom): void;` |  |  |
| `print` | `print(): Promise<boolean>;` |  | Opens the print dialog; resolves `false` when `onBeforePrint` cancelled. |
| `save` | `save(): Promise<Blob>;` |  | The document with the current form values and text markup annotations written into it. |
| `download` | `download(fileName?: string): Promise<void>;` |  | Saves and downloads as `fileName` (default the `fileName` prop). |
| `addTextMarkup` | `addTextMarkup(kind: PdfTextMarkupKind, options?: {     readonly color?: string;     readonly opacity?: number;     readonly comment?: string; }): readonly PdfTextMarkupAnnotation[];` |  | Marks the current text selection; returns the new annotations (one per page). |
| `removeAnnotation` | `removeAnnotation(id: string): void;` |  |  |
| `getState` | `getState(): PdfViewerStateSnapshot;` |  | Current page, page count and scale. |
| `openFind` | `openFind(open?: boolean): void;` |  | Opens or closes the find bar. |
