|
|
@ -14,95 +14,38 @@ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
/* globals PDFBug, Stats */ |
|
|
|
/* globals PDFBug, Stats */ |
|
|
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
import { |
|
|
|
|
|
|
|
animationStarted, DEFAULT_SCALE_VALUE, getPDFFileNameFromURL, localized, |
|
|
|
(function (root, factory) { |
|
|
|
MAX_SCALE, MIN_SCALE, mozL10n, noContextMenuHandler, normalizeWheelEventDelta, |
|
|
|
if (typeof define === 'function' && define.amd) { |
|
|
|
parseQueryString, ProgressBar, RendererType, UNKNOWN_SCALE |
|
|
|
define('pdfjs-web/app', ['exports', 'pdfjs-web/ui_utils', |
|
|
|
} from 'pdfjs-web/ui_utils'; |
|
|
|
'pdfjs-web/download_manager', 'pdfjs-web/pdf_history', |
|
|
|
import { |
|
|
|
'pdfjs-web/preferences', 'pdfjs-web/pdf_sidebar', |
|
|
|
build, createBlob, getDocument, getFilenameFromUrl, InvalidPDFException, |
|
|
|
'pdfjs-web/view_history', 'pdfjs-web/pdf_thumbnail_viewer', |
|
|
|
MissingPDFException, OPS, PDFJS, shadow, UnexpectedResponseException, |
|
|
|
'pdfjs-web/toolbar', 'pdfjs-web/secondary_toolbar', |
|
|
|
UNSUPPORTED_FEATURES, version, |
|
|
|
'pdfjs-web/password_prompt', 'pdfjs-web/pdf_presentation_mode', |
|
|
|
} from 'pdfjs-web/pdfjs'; |
|
|
|
'pdfjs-web/pdf_document_properties', 'pdfjs-web/hand_tool', |
|
|
|
import { |
|
|
|
'pdfjs-web/pdf_viewer', 'pdfjs-web/pdf_rendering_queue', |
|
|
|
PDFRenderingQueue, RenderingStates |
|
|
|
'pdfjs-web/pdf_link_service', 'pdfjs-web/pdf_outline_viewer', |
|
|
|
} from 'pdfjs-web/pdf_rendering_queue'; |
|
|
|
'pdfjs-web/overlay_manager', 'pdfjs-web/pdf_attachment_viewer', |
|
|
|
import { PDFSidebar, SidebarView } from 'pdfjs-web/pdf_sidebar'; |
|
|
|
'pdfjs-web/pdf_find_controller', 'pdfjs-web/pdf_find_bar', |
|
|
|
import { PDFViewer, PresentationModeState } from 'pdfjs-web/pdf_viewer'; |
|
|
|
'pdfjs-web/dom_events', 'pdfjs-web/pdfjs'], |
|
|
|
import { getGlobalEventBus } from 'pdfjs-web/dom_events'; |
|
|
|
factory); |
|
|
|
import { HandTool } from 'pdfjs-web/hand_tool'; |
|
|
|
} else if (typeof exports !== 'undefined') { |
|
|
|
import { OverlayManager } from 'pdfjs-web/overlay_manager'; |
|
|
|
factory(exports, require('./ui_utils.js'), require('./download_manager.js'), |
|
|
|
import { PasswordPrompt } from 'pdfjs-web/password_prompt'; |
|
|
|
require('./pdf_history.js'), require('./preferences.js'), |
|
|
|
import { PDFAttachmentViewer } from 'pdfjs-web/pdf_attachment_viewer'; |
|
|
|
require('./pdf_sidebar.js'), require('./view_history.js'), |
|
|
|
import { PDFDocumentProperties } from 'pdfjs-web/pdf_document_properties'; |
|
|
|
require('./pdf_thumbnail_viewer.js'), require('./toolbar.js'), |
|
|
|
import { PDFFindBar } from 'pdfjs-web/pdf_find_bar'; |
|
|
|
require('./secondary_toolbar.js'), require('./password_prompt.js'), |
|
|
|
import { PDFFindController } from 'pdfjs-web/pdf_find_controller'; |
|
|
|
require('./pdf_presentation_mode.js'), |
|
|
|
import { PDFHistory } from 'pdfjs-web/pdf_history'; |
|
|
|
require('./pdf_document_properties.js'), require('./hand_tool.js'), |
|
|
|
import { PDFLinkService } from 'pdfjs-web/pdf_link_service'; |
|
|
|
require('./pdf_viewer.js'), require('./pdf_rendering_queue.js'), |
|
|
|
import { PDFOutlineViewer } from 'pdfjs-web/pdf_outline_viewer'; |
|
|
|
require('./pdf_link_service.js'), require('./pdf_outline_viewer.js'), |
|
|
|
import { PDFPresentationMode } from 'pdfjs-web/pdf_presentation_mode'; |
|
|
|
require('./overlay_manager.js'), require('./pdf_attachment_viewer.js'), |
|
|
|
import { PDFThumbnailViewer } from 'pdfjs-web/pdf_thumbnail_viewer'; |
|
|
|
require('./pdf_find_controller.js'), require('./pdf_find_bar.js'), |
|
|
|
import { Preferences } from 'pdfjs-web/preferences'; |
|
|
|
require('./dom_events.js'), require('./pdfjs.js')); |
|
|
|
import { SecondaryToolbar } from 'pdfjs-web/secondary_toolbar'; |
|
|
|
} else { |
|
|
|
import { Toolbar } from 'pdfjs-web/toolbar'; |
|
|
|
factory((root.pdfjsWebApp = {}), root.pdfjsWebUIUtils, |
|
|
|
import { ViewHistory } from 'pdfjs-web/view_history'; |
|
|
|
root.pdfjsWebDownloadManager, root.pdfjsWebPDFHistory, |
|
|
|
|
|
|
|
root.pdfjsWebPreferences, root.pdfjsWebPDFSidebar, |
|
|
|
|
|
|
|
root.pdfjsWebViewHistory, root.pdfjsWebPDFThumbnailViewer, |
|
|
|
|
|
|
|
root.pdfjsWebToolbar, root.pdfjsWebSecondaryToolbar, |
|
|
|
|
|
|
|
root.pdfjsWebPasswordPrompt, root.pdfjsWebPDFPresentationMode, |
|
|
|
|
|
|
|
root.pdfjsWebPDFDocumentProperties, root.pdfjsWebHandTool, |
|
|
|
|
|
|
|
root.pdfjsWebPDFViewer, root.pdfjsWebPDFRenderingQueue, |
|
|
|
|
|
|
|
root.pdfjsWebPDFLinkService, root.pdfjsWebPDFOutlineViewer, |
|
|
|
|
|
|
|
root.pdfjsWebOverlayManager, root.pdfjsWebPDFAttachmentViewer, |
|
|
|
|
|
|
|
root.pdfjsWebPDFFindController, root.pdfjsWebPDFFindBar, |
|
|
|
|
|
|
|
root.pdfjsWebDOMEvents, root.pdfjsWebPDFJS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}(this, function (exports, uiUtilsLib, downloadManagerLib, pdfHistoryLib, |
|
|
|
|
|
|
|
preferencesLib, pdfSidebarLib, viewHistoryLib, |
|
|
|
|
|
|
|
pdfThumbnailViewerLib, toolbarLib, secondaryToolbarLib, |
|
|
|
|
|
|
|
passwordPromptLib, pdfPresentationModeLib, |
|
|
|
|
|
|
|
pdfDocumentPropertiesLib, handToolLib, pdfViewerLib, |
|
|
|
|
|
|
|
pdfRenderingQueueLib, pdfLinkServiceLib, pdfOutlineViewerLib, |
|
|
|
|
|
|
|
overlayManagerLib, pdfAttachmentViewerLib, |
|
|
|
|
|
|
|
pdfFindControllerLib, pdfFindBarLib, domEventsLib, pdfjsLib) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var UNKNOWN_SCALE = uiUtilsLib.UNKNOWN_SCALE; |
|
|
|
|
|
|
|
var DEFAULT_SCALE_VALUE = uiUtilsLib.DEFAULT_SCALE_VALUE; |
|
|
|
|
|
|
|
var MIN_SCALE = uiUtilsLib.MIN_SCALE; |
|
|
|
|
|
|
|
var MAX_SCALE = uiUtilsLib.MAX_SCALE; |
|
|
|
|
|
|
|
var ProgressBar = uiUtilsLib.ProgressBar; |
|
|
|
|
|
|
|
var getPDFFileNameFromURL = uiUtilsLib.getPDFFileNameFromURL; |
|
|
|
|
|
|
|
var noContextMenuHandler = uiUtilsLib.noContextMenuHandler; |
|
|
|
|
|
|
|
var mozL10n = uiUtilsLib.mozL10n; |
|
|
|
|
|
|
|
var parseQueryString = uiUtilsLib.parseQueryString; |
|
|
|
|
|
|
|
var PDFHistory = pdfHistoryLib.PDFHistory; |
|
|
|
|
|
|
|
var Preferences = preferencesLib.Preferences; |
|
|
|
|
|
|
|
var SidebarView = pdfSidebarLib.SidebarView; |
|
|
|
|
|
|
|
var PDFSidebar = pdfSidebarLib.PDFSidebar; |
|
|
|
|
|
|
|
var ViewHistory = viewHistoryLib.ViewHistory; |
|
|
|
|
|
|
|
var PDFThumbnailViewer = pdfThumbnailViewerLib.PDFThumbnailViewer; |
|
|
|
|
|
|
|
var Toolbar = toolbarLib.Toolbar; |
|
|
|
|
|
|
|
var SecondaryToolbar = secondaryToolbarLib.SecondaryToolbar; |
|
|
|
|
|
|
|
var PasswordPrompt = passwordPromptLib.PasswordPrompt; |
|
|
|
|
|
|
|
var PDFPresentationMode = pdfPresentationModeLib.PDFPresentationMode; |
|
|
|
|
|
|
|
var PDFDocumentProperties = pdfDocumentPropertiesLib.PDFDocumentProperties; |
|
|
|
|
|
|
|
var HandTool = handToolLib.HandTool; |
|
|
|
|
|
|
|
var PresentationModeState = pdfViewerLib.PresentationModeState; |
|
|
|
|
|
|
|
var PDFViewer = pdfViewerLib.PDFViewer; |
|
|
|
|
|
|
|
var RenderingStates = pdfRenderingQueueLib.RenderingStates; |
|
|
|
|
|
|
|
var PDFRenderingQueue = pdfRenderingQueueLib.PDFRenderingQueue; |
|
|
|
|
|
|
|
var PDFLinkService = pdfLinkServiceLib.PDFLinkService; |
|
|
|
|
|
|
|
var PDFOutlineViewer = pdfOutlineViewerLib.PDFOutlineViewer; |
|
|
|
|
|
|
|
var OverlayManager = overlayManagerLib.OverlayManager; |
|
|
|
|
|
|
|
var PDFAttachmentViewer = pdfAttachmentViewerLib.PDFAttachmentViewer; |
|
|
|
|
|
|
|
var PDFFindController = pdfFindControllerLib.PDFFindController; |
|
|
|
|
|
|
|
var PDFFindBar = pdfFindBarLib.PDFFindBar; |
|
|
|
|
|
|
|
var getGlobalEventBus = domEventsLib.getGlobalEventBus; |
|
|
|
|
|
|
|
var normalizeWheelEventDelta = uiUtilsLib.normalizeWheelEventDelta; |
|
|
|
|
|
|
|
var animationStarted = uiUtilsLib.animationStarted; |
|
|
|
|
|
|
|
var localized = uiUtilsLib.localized; |
|
|
|
|
|
|
|
var RendererType = uiUtilsLib.RendererType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DEFAULT_SCALE_DELTA = 1.1; |
|
|
|
var DEFAULT_SCALE_DELTA = 1.1; |
|
|
|
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; |
|
|
|
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; |
|
|
@ -124,13 +67,13 @@ function configure(PDFJS) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var DefaultExernalServices = { |
|
|
|
var DefaultExternalServices = { |
|
|
|
updateFindControlState: function (data) {}, |
|
|
|
updateFindControlState: function (data) {}, |
|
|
|
initPassiveLoading: function (callbacks) {}, |
|
|
|
initPassiveLoading: function (callbacks) {}, |
|
|
|
fallback: function (data, callback) {}, |
|
|
|
fallback: function (data, callback) {}, |
|
|
|
reportTelemetry: function (data) {}, |
|
|
|
reportTelemetry: function (data) {}, |
|
|
|
createDownloadManager: function () { |
|
|
|
createDownloadManager: function () { |
|
|
|
return new downloadManagerLib.DownloadManager(); |
|
|
|
throw new Error('Not implemented: createDownloadManager'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
supportsIntegratedFind: false, |
|
|
|
supportsIntegratedFind: false, |
|
|
|
supportsDocumentFonts: true, |
|
|
|
supportsDocumentFonts: true, |
|
|
@ -196,12 +139,11 @@ var PDFViewerApplication = { |
|
|
|
isViewerEmbedded: (window.parent !== window), |
|
|
|
isViewerEmbedded: (window.parent !== window), |
|
|
|
url: '', |
|
|
|
url: '', |
|
|
|
baseUrl: '', |
|
|
|
baseUrl: '', |
|
|
|
externalServices: DefaultExernalServices, |
|
|
|
externalServices: DefaultExternalServices, |
|
|
|
|
|
|
|
|
|
|
|
// called once when the document is loaded
|
|
|
|
// called once when the document is loaded
|
|
|
|
initialize: function pdfViewInitialize(appConfig) { |
|
|
|
initialize: function pdfViewInitialize(appConfig) { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
var PDFJS = pdfjsLib.PDFJS; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Preferences.initialize(); |
|
|
|
Preferences.initialize(); |
|
|
|
this.preferences = Preferences; |
|
|
|
this.preferences = Preferences; |
|
|
@ -240,7 +182,6 @@ var PDFViewerApplication = { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
_readPreferences: function () { |
|
|
|
_readPreferences: function () { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
var PDFJS = pdfjsLib.PDFJS; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Promise.all([ |
|
|
|
return Promise.all([ |
|
|
|
Preferences.get('enableWebGL').then(function resolved(value) { |
|
|
|
Preferences.get('enableWebGL').then(function resolved(value) { |
|
|
@ -506,11 +447,11 @@ var PDFViewerApplication = { |
|
|
|
support = false; |
|
|
|
support = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (support && pdfjsLib.PDFJS.disableFullscreen === true) { |
|
|
|
if (support && PDFJS.disableFullscreen === true) { |
|
|
|
support = false; |
|
|
|
support = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return pdfjsLib.shadow(this, 'supportsFullscreen', support); |
|
|
|
return shadow(this, 'supportsFullscreen', support); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
get supportsIntegratedFind() { |
|
|
|
get supportsIntegratedFind() { |
|
|
@ -528,7 +469,7 @@ var PDFViewerApplication = { |
|
|
|
get loadingBar() { |
|
|
|
get loadingBar() { |
|
|
|
var bar = new ProgressBar('#loadingBar', {}); |
|
|
|
var bar = new ProgressBar('#loadingBar', {}); |
|
|
|
|
|
|
|
|
|
|
|
return pdfjsLib.shadow(this, 'loadingBar', bar); |
|
|
|
return shadow(this, 'loadingBar', bar); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
get supportedMouseWheelZoomModifierKeys() { |
|
|
|
get supportedMouseWheelZoomModifierKeys() { |
|
|
@ -578,7 +519,7 @@ var PDFViewerApplication = { |
|
|
|
var title = getPDFFileNameFromURL(url, ''); |
|
|
|
var title = getPDFFileNameFromURL(url, ''); |
|
|
|
if (!title) { |
|
|
|
if (!title) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
title = decodeURIComponent(pdfjsLib.getFilenameFromUrl(url)) || url; |
|
|
|
title = decodeURIComponent(getFilenameFromUrl(url)) || url; |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
// decodeURIComponent may throw URIError,
|
|
|
|
// decodeURIComponent may throw URIError,
|
|
|
|
// fall back to using the unprocessed url in that case
|
|
|
|
// fall back to using the unprocessed url in that case
|
|
|
@ -693,7 +634,7 @@ var PDFViewerApplication = { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
self.downloadComplete = false; |
|
|
|
self.downloadComplete = false; |
|
|
|
|
|
|
|
|
|
|
|
var loadingTask = pdfjsLib.getDocument(parameters); |
|
|
|
var loadingTask = getDocument(parameters); |
|
|
|
this.pdfLoadingTask = loadingTask; |
|
|
|
this.pdfLoadingTask = loadingTask; |
|
|
|
|
|
|
|
|
|
|
|
loadingTask.onPassword = function passwordNeeded(updateCallback, reason) { |
|
|
|
loadingTask.onPassword = function passwordNeeded(updateCallback, reason) { |
|
|
@ -717,15 +658,15 @@ var PDFViewerApplication = { |
|
|
|
var loadingErrorMessage = mozL10n.get('loading_error', null, |
|
|
|
var loadingErrorMessage = mozL10n.get('loading_error', null, |
|
|
|
'An error occurred while loading the PDF.'); |
|
|
|
'An error occurred while loading the PDF.'); |
|
|
|
|
|
|
|
|
|
|
|
if (exception instanceof pdfjsLib.InvalidPDFException) { |
|
|
|
if (exception instanceof InvalidPDFException) { |
|
|
|
// change error message also for other builds
|
|
|
|
// change error message also for other builds
|
|
|
|
loadingErrorMessage = mozL10n.get('invalid_file_error', null, |
|
|
|
loadingErrorMessage = mozL10n.get('invalid_file_error', null, |
|
|
|
'Invalid or corrupted PDF file.'); |
|
|
|
'Invalid or corrupted PDF file.'); |
|
|
|
} else if (exception instanceof pdfjsLib.MissingPDFException) { |
|
|
|
} else if (exception instanceof MissingPDFException) { |
|
|
|
// special message for missing PDF's
|
|
|
|
// special message for missing PDF's
|
|
|
|
loadingErrorMessage = mozL10n.get('missing_file_error', null, |
|
|
|
loadingErrorMessage = mozL10n.get('missing_file_error', null, |
|
|
|
'Missing PDF file.'); |
|
|
|
'Missing PDF file.'); |
|
|
|
} else if (exception instanceof pdfjsLib.UnexpectedResponseException) { |
|
|
|
} else if (exception instanceof UnexpectedResponseException) { |
|
|
|
loadingErrorMessage = mozL10n.get('unexpected_response_error', null, |
|
|
|
loadingErrorMessage = mozL10n.get('unexpected_response_error', null, |
|
|
|
'Unexpected server response.'); |
|
|
|
'Unexpected server response.'); |
|
|
|
} |
|
|
|
} |
|
|
@ -768,7 +709,7 @@ var PDFViewerApplication = { |
|
|
|
|
|
|
|
|
|
|
|
this.pdfDocument.getData().then( |
|
|
|
this.pdfDocument.getData().then( |
|
|
|
function getDataSuccess(data) { |
|
|
|
function getDataSuccess(data) { |
|
|
|
var blob = pdfjsLib.createBlob(data, 'application/pdf'); |
|
|
|
var blob = createBlob(data, 'application/pdf'); |
|
|
|
downloadManager.download(blob, url, filename); |
|
|
|
downloadManager.download(blob, url, filename); |
|
|
|
}, |
|
|
|
}, |
|
|
|
downloadByUrl // Error occurred try downloading with just the url.
|
|
|
|
downloadByUrl // Error occurred try downloading with just the url.
|
|
|
@ -805,7 +746,7 @@ var PDFViewerApplication = { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
error: function pdfViewError(message, moreInfo) { |
|
|
|
error: function pdfViewError(message, moreInfo) { |
|
|
|
var moreInfoText = mozL10n.get('error_version_info', |
|
|
|
var moreInfoText = mozL10n.get('error_version_info', |
|
|
|
{version: pdfjsLib.version || '?', build: pdfjsLib.build || '?'}, |
|
|
|
{version: version || '?', build: build || '?'}, |
|
|
|
'PDF.js v{{version}} (build: {{build}})') + '\n'; |
|
|
|
'PDF.js v{{version}} (build: {{build}})') + '\n'; |
|
|
|
if (moreInfo) { |
|
|
|
if (moreInfo) { |
|
|
|
moreInfoText += |
|
|
|
moreInfoText += |
|
|
@ -883,7 +824,7 @@ var PDFViewerApplication = { |
|
|
|
// the loading bar will not be completely filled, nor will it be hidden.
|
|
|
|
// the loading bar will not be completely filled, nor will it be hidden.
|
|
|
|
// To prevent displaying a partially filled loading bar permanently, we
|
|
|
|
// To prevent displaying a partially filled loading bar permanently, we
|
|
|
|
// hide it when no data has been loaded during a certain amount of time.
|
|
|
|
// hide it when no data has been loaded during a certain amount of time.
|
|
|
|
if (pdfjsLib.PDFJS.disableAutoFetch && percent) { |
|
|
|
if (PDFJS.disableAutoFetch && percent) { |
|
|
|
if (this.disableAutoFetchLoadingBarTimeout) { |
|
|
|
if (this.disableAutoFetchLoadingBarTimeout) { |
|
|
|
clearTimeout(this.disableAutoFetchLoadingBarTimeout); |
|
|
|
clearTimeout(this.disableAutoFetchLoadingBarTimeout); |
|
|
|
this.disableAutoFetchLoadingBarTimeout = null; |
|
|
|
this.disableAutoFetchLoadingBarTimeout = null; |
|
|
@ -946,7 +887,7 @@ var PDFViewerApplication = { |
|
|
|
|
|
|
|
|
|
|
|
self.loadingBar.setWidth(self.appConfig.viewerContainer); |
|
|
|
self.loadingBar.setWidth(self.appConfig.viewerContainer); |
|
|
|
|
|
|
|
|
|
|
|
if (!pdfjsLib.PDFJS.disableHistory && !self.isViewerEmbedded) { |
|
|
|
if (!PDFJS.disableHistory && !self.isViewerEmbedded) { |
|
|
|
// The browsing history is only enabled when the viewer is standalone,
|
|
|
|
// The browsing history is only enabled when the viewer is standalone,
|
|
|
|
// i.e. not when it is embedded in a web page.
|
|
|
|
// i.e. not when it is embedded in a web page.
|
|
|
|
if (!self.viewerPrefs['showPreviousViewOnLoad']) { |
|
|
|
if (!self.viewerPrefs['showPreviousViewOnLoad']) { |
|
|
@ -1050,7 +991,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'); |
|
|
|
self.fallback(pdfjsLib.UNSUPPORTED_FEATURES.javaScript); |
|
|
|
self.fallback(UNSUPPORTED_FEATURES.javaScript); |
|
|
|
} |
|
|
|
} |
|
|
|
// Hack to support auto printing.
|
|
|
|
// Hack to support auto printing.
|
|
|
|
var regex = /\bprint\s*\(/; |
|
|
|
var regex = /\bprint\s*\(/; |
|
|
@ -1085,8 +1026,8 @@ var PDFViewerApplication = { |
|
|
|
console.log('PDF ' + pdfDocument.fingerprint + ' [' + |
|
|
|
console.log('PDF ' + pdfDocument.fingerprint + ' [' + |
|
|
|
info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + |
|
|
|
info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + |
|
|
|
' / ' + (info.Creator || '-').trim() + ']' + |
|
|
|
' / ' + (info.Creator || '-').trim() + ']' + |
|
|
|
' (PDF.js: ' + (pdfjsLib.version || '-') + |
|
|
|
' (PDF.js: ' + (version || '-') + |
|
|
|
(!pdfjsLib.PDFJS.disableWebGL ? ' [WebGL]' : '') + ')'); |
|
|
|
(!PDFJS.disableWebGL ? ' [WebGL]' : '') + ')'); |
|
|
|
|
|
|
|
|
|
|
|
var pdfTitle; |
|
|
|
var pdfTitle; |
|
|
|
if (metadata && metadata.has('dc:title')) { |
|
|
|
if (metadata && metadata.has('dc:title')) { |
|
|
@ -1107,7 +1048,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'); |
|
|
|
self.fallback(pdfjsLib.UNSUPPORTED_FEATURES.forms); |
|
|
|
self.fallback(UNSUPPORTED_FEATURES.forms); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (typeof PDFJSDev !== 'undefined' && |
|
|
|
if (typeof PDFJSDev !== 'undefined' && |
|
|
@ -1390,7 +1331,10 @@ function loadAndEnablePDFBug(enabledTabs) { |
|
|
|
script.src = appConfig.debuggerScriptPath; |
|
|
|
script.src = appConfig.debuggerScriptPath; |
|
|
|
script.onload = function () { |
|
|
|
script.onload = function () { |
|
|
|
PDFBug.enable(enabledTabs); |
|
|
|
PDFBug.enable(enabledTabs); |
|
|
|
PDFBug.init(pdfjsLib, appConfig.mainContainer); |
|
|
|
PDFBug.init({ |
|
|
|
|
|
|
|
PDFJS, |
|
|
|
|
|
|
|
OPS, |
|
|
|
|
|
|
|
}, appConfig.mainContainer); |
|
|
|
resolve(); |
|
|
|
resolve(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
script.onerror = function () { |
|
|
|
script.onerror = function () { |
|
|
@ -1436,8 +1380,6 @@ function webViewerInitialized() { |
|
|
|
appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true'); |
|
|
|
appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var PDFJS = pdfjsLib.PDFJS; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) || |
|
|
|
if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) || |
|
|
|
PDFViewerApplication.viewerPrefs['pdfBugEnabled']) { |
|
|
|
PDFViewerApplication.viewerPrefs['pdfBugEnabled']) { |
|
|
|
// Special debugging flags in the hash section of the URL.
|
|
|
|
// Special debugging flags in the hash section of the URL.
|
|
|
@ -1616,7 +1558,7 @@ function webViewerPageRendered(e) { |
|
|
|
thumbnailView.setImage(pageView); |
|
|
|
thumbnailView.setImage(pageView); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (pdfjsLib.PDFJS.pdfBug && Stats.enabled && pageView.stats) { |
|
|
|
if (PDFJS.pdfBug && Stats.enabled && pageView.stats) { |
|
|
|
Stats.add(pageNumber, pageView.stats); |
|
|
|
Stats.add(pageNumber, pageView.stats); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1781,7 +1723,7 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) { |
|
|
|
webViewerFileInputChange = function webViewerFileInputChange(e) { |
|
|
|
webViewerFileInputChange = function webViewerFileInputChange(e) { |
|
|
|
var file = e.fileInput.files[0]; |
|
|
|
var file = e.fileInput.files[0]; |
|
|
|
|
|
|
|
|
|
|
|
if (!pdfjsLib.PDFJS.disableCreateObjectURL && |
|
|
|
if (!PDFJS.disableCreateObjectURL && |
|
|
|
typeof URL !== 'undefined' && URL.createObjectURL) { |
|
|
|
typeof URL !== 'undefined' && URL.createObjectURL) { |
|
|
|
PDFViewerApplication.open(URL.createObjectURL(file)); |
|
|
|
PDFViewerApplication.open(URL.createObjectURL(file)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1904,7 +1846,7 @@ function webViewerPageChanging(e) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// we need to update stats
|
|
|
|
// we need to update stats
|
|
|
|
if (pdfjsLib.PDFJS.pdfBug && Stats.enabled) { |
|
|
|
if (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); |
|
|
@ -2269,7 +2211,8 @@ var PDFPrintServiceFactory = { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
exports.PDFViewerApplication = PDFViewerApplication; |
|
|
|
export { |
|
|
|
exports.DefaultExernalServices = DefaultExernalServices; |
|
|
|
PDFViewerApplication, |
|
|
|
exports.PDFPrintServiceFactory = PDFPrintServiceFactory; |
|
|
|
DefaultExternalServices, |
|
|
|
})); |
|
|
|
PDFPrintServiceFactory, |
|
|
|
|
|
|
|
}; |
|
|
|