Initialization
The MuPDF WebViewer API can only be accessed after initializing with initMuPDFWebViewer(). This should return a MuPDFWebViewer object to your code base or an error if there is any problem with the initialization.initMuPDFWebViewer
Parameters
A CSS selector used to find the DOM element that will host the viewer. Supports any selector supported by
querySelector.The URL of the document you wish to display.
Optional initialization options.
Returns
A Promise that resolves to a
MuPDFWebViewer instance.MuPDFWebViewer
The MuPDFWebViewer instance exposes object instances and helper APIs as follows:
document instance
The PDF document instance.
viewer instance
The viewer user interface used for interaction.
- Viewer API
viewerviewer.toggleDialog()viewer.getScale()viewer.setScale()viewer.zoomIn()viewer.zoomOut()viewer.getCurrentPageIndex()viewer.getRotation()viewer.setRotation()viewer.rotateClockwise()viewer.rotateCounterClockwise()viewer.setViewMode()viewer.fitTo()viewer.scrollTo()viewer.scrollToNextPage()viewer.scrollToPreviousPage()viewer.selectAnnotationTool()viewer.toggleAnnotationTool()viewer.openSideView()viewer.closeSideView()viewer.togglePanel()viewer.highlight()viewer.unhighlight()viewer.searchText()viewer.setViewVisibility()viewer.addButton()viewer.openContextMenu()viewer.addContextMenu()viewer.defineDocumentPanel()viewer.defineTextSelectionMenu()viewer.defineAnnotSelectMenu()viewer.defineRightClickAction()viewer.setBackgroundColor()viewer.setPageBorderColor()viewer.setColor()viewer.setTheme()viewer.setLanguage()viewer.getSize()viewer.setLogo()