Open a document by URL

Opening a document in WebViewer from URL

If you have a URL for a document, you can open it by including initialDoc as a constructor option or by using the loadDocument API.

Use the initialDoc constructor option to provide the document when mounting WebViewer.

1WebViewer({
2 ...,
3 initialDoc: 'https://myserver.com/myfile.pdf',
4}, document.getElementById('viewer')).then(instance => {
5 const { documentViewer } = instance.Core;
6 documentViewer.addEventListener('documentLoaded', () => {
7 // perform document operations
8 });
9});

If you are loading from an extensionless URL, please ensure the extension or filename options are set.

Loading Options

WebViewer provides various options to load a document. Whether you are loading a document through the initialDoc option in the constructor or calling loadDocument after mounting, you can always provide options to load your document.

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales