|
|
@ -471,8 +471,7 @@ var PDFViewerApplication = { |
|
|
|
return _this3.open(file, args); |
|
|
|
return _this3.open(file, args); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
var parameters = Object.create(null), |
|
|
|
var parameters = Object.create(null); |
|
|
|
scale = void 0; |
|
|
|
|
|
|
|
if (typeof file === 'string') { |
|
|
|
if (typeof file === 'string') { |
|
|
|
this.setTitleUsingUrl(file); |
|
|
|
this.setTitleUsingUrl(file); |
|
|
|
parameters.url = file; |
|
|
|
parameters.url = file; |
|
|
@ -484,14 +483,14 @@ var PDFViewerApplication = { |
|
|
|
} |
|
|
|
} |
|
|
|
if (args) { |
|
|
|
if (args) { |
|
|
|
for (var prop in args) { |
|
|
|
for (var prop in args) { |
|
|
|
|
|
|
|
if (!_pdf.PDFJS.pdfjsNext && prop === 'scale') { |
|
|
|
|
|
|
|
console.error('Call of open() with obsolete "scale" argument, ' + 'please use the "defaultZoomValue" preference instead.'); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} else if (prop === 'length') { |
|
|
|
|
|
|
|
this.pdfDocumentProperties.setFileSize(args[prop]); |
|
|
|
|
|
|
|
} |
|
|
|
parameters[prop] = args[prop]; |
|
|
|
parameters[prop] = args[prop]; |
|
|
|
} |
|
|
|
} |
|
|
|
if (args.scale) { |
|
|
|
|
|
|
|
scale = args.scale; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (args.length) { |
|
|
|
|
|
|
|
this.pdfDocumentProperties.setFileSize(args.length); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
var loadingTask = (0, _pdf.getDocument)(parameters); |
|
|
|
var loadingTask = (0, _pdf.getDocument)(parameters); |
|
|
|
this.pdfLoadingTask = loadingTask; |
|
|
|
this.pdfLoadingTask = loadingTask; |
|
|
@ -507,7 +506,7 @@ var PDFViewerApplication = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
loadingTask.onUnsupportedFeature = this.fallback.bind(this); |
|
|
|
loadingTask.onUnsupportedFeature = this.fallback.bind(this); |
|
|
|
return loadingTask.promise.then(function (pdfDocument) { |
|
|
|
return loadingTask.promise.then(function (pdfDocument) { |
|
|
|
_this3.load(pdfDocument, scale); |
|
|
|
_this3.load(pdfDocument); |
|
|
|
}, function (exception) { |
|
|
|
}, function (exception) { |
|
|
|
var message = exception && exception.message; |
|
|
|
var message = exception && exception.message; |
|
|
|
var loadingErrorMessage = void 0; |
|
|
|
var loadingErrorMessage = void 0; |
|
|
@ -620,10 +619,9 @@ var PDFViewerApplication = { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
load: function load(pdfDocument, scale) { |
|
|
|
load: function load(pdfDocument) { |
|
|
|
var _this6 = this; |
|
|
|
var _this6 = this; |
|
|
|
|
|
|
|
|
|
|
|
scale = scale || _ui_utils.UNKNOWN_SCALE; |
|
|
|
|
|
|
|
this.pdfDocument = pdfDocument; |
|
|
|
this.pdfDocument = pdfDocument; |
|
|
|
pdfDocument.getDownloadInfo().then(function () { |
|
|
|
pdfDocument.getDownloadInfo().then(function () { |
|
|
|
_this6.downloadComplete = true; |
|
|
|
_this6.downloadComplete = true; |
|
|
@ -697,10 +695,7 @@ var PDFViewerApplication = { |
|
|
|
var hash = _ref4.hash, |
|
|
|
var hash = _ref4.hash, |
|
|
|
sidebarView = _ref4.sidebarView; |
|
|
|
sidebarView = _ref4.sidebarView; |
|
|
|
|
|
|
|
|
|
|
|
_this6.setInitialView(hash, { |
|
|
|
_this6.setInitialView(hash, { sidebarView: sidebarView }); |
|
|
|
sidebarView: sidebarView, |
|
|
|
|
|
|
|
scale: scale |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
initialParams.hash = hash; |
|
|
|
initialParams.hash = hash; |
|
|
|
if (!_this6.isViewerEmbedded) { |
|
|
|
if (!_this6.isViewerEmbedded) { |
|
|
|
pdfViewer.focus(); |
|
|
|
pdfViewer.focus(); |
|
|
@ -798,11 +793,8 @@ var PDFViewerApplication = { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
setInitialView: function setInitialView(storedHash) { |
|
|
|
setInitialView: function setInitialView(storedHash) { |
|
|
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
|
|
|
var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, |
|
|
|
var _options$scale = options.scale, |
|
|
|
sidebarView = _ref6.sidebarView; |
|
|
|
scale = _options$scale === undefined ? 0 : _options$scale, |
|
|
|
|
|
|
|
_options$sidebarView = options.sidebarView, |
|
|
|
|
|
|
|
sidebarView = _options$sidebarView === undefined ? _pdf_sidebar.SidebarView.NONE : _options$sidebarView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.isInitialViewSet = true; |
|
|
|
this.isInitialViewSet = true; |
|
|
|
this.pdfSidebar.setInitialView(sidebarView); |
|
|
|
this.pdfSidebar.setInitialView(sidebarView); |
|
|
@ -815,9 +807,6 @@ var PDFViewerApplication = { |
|
|
|
this.initialBookmark = null; |
|
|
|
this.initialBookmark = null; |
|
|
|
} else if (storedHash) { |
|
|
|
} else if (storedHash) { |
|
|
|
this.pdfLinkService.setHash(storedHash); |
|
|
|
this.pdfLinkService.setHash(storedHash); |
|
|
|
} else if (scale) { |
|
|
|
|
|
|
|
this.pdfViewer.currentScaleValue = scale; |
|
|
|
|
|
|
|
this.page = 1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel); |
|
|
|
this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel); |
|
|
|
this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber); |
|
|
|
this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber); |
|
|
|