Get Started

play_arrow

Learn more

play_arrow

Common use cases

play_arrow

Open a document

play_arrow

Save a document

play_arrow

Viewer

play_arrow

UI Customization

play_arrow

Annotations

play_arrow

Collaboration

play_arrow

Forms

play_arrow

Signature

play_arrow

Measurement

play_arrow

PDF.js Express REST API

play_arrow

Open a document from URL

If you have a URL for a document, you can pass it either as a constructor option or to loadDocument to open it.

// Passing a URL into the Web Viewer constructor
WebViewer({
  ...,
  initialDoc: 'https://myserver.com/myfile.pdf',
}, document.getElementById('viewer')).then(instance => {
    const { docViewer } = instance;
    docViewer.on('documentLoaded', () => {
      // perform document operations
    });
});

// or

WebViewer(...)
  .then(instance => {
    instance.loadDocument('https://myserver.com/myfile.pdf', { filename: 'myfile.pdf' });

    const { docViewer } = instance;
    docViewer.on('documentLoaded', () => {
      // perform document operations
    });
  });