# PdfViewerProps (@salmonui/pdf-viewer)

> The PdfViewerProps interface of @salmonui/pdf-viewer.

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

```ts
import type { PdfViewerProps } 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 PdfViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onLoad' | 'onError' | 'children' | 'defaultValue'> {
    readonly src?: PdfViewerSource | null | undefined;
    readonly workerSrc?: string | URL | undefined;
    readonly documentOptions?: Readonly<Record<string, unknown>> | undefined;
    readonly password?: string | undefined;
    readonly onPasswordRequired?: ((request: PdfViewerPasswordRequest) => void) | undefined;
    readonly onLoad?: ((info: PdfViewerLoadInfo) => void) | undefined;
    readonly onLoadError?: ((error: Error) => void) | undefined;
    readonly pageSizes?: readonly PdfPageSize[] | PdfPageSize | undefined;
    readonly pageCount?: number | undefined;
    readonly page?: number | undefined;
    readonly defaultPage?: number | undefined;
    readonly onPageChange?: ((page: number, event: {
        readonly source: PdfViewerEventSource;
    }) => void) | undefined;
    readonly zoom?: PdfViewerZoom | undefined;
    readonly defaultZoom?: PdfViewerZoom | undefined;
    readonly onZoomChange?: ((zoom: PdfViewerZoom, event: {
        readonly scale: number;
        readonly source: PdfViewerEventSource;
    }) => void) | undefined;
    readonly scrollMode?: PdfViewerScrollMode | undefined;
    readonly spreadMode?: PdfViewerSpreadMode | undefined;
    readonly sidebar?: PdfViewerSidebar | null | undefined;
    readonly defaultSidebar?: PdfViewerSidebar | null | undefined;
    readonly onSidebarChange?: ((sidebar: PdfViewerSidebar | null) => void) | undefined;
    readonly toolbar?: readonly PdfViewerToolbarItem[] | false | undefined;
    readonly renderToolbar?: ((context: PdfViewerToolbarContext) => ReactNode) | undefined;
    readonly textSelection?: boolean | undefined;
    readonly linkTarget?: '_blank' | '_self' | '_parent' | '_top' | undefined;
    readonly onLinkClick?: ((event: PdfViewerLinkEvent) => void) | undefined;
    readonly onBeforePrint?: ((event: PdfViewerCancelableEvent) => void) | undefined;
    readonly printResolution?: number | undefined;
    readonly fileName?: string | undefined;
    readonly onSearchResult?: ((result: PdfViewerSearchResult) => void) | undefined;
    readonly annotations?: readonly PdfTextMarkupAnnotation[] | undefined;
    readonly defaultAnnotations?: readonly PdfTextMarkupAnnotation[] | undefined;
    readonly onAnnotationsChange?: ((annotations: readonly PdfTextMarkupAnnotation[], event: PdfViewerAnnotationsChangeEvent) => void) | undefined;
    readonly annotationAuthor?: string | undefined;
    readonly annotationColors?: Partial<Record<PdfTextMarkupKind, string>> | undefined;
    readonly formValues?: PdfFormValues | undefined;
    readonly defaultFormValues?: PdfFormValues | undefined;
    readonly onFormValuesChange?: ((values: PdfFormValues, event: {
        readonly name: string;
    }) => void) | undefined;
    readonly actionsRef?: RefObject<PdfViewerActions | null> | ((actions: PdfViewerActions | null) => void) | undefined;
    readonly localeText?: Partial<PdfViewerLocaleText> | undefined;
    readonly classNames?: Partial<Record<PdfViewerPart, string>> | undefined;
    readonly styles?: Partial<Record<PdfViewerPart, CSSProperties>> | undefined;
    readonly ref?: Ref<HTMLDivElement> | undefined;
}
```

Members (42):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `src` | `readonly src?: PdfViewerSource \| null \| undefined;` | optional | The document. Changing it loads the new document. |
| `workerSrc` | `readonly workerSrc?: string \| URL \| undefined;` | optional | URL of the pdf.js worker module; default the worker that ships with `pdfjs-dist`, bundled through `new Worker(new URL(...))`. |
| `documentOptions` | `readonly documentOptions?: Readonly<Record<string, unknown>> \| undefined;` | optional | Extra `getDocument()` options (`cMapUrl`, `standardFontDataUrl`, `wasmUrl`, `withCredentials`, `httpHeaders`). |
| `password` | `readonly password?: string \| undefined;` | optional | Password of an encrypted document. |
| `onPasswordRequired` | `readonly onPasswordRequired?: ((request: PdfViewerPasswordRequest) => void) \| undefined;` | optional | Replaces the built-in password dialog. |
| `onLoad` | `readonly onLoad?: ((info: PdfViewerLoadInfo) => void) \| undefined;` | optional |  |
| `onLoadError` | `readonly onLoadError?: ((error: Error) => void) \| undefined;` | optional |  |
| `pageSizes` | `readonly pageSizes?: readonly PdfPageSize[] \| PdfPageSize \| undefined;` | optional | Page sizes in PDF points the server can lay out before the engine loads; one size applies to every page. |
| `pageCount` | `readonly pageCount?: number \| undefined;` | optional | Number of pages for placeholders when `pageSizes` is a single size. |
| `page` | `readonly page?: number \| undefined;` | optional | Controlled 1-based page. |
| `defaultPage` | `readonly defaultPage?: number \| undefined;` | optional |  |
| `onPageChange` | `readonly onPageChange?: ((page: number, event: {     readonly source: PdfViewerEventSource; }) => void) \| undefined;` | optional |  |
| `zoom` | `readonly zoom?: PdfViewerZoom \| undefined;` | optional | Controlled zoom. Default `'auto'`. |
| `defaultZoom` | `readonly defaultZoom?: PdfViewerZoom \| undefined;` | optional |  |
| `onZoomChange` | `readonly onZoomChange?: ((zoom: PdfViewerZoom, event: {     readonly scale: number;     readonly source: PdfViewerEventSource; }) => void) \| undefined;` | optional |  |
| `scrollMode` | `readonly scrollMode?: PdfViewerScrollMode \| undefined;` | optional | Default `'vertical'`. |
| `spreadMode` | `readonly spreadMode?: PdfViewerSpreadMode \| undefined;` | optional | Default `'none'`. |
| `sidebar` | `readonly sidebar?: PdfViewerSidebar \| null \| undefined;` | optional | Open panel; `null` closes it. |
| `defaultSidebar` | `readonly defaultSidebar?: PdfViewerSidebar \| null \| undefined;` | optional |  |
| `onSidebarChange` | `readonly onSidebarChange?: ((sidebar: PdfViewerSidebar \| null) => void) \| undefined;` | optional |  |
| `toolbar` | `readonly toolbar?: readonly PdfViewerToolbarItem[] \| false \| undefined;` | optional | Toolbar items; `false` hides the toolbar. |
| `renderToolbar` | `readonly renderToolbar?: ((context: PdfViewerToolbarContext) => ReactNode) \| undefined;` | optional | Replaces the toolbar. |
| `textSelection` | `readonly textSelection?: boolean \| undefined;` | optional | Native text selection and copy over the text layer. Default true. |
| `linkTarget` | `readonly linkTarget?: '_blank' \| '_self' \| '_parent' \| '_top' \| undefined;` | optional | Where external links open. Default `'_blank'`. |
| `onLinkClick` | `readonly onLinkClick?: ((event: PdfViewerLinkEvent) => void) \| undefined;` | optional | Cancellable; `preventDefault()` keeps the viewer from following the link. |
| `onBeforePrint` | `readonly onBeforePrint?: ((event: PdfViewerCancelableEvent) => void) \| undefined;` | optional | Cancellable. |
| `printResolution` | `readonly printResolution?: number \| undefined;` | optional | Print resolution in DPI. Default 150. |
| `fileName` | `readonly fileName?: string \| undefined;` | optional | Download file name. Default `'document.pdf'`. |
| `onSearchResult` | `readonly onSearchResult?: ((result: PdfViewerSearchResult) => void) \| undefined;` | optional |  |
| `annotations` | `readonly annotations?: readonly PdfTextMarkupAnnotation[] \| undefined;` | optional | Controlled text markup annotations. |
| `defaultAnnotations` | `readonly defaultAnnotations?: readonly PdfTextMarkupAnnotation[] \| undefined;` | optional |  |
| `onAnnotationsChange` | `readonly onAnnotationsChange?: ((annotations: readonly PdfTextMarkupAnnotation[], event: PdfViewerAnnotationsChangeEvent) => void) \| undefined;` | optional |  |
| `annotationAuthor` | `readonly annotationAuthor?: string \| undefined;` | optional | Author written into new annotations. |
| `annotationColors` | `readonly annotationColors?: Partial<Record<PdfTextMarkupKind, string>> \| undefined;` | optional | Default colors of the markup kinds. |
| `formValues` | `readonly formValues?: PdfFormValues \| undefined;` | optional | Controlled AcroForm values by field name; fields not listed keep the document's values. |
| `defaultFormValues` | `readonly defaultFormValues?: PdfFormValues \| undefined;` | optional |  |
| `onFormValuesChange` | `readonly onFormValuesChange?: ((values: PdfFormValues, event: {     readonly name: string; }) => void) \| undefined;` | optional |  |
| `actionsRef` | `readonly actionsRef?: RefObject<PdfViewerActions \| null> \| ((actions: PdfViewerActions \| null) => void) \| undefined;` | optional |  |
| `localeText` | `readonly localeText?: Partial<PdfViewerLocaleText> \| undefined;` | optional |  |
| `classNames` | `readonly classNames?: Partial<Record<PdfViewerPart, string>> \| undefined;` | optional |  |
| `styles` | `readonly styles?: Partial<Record<PdfViewerPart, CSSProperties>> \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement> \| undefined;` | optional |  |
