Skip to main content
Version: Version 5

Interface: DocumentView

Groups all the API actions related to the document view.

Extends​

Properties​

goToDestination​

goToDestination: (destination) => void

Navigates to a specific destination in the document.

Parameters​

destination​

Destination

The destination to navigate to.

Returns​

void

Example​

viewer.documentView.goToDestination(destination);

goToPage​

goToPage: (pageNumber) => void

Navigates to a specific page in the document.

Parameters​

pageNumber​

number

The page number to navigate to.

Returns​

void

Example​

viewer.documentView.goToPage(5);

nextPage​

nextPage: () => void

Navigates to the next page in the document.

Returns​

void

Example​

viewer.documentView.nextPage();

previousPage​

previousPage: () => void

Navigates to the previous page in the document.

Returns​

void

Example​

viewer.documentView.previousPage();

rotate​

rotate: (newRotation) => void

Rotates the document view.

Parameters​

newRotation​

Rotation

The new rotation value.

Returns​

void

Example​

viewer.documentView.rotate(90);

setFitMode​

setFitMode: (fitMode) => void

Sets the fit mode of the PDF viewer.

Parameters​

fitMode​

FitMode

The fit mode to set.

Returns​

void

Example​

viewer.documentView.setFitMode(FitMode.FitWidth);

setPageMode​

setPageMode: (pageMode) => void

Sets the page mode of the PDF viewer.

Parameters​

pageMode​

PageLayoutMode

The page mode to set.

Returns​

void

Example​

viewer.documentView.setPageMode(PageLayoutMode.SinglePage);

setZoom​

setZoom: (zoom) => void

Sets the zoom level of the PDF viewer.

Parameters​

zoom​

number

The zoom level to set.

Returns​

void

Example​

viewer.documentView.setZoom(1.5);

zoomIn​

zoomIn: () => void

Zooms in the document view.

Returns​

void

Example​

viewer.documentView.zoomIn();

zoomOut​

zoomOut: () => void

Zooms out the document view.

Returns​

void

Example​

viewer.documentView.zoomOut();

Methods​

addEventListener()​

addEventListener<K>(eventName, callback): void

Adds an event listener for a specified event.

Type Parameters​

K​

K extends keyof DocumentViewEventMap

Parameters​

eventName​

K

The name of the event to listen for.

callback​

DocumentViewEventMap[K]

The callback function to execute when the event is triggered.

Returns​

void

Inherited from​

EventHandler.addEventListener


getZoom()​

getZoom(): number

Gets the current zoom level of the document view.

Returns​

number

The current zoom level.

Example​

const currentZoom = viewer.documentView.getZoom();
console.log('Current Zoom Level:', currentZoom);

removeEventListener()​

removeEventListener<K>(eventName, callback): void

Removes an event listener for a specified event.

Type Parameters​

K​

K extends keyof DocumentViewEventMap

Parameters​

eventName​

K

The name of the event to stop listening for.

callback​

DocumentViewEventMap[K]

The callback function to remove.

Returns​

void

Inherited from​

EventHandler.removeEventListener