Customization
UI Customization
UI customization is useful for both branding the MuPDF WebViewer as well as adding or removing features.
Visual Customization
The following visual customization is possible:
Set Primary and Secondary colors
This sets the primary and secondary colors - these reflect the button & text colors when these items are selected.
See: viewer.setColor()
.
Set Background Color
Sets the background color behind the document page.
See viewer.setBackgroundColor()
.
Set Page Border Color
Sets the page border color.
See viewer.setPageBorderColor()
.
Set Theme
Sets the theme for light, dark or system mode.
See viewer.setTheme()
.
Set Logo
Allows to set a logo in the top header area.
See viewer.setLogo()
.
Functional Customization
Sometimes you may want to alter the functionality of the MuPDF WebViewer User Interface by showing or hiding elements or by editing components.
The available customizations are possible:
Display/Hide UI
You can display/hide the UI elements using the viewer.setViewVisibility()
function.
For example, if you want to hide the toolbar, you can do the following:
Add Buttons to Toolbar
You can add buttons to the toolbar using the viewer.addButton()
function.
For example, if you want to add a button to the toolbar to enter fullscreen, you can do the following:
Add Context Menu
You can add items to the context menu (the pop-up menu you see when you right click on a document in MuPDF WebViewer) using the viewer.addContextMenu()
function.
For example, if you want to add an item to rotate the page clockwise, you can do the following:
Define Document Panel
You can define the document panel using the viewer.defineDocumentPanel()
function.
For example, if you want to define the document panel to show the bookmark panel as “Table of Contents” and the annotation panel as “Markups” then you can do the following:
Define Annotation Selection Menu
You can define the annotation selection menu using viewer.defineAnnotSelectMenu()
function.
For example, if you want to define the annotation selection menu when selecting a highlight annotation, you can do something like the following: