There are a few breaking changes and other changes when migrating to v7 from older versions.
Breaking changes
New default UI
There is a new default user interface in WebViewer 7.0 which has changed the location and structure of some components in the UI. Most APIs will function the same as before.
One of the main changes is to the header toolbars which are split into several groups. You can change the group using setToolbarGroup and you can edit each group using the getHeader function.
If you are not ready to update to the new UI yet you can still access the previous UI by passing ui: 'legacy' into your WebViewer constructor.
JavaScript
1WebViewer({
2 ui: 'legacy',
3 // other constructor options
4}).then(instance => {
5
6});
Page numbers instead of page indexes for APIs
Several breaking changes have been made to make sure API signatures are more consistent in WebViewer 7.0. We've heard feedback that it can be confusing using some WebViewer APIs because some accept page indexes (starting with zero) and some accept page numbers (starting with one). In 7.0 we've updated all APIs to be page numbers (starting with one) to be consistent.
Generally if you were using APIs on AnnotationManager and DocumentViewer these were already taking in 1-indexed page numbers. If you were using APIs on the Document object these were taking in 0-indexed page numbers.
Below are some examples of the changes:
1WebViewer(...)
2 .then(instance => {
3 instance.docViewer.on('documentLoaded', () => {
4 const doc = instance.docViewer.getDocument();
5 // get the information of the first page
6 const pageNumber = 1;
7 const pageInfo = doc.getPageInfo(pageNumber);
8 });
9 });
1WebViewer(...)
2 .then(instance => {
3 instance.docViewer.on('documentLoaded', () => {
4 const doc = instance.docViewer.getDocument();
5 // get the information of the first page
6 const pageIndex = 0;
7 const pageInfo = doc.getPageInfo(pageIndex);
8 });
9 });
The following APIs have been changed to use page numbers:
Previously you could reference a PartRetriever directly from the PartRetriever namespace. Now the PartRetrievers are lazy loaded when needed so you can access them through the asynchronous getPartRetriever API.
In WebViewer 7.0, we also renamed some constant variables to be more consistent with others. Their previous names are kept for backwards compatibility, though we still encourage you to update them.