|
|
@ -21,7 +21,7 @@ exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFVi |
|
|
|
|
|
|
|
|
|
|
|
var _ui_utils = require('./ui_utils'); |
|
|
|
var _ui_utils = require('./ui_utils'); |
|
|
|
|
|
|
|
|
|
|
|
var _pdfjs = require('./pdfjs'); |
|
|
|
var _pdf = require('../pdf'); |
|
|
|
|
|
|
|
|
|
|
|
var _pdf_cursor_tools = require('./pdf_cursor_tools'); |
|
|
|
var _pdf_cursor_tools = require('./pdf_cursor_tools'); |
|
|
|
|
|
|
|
|
|
|
@ -137,7 +137,7 @@ var PDFViewerApplication = { |
|
|
|
var _this = this; |
|
|
|
var _this = this; |
|
|
|
|
|
|
|
|
|
|
|
this.preferences = this.externalServices.createPreferences(); |
|
|
|
this.preferences = this.externalServices.createPreferences(); |
|
|
|
configure(_pdfjs.PDFJS); |
|
|
|
configure(_pdf.PDFJS); |
|
|
|
this.appConfig = appConfig; |
|
|
|
this.appConfig = appConfig; |
|
|
|
return this._readPreferences().then(function () { |
|
|
|
return this._readPreferences().then(function () { |
|
|
|
return _this._initializeViewerComponents(); |
|
|
|
return _this._initializeViewerComponents(); |
|
|
@ -147,8 +147,8 @@ var PDFViewerApplication = { |
|
|
|
_ui_utils.localized.then(function () { |
|
|
|
_ui_utils.localized.then(function () { |
|
|
|
_this.eventBus.dispatch('localized'); |
|
|
|
_this.eventBus.dispatch('localized'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (_this.isViewerEmbedded && !_pdfjs.PDFJS.isExternalLinkTargetSet()) { |
|
|
|
if (_this.isViewerEmbedded && !_pdf.PDFJS.isExternalLinkTargetSet()) { |
|
|
|
_pdfjs.PDFJS.externalLinkTarget = _pdfjs.PDFJS.LinkTarget.TOP; |
|
|
|
_pdf.PDFJS.externalLinkTarget = _pdf.PDFJS.LinkTarget.TOP; |
|
|
|
} |
|
|
|
} |
|
|
|
_this.initialized = true; |
|
|
|
_this.initialized = true; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -158,7 +158,7 @@ var PDFViewerApplication = { |
|
|
|
viewerPrefs = this.viewerPrefs; |
|
|
|
viewerPrefs = this.viewerPrefs; |
|
|
|
|
|
|
|
|
|
|
|
return Promise.all([preferences.get('enableWebGL').then(function resolved(value) { |
|
|
|
return Promise.all([preferences.get('enableWebGL').then(function resolved(value) { |
|
|
|
_pdfjs.PDFJS.disableWebGL = !value; |
|
|
|
_pdf.PDFJS.disableWebGL = !value; |
|
|
|
}), preferences.get('sidebarViewOnLoad').then(function resolved(value) { |
|
|
|
}), preferences.get('sidebarViewOnLoad').then(function resolved(value) { |
|
|
|
viewerPrefs['sidebarViewOnLoad'] = value; |
|
|
|
viewerPrefs['sidebarViewOnLoad'] = value; |
|
|
|
}), preferences.get('pdfBugEnabled').then(function resolved(value) { |
|
|
|
}), preferences.get('pdfBugEnabled').then(function resolved(value) { |
|
|
@ -170,34 +170,34 @@ var PDFViewerApplication = { |
|
|
|
}), preferences.get('enhanceTextSelection').then(function resolved(value) { |
|
|
|
}), preferences.get('enhanceTextSelection').then(function resolved(value) { |
|
|
|
viewerPrefs['enhanceTextSelection'] = value; |
|
|
|
viewerPrefs['enhanceTextSelection'] = value; |
|
|
|
}), preferences.get('disableTextLayer').then(function resolved(value) { |
|
|
|
}), preferences.get('disableTextLayer').then(function resolved(value) { |
|
|
|
if (_pdfjs.PDFJS.disableTextLayer === true) { |
|
|
|
if (_pdf.PDFJS.disableTextLayer === true) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_pdfjs.PDFJS.disableTextLayer = value; |
|
|
|
_pdf.PDFJS.disableTextLayer = value; |
|
|
|
}), preferences.get('disableRange').then(function resolved(value) { |
|
|
|
}), preferences.get('disableRange').then(function resolved(value) { |
|
|
|
if (_pdfjs.PDFJS.disableRange === true) { |
|
|
|
if (_pdf.PDFJS.disableRange === true) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_pdfjs.PDFJS.disableRange = value; |
|
|
|
_pdf.PDFJS.disableRange = value; |
|
|
|
}), preferences.get('disableStream').then(function resolved(value) { |
|
|
|
}), preferences.get('disableStream').then(function resolved(value) { |
|
|
|
if (_pdfjs.PDFJS.disableStream === true) { |
|
|
|
if (_pdf.PDFJS.disableStream === true) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_pdfjs.PDFJS.disableStream = value; |
|
|
|
_pdf.PDFJS.disableStream = value; |
|
|
|
}), preferences.get('disableAutoFetch').then(function resolved(value) { |
|
|
|
}), preferences.get('disableAutoFetch').then(function resolved(value) { |
|
|
|
_pdfjs.PDFJS.disableAutoFetch = value; |
|
|
|
_pdf.PDFJS.disableAutoFetch = value; |
|
|
|
}), preferences.get('disableFontFace').then(function resolved(value) { |
|
|
|
}), preferences.get('disableFontFace').then(function resolved(value) { |
|
|
|
if (_pdfjs.PDFJS.disableFontFace === true) { |
|
|
|
if (_pdf.PDFJS.disableFontFace === true) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_pdfjs.PDFJS.disableFontFace = value; |
|
|
|
_pdf.PDFJS.disableFontFace = value; |
|
|
|
}), preferences.get('useOnlyCssZoom').then(function resolved(value) { |
|
|
|
}), preferences.get('useOnlyCssZoom').then(function resolved(value) { |
|
|
|
_pdfjs.PDFJS.useOnlyCssZoom = value; |
|
|
|
_pdf.PDFJS.useOnlyCssZoom = value; |
|
|
|
}), preferences.get('externalLinkTarget').then(function resolved(value) { |
|
|
|
}), preferences.get('externalLinkTarget').then(function resolved(value) { |
|
|
|
if (_pdfjs.PDFJS.isExternalLinkTargetSet()) { |
|
|
|
if (_pdf.PDFJS.isExternalLinkTargetSet()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
_pdfjs.PDFJS.externalLinkTarget = value; |
|
|
|
_pdf.PDFJS.externalLinkTarget = value; |
|
|
|
}), preferences.get('renderer').then(function resolved(value) { |
|
|
|
}), preferences.get('renderer').then(function resolved(value) { |
|
|
|
viewerPrefs['renderer'] = value; |
|
|
|
viewerPrefs['renderer'] = value; |
|
|
|
}), preferences.get('renderInteractiveForms').then(function resolved(value) { |
|
|
|
}), preferences.get('renderInteractiveForms').then(function resolved(value) { |
|
|
@ -355,10 +355,10 @@ var PDFViewerApplication = { |
|
|
|
if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) { |
|
|
|
if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) { |
|
|
|
support = false; |
|
|
|
support = false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (support && _pdfjs.PDFJS.disableFullscreen === true) { |
|
|
|
if (support && _pdf.PDFJS.disableFullscreen === true) { |
|
|
|
support = false; |
|
|
|
support = false; |
|
|
|
} |
|
|
|
} |
|
|
|
return (0, _pdfjs.shadow)(this, 'supportsFullscreen', support); |
|
|
|
return (0, _pdf.shadow)(this, 'supportsFullscreen', support); |
|
|
|
}, |
|
|
|
}, |
|
|
|
get supportsIntegratedFind() { |
|
|
|
get supportsIntegratedFind() { |
|
|
|
return this.externalServices.supportsIntegratedFind; |
|
|
|
return this.externalServices.supportsIntegratedFind; |
|
|
@ -371,7 +371,7 @@ var PDFViewerApplication = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
get loadingBar() { |
|
|
|
get loadingBar() { |
|
|
|
var bar = new _ui_utils.ProgressBar('#loadingBar', {}); |
|
|
|
var bar = new _ui_utils.ProgressBar('#loadingBar', {}); |
|
|
|
return (0, _pdfjs.shadow)(this, 'loadingBar', bar); |
|
|
|
return (0, _pdf.shadow)(this, 'loadingBar', bar); |
|
|
|
}, |
|
|
|
}, |
|
|
|
get supportedMouseWheelZoomModifierKeys() { |
|
|
|
get supportedMouseWheelZoomModifierKeys() { |
|
|
|
return this.externalServices.supportedMouseWheelZoomModifierKeys; |
|
|
|
return this.externalServices.supportedMouseWheelZoomModifierKeys; |
|
|
@ -385,7 +385,7 @@ var PDFViewerApplication = { |
|
|
|
var title = (0, _ui_utils.getPDFFileNameFromURL)(url, ''); |
|
|
|
var title = (0, _ui_utils.getPDFFileNameFromURL)(url, ''); |
|
|
|
if (!title) { |
|
|
|
if (!title) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
title = decodeURIComponent((0, _pdfjs.getFilenameFromUrl)(url)) || url; |
|
|
|
title = decodeURIComponent((0, _pdf.getFilenameFromUrl)(url)) || url; |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
title = url; |
|
|
|
title = url; |
|
|
|
} |
|
|
|
} |
|
|
@ -462,7 +462,7 @@ var PDFViewerApplication = { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.downloadComplete = false; |
|
|
|
this.downloadComplete = false; |
|
|
|
var loadingTask = (0, _pdfjs.getDocument)(parameters); |
|
|
|
var loadingTask = (0, _pdf.getDocument)(parameters); |
|
|
|
this.pdfLoadingTask = loadingTask; |
|
|
|
this.pdfLoadingTask = loadingTask; |
|
|
|
loadingTask.onPassword = function (updateCallback, reason) { |
|
|
|
loadingTask.onPassword = function (updateCallback, reason) { |
|
|
|
_this3.passwordPrompt.setUpdateCallback(updateCallback, reason); |
|
|
|
_this3.passwordPrompt.setUpdateCallback(updateCallback, reason); |
|
|
@ -480,11 +480,11 @@ var PDFViewerApplication = { |
|
|
|
}, function (exception) { |
|
|
|
}, function (exception) { |
|
|
|
var message = exception && exception.message; |
|
|
|
var message = exception && exception.message; |
|
|
|
var loadingErrorMessage = _ui_utils.mozL10n.get('loading_error', null, 'An error occurred while loading the PDF.'); |
|
|
|
var loadingErrorMessage = _ui_utils.mozL10n.get('loading_error', null, 'An error occurred while loading the PDF.'); |
|
|
|
if (exception instanceof _pdfjs.InvalidPDFException) { |
|
|
|
if (exception instanceof _pdf.InvalidPDFException) { |
|
|
|
loadingErrorMessage = _ui_utils.mozL10n.get('invalid_file_error', null, 'Invalid or corrupted PDF file.'); |
|
|
|
loadingErrorMessage = _ui_utils.mozL10n.get('invalid_file_error', null, 'Invalid or corrupted PDF file.'); |
|
|
|
} else if (exception instanceof _pdfjs.MissingPDFException) { |
|
|
|
} else if (exception instanceof _pdf.MissingPDFException) { |
|
|
|
loadingErrorMessage = _ui_utils.mozL10n.get('missing_file_error', null, 'Missing PDF file.'); |
|
|
|
loadingErrorMessage = _ui_utils.mozL10n.get('missing_file_error', null, 'Missing PDF file.'); |
|
|
|
} else if (exception instanceof _pdfjs.UnexpectedResponseException) { |
|
|
|
} else if (exception instanceof _pdf.UnexpectedResponseException) { |
|
|
|
loadingErrorMessage = _ui_utils.mozL10n.get('unexpected_response_error', null, 'Unexpected server response.'); |
|
|
|
loadingErrorMessage = _ui_utils.mozL10n.get('unexpected_response_error', null, 'Unexpected server response.'); |
|
|
|
} |
|
|
|
} |
|
|
|
_this3.error(loadingErrorMessage, { message: message }); |
|
|
|
_this3.error(loadingErrorMessage, { message: message }); |
|
|
@ -511,15 +511,15 @@ var PDFViewerApplication = { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
this.pdfDocument.getData().then(function getDataSuccess(data) { |
|
|
|
this.pdfDocument.getData().then(function getDataSuccess(data) { |
|
|
|
var blob = (0, _pdfjs.createBlob)(data, 'application/pdf'); |
|
|
|
var blob = (0, _pdf.createBlob)(data, 'application/pdf'); |
|
|
|
downloadManager.download(blob, url, filename); |
|
|
|
downloadManager.download(blob, url, filename); |
|
|
|
}, downloadByUrl).then(null, downloadByUrl); |
|
|
|
}, downloadByUrl).then(null, downloadByUrl); |
|
|
|
}, |
|
|
|
}, |
|
|
|
fallback: function pdfViewFallback(featureId) {}, |
|
|
|
fallback: function pdfViewFallback(featureId) {}, |
|
|
|
error: function pdfViewError(message, moreInfo) { |
|
|
|
error: function pdfViewError(message, moreInfo) { |
|
|
|
var moreInfoText = _ui_utils.mozL10n.get('error_version_info', { |
|
|
|
var moreInfoText = _ui_utils.mozL10n.get('error_version_info', { |
|
|
|
version: _pdfjs.version || '?', |
|
|
|
version: _pdf.version || '?', |
|
|
|
build: _pdfjs.build || '?' |
|
|
|
build: _pdf.build || '?' |
|
|
|
}, 'PDF.js v{{version}} (build: {{build}})') + '\n'; |
|
|
|
}, 'PDF.js v{{version}} (build: {{build}})') + '\n'; |
|
|
|
if (moreInfo) { |
|
|
|
if (moreInfo) { |
|
|
|
moreInfoText += _ui_utils.mozL10n.get('error_message', { message: moreInfo.message }, 'Message: {{message}}'); |
|
|
|
moreInfoText += _ui_utils.mozL10n.get('error_message', { message: moreInfo.message }, 'Message: {{message}}'); |
|
|
@ -570,7 +570,7 @@ var PDFViewerApplication = { |
|
|
|
var percent = Math.round(level * 100); |
|
|
|
var percent = Math.round(level * 100); |
|
|
|
if (percent > this.loadingBar.percent || isNaN(percent)) { |
|
|
|
if (percent > this.loadingBar.percent || isNaN(percent)) { |
|
|
|
this.loadingBar.percent = percent; |
|
|
|
this.loadingBar.percent = percent; |
|
|
|
if (_pdfjs.PDFJS.disableAutoFetch && percent) { |
|
|
|
if (_pdf.PDFJS.disableAutoFetch && percent) { |
|
|
|
if (this.disableAutoFetchLoadingBarTimeout) { |
|
|
|
if (this.disableAutoFetchLoadingBarTimeout) { |
|
|
|
clearTimeout(this.disableAutoFetchLoadingBarTimeout); |
|
|
|
clearTimeout(this.disableAutoFetchLoadingBarTimeout); |
|
|
|
this.disableAutoFetchLoadingBarTimeout = null; |
|
|
|
this.disableAutoFetchLoadingBarTimeout = null; |
|
|
@ -614,7 +614,7 @@ var PDFViewerApplication = { |
|
|
|
pdfThumbnailViewer.setDocument(pdfDocument); |
|
|
|
pdfThumbnailViewer.setDocument(pdfDocument); |
|
|
|
firstPagePromise.then(function (pdfPage) { |
|
|
|
firstPagePromise.then(function (pdfPage) { |
|
|
|
_this5.loadingBar.setWidth(_this5.appConfig.viewerContainer); |
|
|
|
_this5.loadingBar.setWidth(_this5.appConfig.viewerContainer); |
|
|
|
if (!_pdfjs.PDFJS.disableHistory && !_this5.isViewerEmbedded) { |
|
|
|
if (!_pdf.PDFJS.disableHistory && !_this5.isViewerEmbedded) { |
|
|
|
if (!_this5.viewerPrefs['showPreviousViewOnLoad']) { |
|
|
|
if (!_this5.viewerPrefs['showPreviousViewOnLoad']) { |
|
|
|
_this5.pdfHistory.clearHistoryState(); |
|
|
|
_this5.pdfHistory.clearHistoryState(); |
|
|
|
} |
|
|
|
} |
|
|
@ -706,7 +706,7 @@ var PDFViewerApplication = { |
|
|
|
pdfDocument.getJavaScript().then(function (javaScript) { |
|
|
|
pdfDocument.getJavaScript().then(function (javaScript) { |
|
|
|
if (javaScript.length) { |
|
|
|
if (javaScript.length) { |
|
|
|
console.warn('Warning: JavaScript is not supported'); |
|
|
|
console.warn('Warning: JavaScript is not supported'); |
|
|
|
_this5.fallback(_pdfjs.UNSUPPORTED_FEATURES.javaScript); |
|
|
|
_this5.fallback(_pdf.UNSUPPORTED_FEATURES.javaScript); |
|
|
|
} |
|
|
|
} |
|
|
|
var regex = /\bprint\s*\(/; |
|
|
|
var regex = /\bprint\s*\(/; |
|
|
|
for (var i = 0, ii = javaScript.length; i < ii; i++) { |
|
|
|
for (var i = 0, ii = javaScript.length; i < ii; i++) { |
|
|
@ -734,7 +734,7 @@ var PDFViewerApplication = { |
|
|
|
|
|
|
|
|
|
|
|
_this5.documentInfo = info; |
|
|
|
_this5.documentInfo = info; |
|
|
|
_this5.metadata = metadata; |
|
|
|
_this5.metadata = metadata; |
|
|
|
console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdfjs.version || '-') + (!_pdfjs.PDFJS.disableWebGL ? ' [WebGL]' : '') + ')'); |
|
|
|
console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdf.version || '-') + (!_pdf.PDFJS.disableWebGL ? ' [WebGL]' : '') + ')'); |
|
|
|
var pdfTitle = void 0; |
|
|
|
var pdfTitle = void 0; |
|
|
|
if (metadata && metadata.has('dc:title')) { |
|
|
|
if (metadata && metadata.has('dc:title')) { |
|
|
|
var title = metadata.get('dc:title'); |
|
|
|
var title = metadata.get('dc:title'); |
|
|
@ -750,7 +750,7 @@ var PDFViewerApplication = { |
|
|
|
} |
|
|
|
} |
|
|
|
if (info.IsAcroFormPresent) { |
|
|
|
if (info.IsAcroFormPresent) { |
|
|
|
console.warn('Warning: AcroForm/XFA is not supported'); |
|
|
|
console.warn('Warning: AcroForm/XFA is not supported'); |
|
|
|
_this5.fallback(_pdfjs.UNSUPPORTED_FEATURES.forms); |
|
|
|
_this5.fallback(_pdf.UNSUPPORTED_FEATURES.forms); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -940,8 +940,8 @@ function loadAndEnablePDFBug(enabledTabs) { |
|
|
|
script.onload = function () { |
|
|
|
script.onload = function () { |
|
|
|
PDFBug.enable(enabledTabs); |
|
|
|
PDFBug.enable(enabledTabs); |
|
|
|
PDFBug.init({ |
|
|
|
PDFBug.init({ |
|
|
|
PDFJS: _pdfjs.PDFJS, |
|
|
|
PDFJS: _pdf.PDFJS, |
|
|
|
OPS: _pdfjs.OPS |
|
|
|
OPS: _pdf.OPS |
|
|
|
}, appConfig.mainContainer); |
|
|
|
}, appConfig.mainContainer); |
|
|
|
resolve(); |
|
|
|
resolve(); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -975,42 +975,42 @@ function webViewerInitialized() { |
|
|
|
var hash = document.location.hash.substring(1); |
|
|
|
var hash = document.location.hash.substring(1); |
|
|
|
var hashParams = (0, _ui_utils.parseQueryString)(hash); |
|
|
|
var hashParams = (0, _ui_utils.parseQueryString)(hash); |
|
|
|
if ('disableworker' in hashParams) { |
|
|
|
if ('disableworker' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableWorker = hashParams['disableworker'] === 'true'; |
|
|
|
_pdf.PDFJS.disableWorker = hashParams['disableworker'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('disablerange' in hashParams) { |
|
|
|
if ('disablerange' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableRange = hashParams['disablerange'] === 'true'; |
|
|
|
_pdf.PDFJS.disableRange = hashParams['disablerange'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('disablestream' in hashParams) { |
|
|
|
if ('disablestream' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableStream = hashParams['disablestream'] === 'true'; |
|
|
|
_pdf.PDFJS.disableStream = hashParams['disablestream'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('disableautofetch' in hashParams) { |
|
|
|
if ('disableautofetch' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableAutoFetch = hashParams['disableautofetch'] === 'true'; |
|
|
|
_pdf.PDFJS.disableAutoFetch = hashParams['disableautofetch'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('disablefontface' in hashParams) { |
|
|
|
if ('disablefontface' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableFontFace = hashParams['disablefontface'] === 'true'; |
|
|
|
_pdf.PDFJS.disableFontFace = hashParams['disablefontface'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('disablehistory' in hashParams) { |
|
|
|
if ('disablehistory' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableHistory = hashParams['disablehistory'] === 'true'; |
|
|
|
_pdf.PDFJS.disableHistory = hashParams['disablehistory'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('webgl' in hashParams) { |
|
|
|
if ('webgl' in hashParams) { |
|
|
|
_pdfjs.PDFJS.disableWebGL = hashParams['webgl'] !== 'true'; |
|
|
|
_pdf.PDFJS.disableWebGL = hashParams['webgl'] !== 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('useonlycsszoom' in hashParams) { |
|
|
|
if ('useonlycsszoom' in hashParams) { |
|
|
|
_pdfjs.PDFJS.useOnlyCssZoom = hashParams['useonlycsszoom'] === 'true'; |
|
|
|
_pdf.PDFJS.useOnlyCssZoom = hashParams['useonlycsszoom'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('verbosity' in hashParams) { |
|
|
|
if ('verbosity' in hashParams) { |
|
|
|
_pdfjs.PDFJS.verbosity = hashParams['verbosity'] | 0; |
|
|
|
_pdf.PDFJS.verbosity = hashParams['verbosity'] | 0; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('ignorecurrentpositiononzoom' in hashParams) { |
|
|
|
if ('ignorecurrentpositiononzoom' in hashParams) { |
|
|
|
_pdfjs.PDFJS.ignoreCurrentPositionOnZoom = hashParams['ignorecurrentpositiononzoom'] === 'true'; |
|
|
|
_pdf.PDFJS.ignoreCurrentPositionOnZoom = hashParams['ignorecurrentpositiononzoom'] === 'true'; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('locale' in hashParams) { |
|
|
|
if ('locale' in hashParams) { |
|
|
|
_pdfjs.PDFJS.locale = hashParams['locale']; |
|
|
|
_pdf.PDFJS.locale = hashParams['locale']; |
|
|
|
} |
|
|
|
} |
|
|
|
if ('textlayer' in hashParams) { |
|
|
|
if ('textlayer' in hashParams) { |
|
|
|
switch (hashParams['textlayer']) { |
|
|
|
switch (hashParams['textlayer']) { |
|
|
|
case 'off': |
|
|
|
case 'off': |
|
|
|
_pdfjs.PDFJS.disableTextLayer = true; |
|
|
|
_pdf.PDFJS.disableTextLayer = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'visible': |
|
|
|
case 'visible': |
|
|
|
case 'shadow': |
|
|
|
case 'shadow': |
|
|
@ -1021,13 +1021,13 @@ function webViewerInitialized() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ('pdfbug' in hashParams) { |
|
|
|
if ('pdfbug' in hashParams) { |
|
|
|
_pdfjs.PDFJS.pdfBug = true; |
|
|
|
_pdf.PDFJS.pdfBug = true; |
|
|
|
var pdfBug = hashParams['pdfbug']; |
|
|
|
var pdfBug = hashParams['pdfbug']; |
|
|
|
var enabled = pdfBug.split(','); |
|
|
|
var enabled = pdfBug.split(','); |
|
|
|
waitForBeforeOpening.push(loadAndEnablePDFBug(enabled)); |
|
|
|
waitForBeforeOpening.push(loadAndEnablePDFBug(enabled)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
_ui_utils.mozL10n.setLanguage(_pdfjs.PDFJS.locale); |
|
|
|
_ui_utils.mozL10n.setLanguage(_pdf.PDFJS.locale); |
|
|
|
if (!PDFViewerApplication.supportsPrinting) { |
|
|
|
if (!PDFViewerApplication.supportsPrinting) { |
|
|
|
appConfig.toolbar.print.classList.add('hidden'); |
|
|
|
appConfig.toolbar.print.classList.add('hidden'); |
|
|
|
appConfig.secondaryToolbar.printButton.classList.add('hidden'); |
|
|
|
appConfig.secondaryToolbar.printButton.classList.add('hidden'); |
|
|
@ -1090,7 +1090,7 @@ function webViewerPageRendered(e) { |
|
|
|
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex); |
|
|
|
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex); |
|
|
|
thumbnailView.setImage(pageView); |
|
|
|
thumbnailView.setImage(pageView); |
|
|
|
} |
|
|
|
} |
|
|
|
if (_pdfjs.PDFJS.pdfBug && Stats.enabled && pageView.stats) { |
|
|
|
if (_pdf.PDFJS.pdfBug && Stats.enabled && pageView.stats) { |
|
|
|
Stats.add(pageNumber, pageView.stats); |
|
|
|
Stats.add(pageNumber, pageView.stats); |
|
|
|
} |
|
|
|
} |
|
|
|
if (pageView.error) { |
|
|
|
if (pageView.error) { |
|
|
@ -1192,7 +1192,7 @@ var webViewerFileInputChange; |
|
|
|
{ |
|
|
|
{ |
|
|
|
webViewerFileInputChange = function webViewerFileInputChange(e) { |
|
|
|
webViewerFileInputChange = function webViewerFileInputChange(e) { |
|
|
|
var file = e.fileInput.files[0]; |
|
|
|
var file = e.fileInput.files[0]; |
|
|
|
if (!_pdfjs.PDFJS.disableCreateObjectURL && typeof URL !== 'undefined' && URL.createObjectURL) { |
|
|
|
if (!_pdf.PDFJS.disableCreateObjectURL && typeof URL !== 'undefined' && URL.createObjectURL) { |
|
|
|
PDFViewerApplication.open(URL.createObjectURL(file)); |
|
|
|
PDFViewerApplication.open(URL.createObjectURL(file)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var fileReader = new FileReader(); |
|
|
|
var fileReader = new FileReader(); |
|
|
@ -1294,7 +1294,7 @@ function webViewerPageChanging(e) { |
|
|
|
if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { |
|
|
|
if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { |
|
|
|
PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); |
|
|
|
PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); |
|
|
|
} |
|
|
|
} |
|
|
|
if (_pdfjs.PDFJS.pdfBug && Stats.enabled) { |
|
|
|
if (_pdf.PDFJS.pdfBug && Stats.enabled) { |
|
|
|
var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); |
|
|
|
var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); |
|
|
|
if (pageView.stats) { |
|
|
|
if (pageView.stats) { |
|
|
|
Stats.add(page, pageView.stats); |
|
|
|
Stats.add(page, pageView.stats); |
|
|
|