Overview of the DocumentViewer

The WebViewer SDK provides an important object, the DocumentViewer. When loaded, the WebViewer instance provides a DocumentViewer object, along with other objects and namespaces, that is wired to the viewer that was just mounted. The DocumentViewer allows you to work with documents without working in detail with WebViewer Core.

1WebViewer(...)
2 .then(instance => {
3 // The documentViewer is wired to the mounted viewer
4 const { documentViewer } = instance.Core;
5
6 // Change to the second page when a document loads
7 documentViewer.addEventListener('documentLoaded', () => {
8 documentViewer.setCurrentPage(2);
9 });
10 });

Manual Instantiation

The DocumentViewer class is found in the Core namespace. You can instantiate it without any additional parameters but you should set the viewer and scroll view elements that it should work with. This is only necessary when creating your own custom UI which you can read more about in our guide.

1const documentViewer = new Core.DocumentViewer();

Get Started

Working with documents
Working with documents using the DocumentViewer object

Adjusting layout and zoom
Setting the viewing layout using the DocumentViewer object

Adjusting layout and zoom
Showing how to use the default tools with the DocumentViewer object

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales