Skip to content
React PDF Viewer

Search

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

Import

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

Properties

NameTypeDefaultRequiredDescription
statusPdfDocumentStatus—YesDocument status.
numPagesnumber—YesPage count; 0 without a document.
pagenumber—YesCurrent 1-based page, clamped to the document.
scalenumber—YesCurrent scale (1 = 100%).
rotationRotation—YesCurrent user rotation.
fullscreenboolean—YesWhether the viewer is in fullscreen.
canZoomInboolean—YesWhether zoomIn() would change the scale.
canZoomOutboolean—YesWhether zoomOut() would change the scale.
goToPage(page: number) => void—NoGo to a page (clamped).
nextPage() => void—NoNext page.
previousPage() => void—NoPrevious page.
zoomIn() => void—NoOne step (or preset) up.
zoomOut() => void—NoOne step (or preset) down.
setScale(scale: number) => void—NoSet the scale, clamped to [minScale, maxScale].
resetZoom() => void—NoReturn to defaultScale.
rotate(direction?: 'cw' | 'ccw') => void—NoRotate by 90°, clockwise by default.
toggleFullscreen() => void—NoEnter or leave fullscreen.
download() => Promise<void>—NoSave the loaded document (no second request).
print() => Promise<void>—NoPrint according to printMode.
reload() => void—NoLoad the source again, e.g. after an error.
getDocument() => PDFDocumentProxy | null—NoThe loaded PDF.js document, for advanced use. Do not destroy it.

Source

packages/react-pdf-viewer/src/types.ts

Generated from content/react-pdf-viewer/reference/pdf-viewer-api.schema.json. Do not edit by hand.