1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

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,
});
},

View file

@ -336,8 +336,6 @@ function getDefaultSetting(id) {
switch (id) {
case 'pdfBug':
return globalSettings ? globalSettings.pdfBug : false;
case 'disableStream':
return globalSettings ? globalSettings.disableStream : false;
case 'disableCreateObjectURL':
return globalSettings ? globalSettings.disableCreateObjectURL : false;
default:

View file

@ -65,14 +65,6 @@ PDFJS.Util = Util;
PDFJS.PageViewport = PageViewport;
PDFJS.createPromiseCapability = createPromiseCapability;
/**
* Disable streaming of PDF file data. By default PDF.js attempts to load PDF
* in chunks. This default behavior can be disabled.
* @var {boolean}
*/
PDFJS.disableStream = (PDFJS.disableStream === undefined ?
false : PDFJS.disableStream);
/**
* Enables special hooks for debugging PDF.js.
* @var {boolean}