Class: DocumentView
Class for managing the presentation and interaction with a PDF document within a container element.
Extends
Implements
Constructors
new DocumentView()
new DocumentView(
container
,options
?):DocumentView
Constructor for the DocumentView class.
Parameters
• container: HTMLElement
The container element in which the document view will be displayed.
• options?: DocumentViewOptions
Returns
Overrides
Properties
DEFAULT_DPI
readonly
static
DEFAULT_DPI:number
Accessors
currentPageNumber
get
currentPageNumber():number
Gets or sets the currently most visible page.
set
currentPageNumber(pageNumber
):void
Parameters
• pageNumber: number
Returns
number
The number of the page which covers the largest area on the viewport or null if the document view is not initialized. If multiple pages cover the same amount of space, the one with smaller page number is returned.
dpi
get
dpi():number
Gets the dpi
(Dots Per Inch) value which influences the rendering resolution of a document view.
Higher DPI values result in higher resolution images, which can make them appear sharper and more detailed.
Default
window.devicePixelRatio * 96
Returns
number
fitMode
get
fitMode():FitMode
Experimental
Gets or sets the fit mode for the document view.
set
fitMode(fitMode
):void
Parameters
• fitMode: FitMode
Returns
pageLayoutMode
get
pageLayoutMode():PageLayoutMode
Experimental
Gets or sets the page layout mode for the document view.
set
pageLayoutMode(pageLayoutMode
):void
Parameters
• pageLayoutMode: PageLayoutMode
Returns
pdfDocument
get
pdfDocument():Document
Gets Pdf.Document
attached to the DocumentView
.
Returns
rotation
get
rotation():Rotation
Experimental
Gets or sets the rotation for the document view.
set
rotation(rotation
):void
Parameters
• rotation: Rotation
Returns
scrollAllowance
get
scrollAllowance():ScrollAllowance
Get the current scroll allowances
Returns
ScrollAllowance
slidingWindow
get
slidingWindow():Map
<number
,DocumentViewPage
>
Gets pages in sliding window.
Returns
Map
<number
, DocumentViewPage
>
zoom
get
zoom():number
Gets or sets the currently used zoom factor as a floating-point number. 1 corresponds to a zoom level of 100%.
set
zoom(zoom
):void
Parameters
• zoom: number
Returns
number
Zoom level or null if the document view is not initialized.
zoomLevels
get
zoomLevels():number
[]
Gets or sets the array of zoom levels available for the document view.
set
zoomLevels(zoomLevels
):void
Parameters
• zoomLevels: number
[]
Returns
number
[]
Methods
addEventListener()
addEventListener<
K
>(type
,listener
):void
Register a function that will be called whenever the specified event is delivered.
Type Parameters
• K extends keyof DocumentViewEventMap
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event type to listen for.
• listener
The function that will be executed when an event of the specified type occurs.
Returns
void
Inherited from
dispatchEvent()
dispatchEvent<
K
>(type
,args
):void
Dispatches an event to all registered listeners.
Type Parameters
• K extends keyof DocumentViewEventMap
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event type to dispatch.
• args: Parameters
<DocumentViewEventMap
[K
]>
The data associated with the event.
Returns
void
Inherited from
dispose()
dispose():
void
Disposes of the object, releasing any resources it holds.
The dispose
method is responsible for performing cleanup operations and releasing
any resources acquired by the object. Once an object is disposed, it should not
be used, and attempts to do so may result in undefined behavior.
Returns
void
Implementation of
goToDestination()
goToDestination(
destination
):any
Navigates to the specified destination in the document view.
Parameters
• destination: Destination
The destination to navigate to.
Returns
any
goToPage()
goToPage(
pageNumber
):any
Navigates to the specified page in the document view.
Parameters
• pageNumber: number
The page number to navigate to.
Returns
any
initialize()
initialize(
pdfDocument
):void
Initializes the document view.
Parameters
• pdfDocument: Document
The PDF document which will be displayed inside the document view.
Returns
void
nextPage()
nextPage():
any
Navigates to the next page in the document view.
Returns
any
previousPage()
previousPage():
any
Navigates to the previous page in the document view.
Returns
any
removeAllListeners()
removeAllListeners<
K
>(type
):void
Remove all listeners for a given event.
Type Parameters
• K extends keyof DocumentViewEventMap
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event for which to remove all listeners.
Returns
void
Inherited from
EventEmitter
.removeAllListeners
removeEventListener()
removeEventListener<
K
>(type
,listener
):void
Removes an event listener previously registered with addEventListener.
Type Parameters
• K extends keyof DocumentViewEventMap
A generic type representing the key of the event type.
Parameters
• type: K
String representing the event for which to remove an event listener.
• listener
The event listener function of the event handler to remove from the event target.
Returns
void