Move the disableStream option from the global PDFJS object and into getDocument instead

This commit is contained in:
Jonas Jenwald 2018-02-17 22:28:08 +01:00
parent b69abf1111
commit 05c05bdef5
5 changed files with 15 additions and 14 deletions

View file

@ -169,6 +169,9 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
* of PDF files. When enabled, and if the server supports partial content
* requests, then the PDF will be fetched in chunks.
* The default value is `false`.
* @property {boolean} disableStream - (optional) Disable streaming of PDF file
* data. By default PDF.js attempts to load PDFs in chunks.
* The default value is `false`.
* @property {boolean} disableAutoFetch - (optional) 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.
@ -280,6 +283,9 @@ function getDocument(src) {
if (typeof params.disableRange !== 'boolean') {
params.disableRange = apiCompatibilityParams.disableRange || false;
}
if (typeof params.disableStream !== 'boolean') {
params.disableStream = apiCompatibilityParams.disableStream || false;
}
if (typeof params.disableAutoFetch !== 'boolean') {
params.disableAutoFetch = false;
}
@ -350,7 +356,6 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
let apiVersion =
typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : null;
source.disableStream = getDefaultSetting('disableStream');
if (pdfDataRangeTransport) {
source.length = pdfDataRangeTransport.length;
source.initialData = pdfDataRangeTransport.initialData;
@ -2141,6 +2146,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
let params = this._params;
return shadow(this, 'loadingParams', {
disableRange: params.disableRange,
disableStream: params.disableStream,
disableAutoFetch: params.disableAutoFetch,
});
},