Zoom Class
Provides zoom functionality for the PDF viewer.
export declare class Zoom implements EventElement<ZoomEventMap>
- Inheritance:
-
Zoom
Implements
Remarks
The Zoom class manages zoom operations including setting zoom levels, handling zoom events, and providing access to current zoom state.
Properties
zoomLevel
Gets the current zoom level.
get zoomLevel(): number | "automatic" | "pageFit" | "pageWidth";
set zoomLevel(value: number | "automatic" | "pageFit" | "pageWidth");
Parameters
-
value
The zoom level to set (e.g., "automatic", "pageFit", or a percentage value).
Methods
addEventListener(K, (event: ZoomEventMap[K]) => void)
Adds an event listener for the specified event type.
addEventListener<K extends keyof ZoomEventMap>(type: K, listener: (event: ZoomEventMap[K]) => void): void;
Parameters
-
type
The event type/name to listen for.
-
listener
The callback function that will be invoked when the event is emitted.
zoomRelative(number)
Zooms the PDF viewer by a relative scale factor.
zoomRelative(scale: number): void;
Parameters
-
scale
The relative scale factor to apply (e.g., 1.2 for 20% zoom in, 0.8 for 20% zoom out).
Remarks
This method adjusts the current zoom level by multiplying it with the provided scale factor. For example, a scale of 1.5 will increase the zoom by 50%, while a scale of 0.75 will decrease the zoom by 25%.