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:
parent
0817375d2f
commit
ee9b5a12da
@ -15,11 +15,11 @@
|
|||||||
/* globals requirejs, __non_webpack_require__ */
|
/* globals requirejs, __non_webpack_require__ */
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AbortException, assert, createPromiseCapability, deprecated,
|
AbortException, assert, createPromiseCapability, getVerbosityLevel, info,
|
||||||
getVerbosityLevel, info, InvalidPDFException, isArrayBuffer, isSameOrigin,
|
InvalidPDFException, isArrayBuffer, isSameOrigin, loadJpegStream,
|
||||||
loadJpegStream, MessageHandler, MissingPDFException, NativeImageDecoding,
|
MessageHandler, MissingPDFException, NativeImageDecoding, PageViewport,
|
||||||
PageViewport, PasswordException, StatTimer, stringToBytes,
|
PasswordException, StatTimer, stringToBytes, UnexpectedResponseException,
|
||||||
UnexpectedResponseException, UnknownErrorException, Util, warn
|
UnknownErrorException, Util, warn
|
||||||
} from '../shared/util';
|
} from '../shared/util';
|
||||||
import {
|
import {
|
||||||
DOMCanvasFactory, DOMCMapReaderFactory, getDefaultSetting,
|
DOMCanvasFactory, DOMCMapReaderFactory, getDefaultSetting,
|
||||||
@ -156,46 +156,11 @@ function setPDFNetworkStreamClass(cls) {
|
|||||||
* Can be a url to where a PDF is located, a typed array (Uint8Array)
|
* Can be a url to where a PDF is located, a typed array (Uint8Array)
|
||||||
* already populated with data or parameter object.
|
* 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}
|
* @return {PDFDocumentLoadingTask}
|
||||||
*/
|
*/
|
||||||
function getDocument(src, pdfDataRangeTransport,
|
function getDocument(src) {
|
||||||
passwordCallback, progressCallback) {
|
|
||||||
var task = new PDFDocumentLoadingTask();
|
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;
|
var source;
|
||||||
if (typeof src === 'string') {
|
if (typeof src === 'string') {
|
||||||
source = { url: src, };
|
source = { url: src, };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user