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 – (required) An object containing:
-
licenseKey
- (required)string
The license key for use. -
libraryPath
- (optional)string
Library path for library assetsSee also Deploying with React for more onlibraryPath
and server side deployment. -
filename
- (optional)string
Filename for PDF -
standalone
- (optional)boolean
Standalone or not. -
withoutLoader
- (optional)boolean
Whether 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
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()