The useDownloader option

In this document
The useDownloader option is only applicable when loading PDF files. If you're loading XOD files then you can skip this guide.

"Downloader" is a feature of PDFNetJS which allows it to efficiently fetch PDF files that have been linearized. The PDF spec describes linearization as a feature "that enables efficient incremental access of the file in a network environment."

By default downloader is enabled which allows WebViewer to quickly display the initial page in the document and download remaining pages incrementally for large linearized files.

Requirements for downloader to work
  • The PDF files are linearized. You can use a native PDFTron library to linearize files.
  • Byte range requests supported on your server. This should usually just work when serving your documents statically but you may need to use a library if you're serving them in a different way.

Disabling downloader

Generally it is not recommended to disable downloader because of the improved performance when loading linearized documents. It is only advisable if your server doesn't support byte range requests and you aren't able to enable them for some reason.

You can disable downloader as follows:

var myWebViewer = new PDFTron.WebViewer({
  initialDoc: "GettingStarted.pdf",
  useDownloader: false
}, viewerElement);