Skip to components
DEVELOPER REFERENCE · v4.0.0

PdfViewerToolbar API

Props, callbacks and methods. Select an underlined type to explore its fields, allowed values and callback arguments.

PdfViewerToolbar7 props2 callbacks15 methods

Props7

PdfViewerToolbar props
NameTypeDescription
controllerRequired
PdfViewerControllerInspect type
Controller instance used to invoke actions and read the current state.
stateRequired
Readonly<PdfViewerState>Inspect type
Current state snapshot used to render the component.
configOptional
PdfViewerToolbarConfig | undefinedInspect type
Toolbar groups, visibility and button options. false hides all tools; an array chooses groups; an object configures individual controls.
textOptional
Partial<PdfViewerText>Inspect type
Partial overrides for the default PDF viewer toolbar labels.
searchOpenOptionalboolean | undefinedWhether the viewer search field is currently shown.
searchIdOptionalstring | undefinedID for the search field and its accessibility associations.
appendToOptional
HTMLElement | undefinedInspect type
DOM container for floating viewer toolbar content.

Events and callbacks2

PdfViewerToolbar events and callbacks
NameTypeDescription
onOpenRequired
() => voidInspect type
Requests that the parent open the surface or file chooser.
onToggleSearchRequired
(origin: HTMLElement) => voidInspect type
Requests toggling the search panel and supplies its triggering element for focus restoration.

Methods15

PdfViewerToolbar methods
NameSignatureDescription
PdfViewerController.setPrintTitle
(title: string) => voidInspect type
Update translated print-frame accessibility text without reloading the PDF.

Available through controller.

PdfViewerController.retry
() => Promise<void>Inspect type
Retries loading the last source after an error.

Available through controller.

PdfViewerController.setCallbacks
(callbacks: Pick<PdfViewerOptions, "onLoad" | "onError" | "onPageChange" | "onZoomChange">) => voidInspect type
Update event handlers without recreating the document or its worker.

Available through controller.

PdfViewerController.subscribe
(listener: (state: Readonly<PdfViewerState>) => void) => () => voidInspect type
Subscribes to viewer state changes; returns an unsubscribe function.

Available through controller.

PdfViewerController.attach
(container: HTMLDivElement) => Promise<void>Inspect type
Initializes the viewer in its container before loading a document.

Available through controller.

PdfViewerController.load
(source: PdfSource | null, fileName?: string) => Promise<void>Inspect type
The latest source wins. Empty/null clears the document. Failures are exposed in snapshot/onError.

Available through controller.

PdfViewerController.goToPage
(page: number) => voidInspect type
Navigates to a one-based page number, clamped to the document page count.

Available through controller.

PdfViewerController.setZoom
(zoom: PdfZoom) => voidInspect type
Applies a numeric scale or page-width/page-fit mode when a document is ready.

Available through controller.

PdfViewerController.rotate
() => voidInspect type
Rotates all pages clockwise by 90 degrees.

Available through controller.

PdfViewerController.search
(query: string, previous?: boolean, again?: boolean) => voidInspect type
Searches the document; previous selects search direction and again continues to the next match.

Available through controller.

PdfViewerController.clearSearch
() => voidInspect type
Closes the search state and removes match highlighting.

Available through controller.

PdfViewerController.download
() => Promise<void>Inspect type
Downloads the currently loaded PDF.

Available through controller.

PdfViewerController.print
() => Promise<void>Inspect type
Prepares and opens the print view for the loaded PDF.

Available through controller.

PdfViewerController.cancelPrint
() => voidInspect type
Cancels an in-progress print preparation.

Available through controller.

PdfViewerController.destroy
() => voidInspect type
Releases the document, worker, listeners and viewer resources.

Available through controller.