To use JavaScript with the WebViewer, initialize the WebViewer's view model using the clientId returned from the WebViewer. Once you initialize the view model, you can access its API methods and properties to modify the WebViewer. You can also use the same view model to access the API for the side bar search panel and the toolbar.
ViewerViewModel
To work with the API, first initialize the viewer's view model using the GetWebViewer(clientId) function. The clientId is the WebViewer control's name, by default, WebViewer1. If there is no ViewerViewModel with the requested clientId, an exception occurs.
Use code like the following to initialize the ViewerViewModel:
var viewModel = GetWebViewer(clientId);