|
|
|
@ -25,9 +25,11 @@
@@ -25,9 +25,11 @@
|
|
|
|
|
factory((root.pdfjsWebDownloadManager = {}), root.pdfjsWebPDFJS); |
|
|
|
|
} |
|
|
|
|
}(this, function (exports, pdfjsLib) { |
|
|
|
|
if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) { |
|
|
|
|
// eslint-disable-next-line no-inner-declarations
|
|
|
|
|
function download(blobUrl, filename) { |
|
|
|
|
if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function download(blobUrl, filename) { |
|
|
|
|
var a = document.createElement('a'); |
|
|
|
|
if (a.click) { |
|
|
|
|
// Use a.click() if available. Otherwise, Chrome might show
|
|
|
|
@ -61,11 +63,11 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) {
@@ -61,11 +63,11 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) {
|
|
|
|
|
} |
|
|
|
|
window.open(blobUrl, '_parent'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function DownloadManager() {} // eslint-disable-line no-inner-declarations
|
|
|
|
|
function DownloadManager() {} |
|
|
|
|
|
|
|
|
|
DownloadManager.prototype = { |
|
|
|
|
DownloadManager.prototype = { |
|
|
|
|
downloadUrl: function DownloadManager_downloadUrl(url, filename) { |
|
|
|
|
if (!pdfjsLib.createValidAbsoluteUrl(url, 'http://example.com')) { |
|
|
|
|
return; // restricted/invalid URL
|
|
|
|
@ -103,8 +105,7 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) {
@@ -103,8 +105,7 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) {
|
|
|
|
|
var blobUrl = URL.createObjectURL(blob); |
|
|
|
|
download(blobUrl, filename); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
exports.DownloadManager = DownloadManager; |
|
|
|
|
} |
|
|
|
|
exports.DownloadManager = DownloadManager; |
|
|
|
|
})); |
|
|
|
|