Skip to main content

JavaScript API

Client-API

Authentication for Backend-Communication

It is possible to provide authentication information used by the backend to authenticate against an archive to retrieve documents.

window.viewerApi.clientApi.setAuthenticationInfo("eY...")

The token is applied for the current user when loading documents or saving annotations automatically.

Additional HTTP-headers

It is possible to provide additional HTTP-headers that are sent by the backend when communicating with the archive to load documents and save annotations.

window.viewerApi.clientApi.setAdditionalHttpHeaders(["X-My-Header:valueA", "X-App-Id:Abc"])

Toolbar configuration

To change the top-toolbar you can override the configuration used by the viewer. This is useful, for example, if you want to disable buttons that are present in the toolbar. The provided configuration object is merged with the currently active (default) toolbar configuration. That means, you can provide a reduced object, that only contains the items that need to be changed, and you don't have to provide the full configuration for the toolbar.

Example to disable the jadice logo in the top right corner of the toolbar:

window.viewerApi.clientApi.mergeToolbarConfig({logo:null})

Right Toolbar configuration

The same mechanism works for the right toolbar as well:

Example to completely remove the right toolbar:

window.viewerApi.clientApi.mergeRightToolbarConfig({actions: null})

There also exists a convenient method to simply disable items in the right toolbar:

window.viewerApi.clientApi.configureRightToolbar(
{annotationPanel: true, advancedSearch: true, bookmarkPanel: true, attachmentPanel: false, documentSelectionPanel: false})
caution

Beware that enabling annotations depends on the viewer license, so if you do not have rights for annotations, enabling annotations via this API will not work. Also there should be no need to enable attachment-panel and documenet-selection-panel as the will be enabled automatically if needed.

Collection-API

The Collection-API is intended to instruct the viewer to load documents. Details can also be found in the chapter Document Loading.