API reference: @salmonui/pdf-viewer
PdfViewerActionsinterface
import type { PdfViewerActions } from '@salmonui/pdf-viewer';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).
| Name | Signature | 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 |
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 |
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. |