Disable Pre-Fetching of multiple PDFs
-
I have several PDFs on my page and noticed that they’re all fetched at once onload. This significantly hogs the network and affects rendering times too. Would it be possible to prevent all pdfs from being fetched unless the viewer attempts to view them please?
Found this in the following discussion
https://github.com/mozilla/pdf.js/issues/8897pdf.js/src/display/global.js
/**
* Disable pre-fetching of PDF file data. When range requests are enabled
* PDF.js will automatically keep fetching more data even if it isn’t needed
* to display the current page. This default behavior can be disabled.
*
* NOTE: It is also necessary to disable streaming, see above,
* in order for disabling of pre-fetching to work correctly.
* @var {boolean}
*/
PDFJS.disableAutoFetch = (PDFJS.disableAutoFetch === undefined ?
false : PDFJS.disableAutoFetch);
- The topic ‘Disable Pre-Fetching of multiple PDFs’ is closed to new replies.