Remove the deprecated parameters for getDocument of the API

This is deprecated since October 2015 with a visible message, so we can
safely remove this now.
This commit is contained in:
Tim van der Meij 2017-10-02 23:05:32 +02:00
parent 0817375d2f
commit ee9b5a12da
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -15,11 +15,11 @@
/* globals requirejs, __non_webpack_require__ */
import {
AbortException, assert, createPromiseCapability, deprecated,
getVerbosityLevel, info, InvalidPDFException, isArrayBuffer, isSameOrigin,
loadJpegStream, MessageHandler, MissingPDFException, NativeImageDecoding,
PageViewport, PasswordException, StatTimer, stringToBytes,
UnexpectedResponseException, UnknownErrorException, Util, warn
AbortException, assert, createPromiseCapability, getVerbosityLevel, info,
InvalidPDFException, isArrayBuffer, isSameOrigin, loadJpegStream,
MessageHandler, MissingPDFException, NativeImageDecoding, PageViewport,
PasswordException, StatTimer, stringToBytes, UnexpectedResponseException,
UnknownErrorException, Util, warn
} from '../shared/util';
import {
DOMCanvasFactory, DOMCMapReaderFactory, getDefaultSetting,
@ -156,46 +156,11 @@ function setPDFNetworkStreamClass(cls) {
* Can be a url to where a PDF is located, a typed array (Uint8Array)
* already populated with data or parameter object.
*
* @param {PDFDataRangeTransport} pdfDataRangeTransport (deprecated) It is used
* if you want to manually serve range requests for data in the PDF.
*
* @param {function} passwordCallback (deprecated) It is used to request a
* password if wrong or no password was provided. The callback receives two
* parameters: function that needs to be called with new password and reason
* (see {PasswordResponses}).
*
* @param {function} progressCallback (deprecated) It is used to be able to
* monitor the loading progress of the PDF file (necessary to implement e.g.
* a loading bar). The callback receives an {Object} with the properties:
* {number} loaded and {number} total.
*
* @return {PDFDocumentLoadingTask}
*/
function getDocument(src, pdfDataRangeTransport,
passwordCallback, progressCallback) {
function getDocument(src) {
var task = new PDFDocumentLoadingTask();
// Support of the obsolete arguments (for compatibility with API v1.0)
if (arguments.length > 1) {
deprecated('getDocument is called with pdfDataRangeTransport, ' +
'passwordCallback or progressCallback argument');
}
if (pdfDataRangeTransport) {
if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) {
// Not a PDFDataRangeTransport instance, trying to add missing properties.
pdfDataRangeTransport = Object.create(pdfDataRangeTransport);
pdfDataRangeTransport.length = src.length;
pdfDataRangeTransport.initialData = src.initialData;
if (!pdfDataRangeTransport.abort) {
pdfDataRangeTransport.abort = function () {};
}
}
src = Object.create(src);
src.range = pdfDataRangeTransport;
}
task.onPassword = passwordCallback || null;
task.onProgress = progressCallback || null;
var source;
if (typeof src === 'string') {
source = { url: src, };