Introduction
The MuPDF WebViewer API
Initialization
The MuPDF WebViewer API can only be accessed after initializing with initMuPDFWebViewer(). This should return a mupdfwv.MuPDFWebViewer object to your code base or an error if there is any problem with the initialization.
initMuPDFWebViewer
initMuPDFWebViewer(selector: string, docURL: string, options?: mupdfwv.initViewerOptions): Promise<mupdfwv.MuPDFWebViewer>()
- Arguments:
- selector – A string which targets the dedicated
<div>
with the expected id. - docURL – The URL of the document you wish to display.
- options – An object containing the
libraryPath
andlicenseKey
definitions.
- selector – A string which targets the dedicated
- Returns:
Promise object as
Promise<mupdfwv.MuPDFWebViewer>
.
mupdfwv.MuPDFWebViewer
The mupdfwv.MuPDFWebViewer
object instance contains six sub-object instances as follows:
document
instance
The PDF document instance.
viewer
instance
The viewer user interface used for interaction.
- Viewer API
viewer
viewer.setColor()
viewer.setBackgroundColor()
viewer.setPageBorderColor()
viewer.setTheme()
viewer.setLogo()
viewer.toggleDialog()
viewer.getScale()
viewer.setScale()
viewer.zoomIn()
viewer.zoomOut()
viewer.getCurrentPageIndex()
viewer.getRotation()
viewer.setRotation()
viewer.rotateClockwise()
viewer.rotateCounterClockwise()
viewer.setViewMode()
viewer.fitTo()
viewer.scrollToNextPage()
viewer.scrollToPreviousPage()
viewer.scrollTo()
viewer.openSideView()
viewer.closeSideView()
viewer.togglePanel()
viewer.highlight()
viewer.unhighlight()
viewer.searchText()
viewer.setLanguage()
viewer.getSize()
viewer.setViewVisibility()
viewer.addButton()
viewer.addContextMenu()
viewer.defineDocumentPanel()
viewer.defineAnnotSelectMenu()
annotation
instance
An interface into the document’s annotations.
text
instance
The interface for the document text.
watermark
instance
An interface to manage document watermarks.
toast
instance
An object used to display messages.
Events
How to listen to events in the MuPDF WebViewer.
References
A glossary of object references.