[api-minor] Add an optional param to DocumentInitParameters for specifying the range request chunk size to use. Defaults to 2^16 = 65536.

This commit is contained in:
Tony Jin 2015-10-21 16:56:27 -07:00
parent aae82ec4c5
commit ef667823dd
3 changed files with 11 additions and 6 deletions

View file

@ -23,6 +23,8 @@
'use strict';
var DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536
/**
* The maximum allowed image size in total pixels e.g. width * height. Images
* above this value will not be drawn. Use -1 for no limit.
@ -217,6 +219,9 @@ PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
* @property {number} length - The PDF file length. It's used for progress
* reports and range requests operations.
* @property {PDFDataRangeTransport} range
* @property {number} rangeChunkSize - Optional parameter to specify
* maximum number of bytes fetched per range request. The default value is
* 2^16 = 65536.
*/
/**
@ -326,6 +331,8 @@ PDFJS.getDocument = function getDocument(src,
params[key] = source[key];
}
params.rangeChunkSize = source.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;
workerInitializedCapability = createPromiseCapability();
transport = new WorkerTransport(workerInitializedCapability, source.range);
workerInitializedCapability.promise.then(function transportInitialized() {