diff --git a/src/display/api.js b/src/display/api.js index 781bc7021..163f257b2 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -332,9 +332,22 @@ function getDocument(src) { let networkStream; if (rangeTransport) { - networkStream = new PDFDataTransportStream(params, rangeTransport); + networkStream = new PDFDataTransportStream({ + length: params.length, + initialData: params.initialData, + disableRange: params.disableRange, + disableStream: params.disableStream, + }, rangeTransport); } else if (!params.data) { - networkStream = createPDFNetworkStream(params); + networkStream = createPDFNetworkStream({ + url: params.url, + length: params.length, + httpHeaders: params.httpHeaders, + withCredentials: params.withCredentials, + rangeChunkSize: params.rangeChunkSize, + disableRange: params.disableRange, + disableStream: params.disableStream, + }); } var messageHandler = new MessageHandler(docId, workerId, worker.port); @@ -363,8 +376,6 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { if (worker.destroyed) { return Promise.reject(new Error('Worker was destroyed')); } - let apiVersion = - typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('BUNDLE_VERSION') : null; if (pdfDataRangeTransport) { source.length = pdfDataRangeTransport.length; @@ -372,7 +383,8 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { } return worker.messageHandler.sendWithPromise('GetDocRequest', { docId, - apiVersion, + apiVersion: (typeof PDFJSDev !== 'undefined' ? + PDFJSDev.eval('BUNDLE_VERSION') : null), source: { data: source.data, url: source.url,