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?: { licenseKey?: string, libraryPath?: string, filename?: string, standalone?: boolean, withoutLoader?: boolean }): Promise<mupdfwv.MuPDFWebViewer>()
- Arguments:
- selector – (required) A string which targets the dedicated
<div>with the expected id. - docURL – (required) The URL of the document you wish to display.
- options – (optional) An object containing:
-
licenseKey- (optional)stringThe license key for use. -
libraryPath- (optional)stringLibrary path for library assetsSee also Optionally set the library path for more.See also Deploying with React for more onlibraryPathand server side deployment. -
filename- (optional)stringFilename for PDF -
standalone- (optional)booleanStandalone or not. -
withoutLoader- (optional)booleanWhether to show the document loader or not.
-
- selector – (required) 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
viewerviewer.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()