Some test text!

Opening a document from URL

Contents

Additional options

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

var myWebViewer = new PDFTron.WebViewer({
  ...,
  initialDoc: 'https://myserver.com/myfile.pdf'
}, viewerElement);

// or

var myWebViewer = new PDFTron.WebViewer({ ... }, viewerElement);

viewerElement.addEventListener('ready', function() {
  myWebViewer.loadDocument('https://myserver.com/myfile.pdf', { filename: 'myfile.pdf' });
});

linkAdditional options

If your document server requires additional options in HTTP request, you can use second argument in laodDocument function to pass them.

var myWebViewer = new PDFTron.WebViewer({ ... }, viewerElement);

viewerElement.addEventListener('ready', function() {
  myWebViewer.loadDocument('path/to/myfile.pdf', {
    filename: 'myfile.pdf',
    customHeaders: {
      Authorization: 'Basic YWxhZGRpbjpvcGVuc2VzYW1l'
    },
    withCredentials: true
  });
});

Get the answers you need: Support

Contents

Additional options