From c3bc05bef2acce5b190bbd02e0f01dd64b834f81 Mon Sep 17 00:00:00 2001 From: Pdf Bot Date: Wed, 24 Feb 2016 12:19:45 +0000 Subject: [PATCH] PDF.js version 1.4.91 - See mozilla/pdf.js@41efb92d3a6af0be38afaf27808504e404491afd --- bower.json | 2 +- build/pdf.combined.js | 126 +++++++++++++++++++++++++++++++++++++++++- build/pdf.js | 95 ++++++++++++++++++++++++++++++- build/pdf.worker.js | 47 +++++++++++++++- package.json | 2 +- web/pdf_viewer.css | 3 +- web/pdf_viewer.js | 108 +++++++++++++++++++++++++++++++----- 7 files changed, 359 insertions(+), 24 deletions(-) diff --git a/bower.json b/bower.json index ab51cadaf..6db58a146 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.4.87", + "version": "1.4.91", "main": [ "build/pdf.js", "build/pdf.worker.js" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index 5b45e437f..f808111a8 100644 --- a/build/pdf.combined.js +++ b/build/pdf.combined.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.4.87'; -var pdfjsBuild = 'c53581f'; +var pdfjsVersion = '1.4.91'; +var pdfjsBuild = '41efb92'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -2692,6 +2692,17 @@ var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { font: 'font' }; +// Gets the file name from a given URL. +function getFilenameFromUrl(url) { + var anchor = url.indexOf('#'); + var query = url.indexOf('?'); + var end = Math.min( + anchor > 0 ? anchor : url.length, + query > 0 ? query : url.length); + return url.substring(url.lastIndexOf('/', end) + 1, end); +} +PDFJS.getFilenameFromUrl = getFilenameFromUrl; + // Combines two URLs. The baseUrl shall be absolute URL. If the url is an // absolute URL, it will be returned as is. function combineUrl(baseUrl, url) { @@ -4763,6 +4774,7 @@ exports.combineUrl = combineUrl; exports.createPromiseCapability = createPromiseCapability; exports.deprecated = deprecated; exports.error = error; +exports.getFilenameFromUrl = getFilenameFromUrl; exports.getLookupTableFactory = getLookupTableFactory; exports.info = info; exports.isArray = isArray; @@ -18412,6 +18424,7 @@ var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType; var AnnotationType = sharedUtil.AnnotationType; var Util = sharedUtil.Util; var addLinkAttributes = sharedUtil.addLinkAttributes; +var getFilenameFromUrl = sharedUtil.getFilenameFromUrl; var warn = sharedUtil.warn; var CustomStyle = displayDOMUtils.CustomStyle; @@ -18422,6 +18435,7 @@ var CustomStyle = displayDOMUtils.CustomStyle; * @property {PDFPage} page * @property {PageViewport} viewport * @property {IPDFLinkService} linkService + * @property {DownloadManager} downloadManager */ /** @@ -18463,6 +18477,9 @@ AnnotationElementFactory.prototype = case AnnotationType.STRIKEOUT: return new StrikeOutAnnotationElement(parameters); + case AnnotationType.FILEATTACHMENT: + return new FileAttachmentAnnotationElement(parameters); + default: return new AnnotationElement(parameters); } @@ -18481,6 +18498,7 @@ var AnnotationElement = (function AnnotationElementClosure() { this.page = parameters.page; this.viewport = parameters.viewport; this.linkService = parameters.linkService; + this.downloadManager = parameters.downloadManager; if (isRenderable) { this.container = this._createContainer(); @@ -19101,6 +19119,76 @@ var StrikeOutAnnotationElement = ( return StrikeOutAnnotationElement; })(); +/** + * @class + * @alias FileAttachmentAnnotationElement + */ +var FileAttachmentAnnotationElement = ( + function FileAttachmentAnnotationElementClosure() { + function FileAttachmentAnnotationElement(parameters) { + AnnotationElement.call(this, parameters, true); + + this.filename = getFilenameFromUrl(parameters.data.file.filename); + this.content = parameters.data.file.content; + } + + Util.inherit(FileAttachmentAnnotationElement, AnnotationElement, { + /** + * Render the file attachment annotation's HTML element in the empty + * container. + * + * @public + * @memberof FileAttachmentAnnotationElement + * @returns {HTMLSectionElement} + */ + render: function FileAttachmentAnnotationElement_render() { + this.container.className = 'fileAttachmentAnnotation'; + + var trigger = document.createElement('div'); + trigger.style.height = this.container.style.height; + trigger.style.width = this.container.style.width; + trigger.addEventListener('dblclick', this._download.bind(this)); + + if (!this.data.hasPopup && (this.data.title || this.data.contents)) { + var popupElement = new PopupElement({ + container: this.container, + trigger: trigger, + color: this.data.color, + title: this.data.title, + contents: this.data.contents, + hideWrapper: true + }); + var popup = popupElement.render(); + + // Position the popup next to the FileAttachment annotation's + // container. + popup.style.left = this.container.style.width; + + this.container.appendChild(popup); + } + + this.container.appendChild(trigger); + return this.container; + }, + + /** + * Download the file attachment associated with this annotation. + * + * @private + * @memberof FileAttachmentAnnotationElement + */ + _download: function FileAttachmentAnnotationElement_download() { + if (!this.downloadManager) { + warn('Download cannot be started due to unavailable download manager'); + return; + } + this.downloadManager.downloadData(this.content, this.filename, ''); + } + }); + + return FileAttachmentAnnotationElement; +})(); + /** * @typedef {Object} AnnotationLayerParameters * @property {PageViewport} viewport @@ -19137,7 +19225,8 @@ var AnnotationLayer = (function AnnotationLayerClosure() { layer: parameters.div, page: parameters.page, viewport: parameters.viewport, - linkService: parameters.linkService + linkService: parameters.linkService, + downloadManager: parameters.downloadManager }; var element = annotationElementFactory.create(properties); if (element.isRenderable) { @@ -44052,6 +44141,7 @@ var ObjectLoader = (function() { exports.Catalog = Catalog; exports.ObjectLoader = ObjectLoader; exports.XRef = XRef; +exports.FileSpec = FileSpec; })); @@ -47862,6 +47952,7 @@ var isName = corePrimitives.isName; var Stream = coreStream.Stream; var ColorSpace = coreColorSpace.ColorSpace; var ObjectLoader = coreObj.ObjectLoader; +var FileSpec = coreObj.FileSpec; var OperatorList = coreEvaluator.OperatorList; /** @@ -47887,6 +47978,7 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ { // Return the right annotation object based on the subtype and field type. var parameters = { + xref: xref, dict: dict, ref: ref }; @@ -47920,6 +48012,9 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ { case 'StrikeOut': return new StrikeOutAnnotation(parameters); + case 'FileAttachment': + return new FileAttachmentAnnotation(parameters); + default: warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation'); @@ -48664,6 +48759,31 @@ var StrikeOutAnnotation = (function StrikeOutAnnotationClosure() { return StrikeOutAnnotation; })(); +var FileAttachmentAnnotation = (function FileAttachmentAnnotationClosure() { + function FileAttachmentAnnotation(parameters) { + Annotation.call(this, parameters); + + var dict = parameters.dict; + var file = new FileSpec(dict.get('FS'), parameters.xref); + + this.data.annotationType = AnnotationType.FILEATTACHMENT; + this.data.file = file.serializable; + + if (!dict.has('C')) { + // Fall back to the default background color. + this.data.color = null; + } + + this.data.hasPopup = dict.has('Popup'); + this.data.title = stringToPDFString(dict.get('T') || ''); + this.data.contents = stringToPDFString(dict.get('Contents') || ''); + } + + Util.inherit(FileAttachmentAnnotation, Annotation, {}); + + return FileAttachmentAnnotation; +})(); + exports.Annotation = Annotation; exports.AnnotationBorderStyle = AnnotationBorderStyle; exports.AnnotationFactory = AnnotationFactory; diff --git a/build/pdf.js b/build/pdf.js index f853d759e..d015e7043 100644 --- a/build/pdf.js +++ b/build/pdf.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.4.87'; -var pdfjsBuild = 'c53581f'; +var pdfjsVersion = '1.4.91'; +var pdfjsBuild = '41efb92'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -407,6 +407,17 @@ var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { font: 'font' }; +// Gets the file name from a given URL. +function getFilenameFromUrl(url) { + var anchor = url.indexOf('#'); + var query = url.indexOf('?'); + var end = Math.min( + anchor > 0 ? anchor : url.length, + query > 0 ? query : url.length); + return url.substring(url.lastIndexOf('/', end) + 1, end); +} +PDFJS.getFilenameFromUrl = getFilenameFromUrl; + // Combines two URLs. The baseUrl shall be absolute URL. If the url is an // absolute URL, it will be returned as is. function combineUrl(baseUrl, url) { @@ -2478,6 +2489,7 @@ exports.combineUrl = combineUrl; exports.createPromiseCapability = createPromiseCapability; exports.deprecated = deprecated; exports.error = error; +exports.getFilenameFromUrl = getFilenameFromUrl; exports.getLookupTableFactory = getLookupTableFactory; exports.info = info; exports.isArray = isArray; @@ -2518,6 +2530,7 @@ var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType; var AnnotationType = sharedUtil.AnnotationType; var Util = sharedUtil.Util; var addLinkAttributes = sharedUtil.addLinkAttributes; +var getFilenameFromUrl = sharedUtil.getFilenameFromUrl; var warn = sharedUtil.warn; var CustomStyle = displayDOMUtils.CustomStyle; @@ -2528,6 +2541,7 @@ var CustomStyle = displayDOMUtils.CustomStyle; * @property {PDFPage} page * @property {PageViewport} viewport * @property {IPDFLinkService} linkService + * @property {DownloadManager} downloadManager */ /** @@ -2569,6 +2583,9 @@ AnnotationElementFactory.prototype = case AnnotationType.STRIKEOUT: return new StrikeOutAnnotationElement(parameters); + case AnnotationType.FILEATTACHMENT: + return new FileAttachmentAnnotationElement(parameters); + default: return new AnnotationElement(parameters); } @@ -2587,6 +2604,7 @@ var AnnotationElement = (function AnnotationElementClosure() { this.page = parameters.page; this.viewport = parameters.viewport; this.linkService = parameters.linkService; + this.downloadManager = parameters.downloadManager; if (isRenderable) { this.container = this._createContainer(); @@ -3207,6 +3225,76 @@ var StrikeOutAnnotationElement = ( return StrikeOutAnnotationElement; })(); +/** + * @class + * @alias FileAttachmentAnnotationElement + */ +var FileAttachmentAnnotationElement = ( + function FileAttachmentAnnotationElementClosure() { + function FileAttachmentAnnotationElement(parameters) { + AnnotationElement.call(this, parameters, true); + + this.filename = getFilenameFromUrl(parameters.data.file.filename); + this.content = parameters.data.file.content; + } + + Util.inherit(FileAttachmentAnnotationElement, AnnotationElement, { + /** + * Render the file attachment annotation's HTML element in the empty + * container. + * + * @public + * @memberof FileAttachmentAnnotationElement + * @returns {HTMLSectionElement} + */ + render: function FileAttachmentAnnotationElement_render() { + this.container.className = 'fileAttachmentAnnotation'; + + var trigger = document.createElement('div'); + trigger.style.height = this.container.style.height; + trigger.style.width = this.container.style.width; + trigger.addEventListener('dblclick', this._download.bind(this)); + + if (!this.data.hasPopup && (this.data.title || this.data.contents)) { + var popupElement = new PopupElement({ + container: this.container, + trigger: trigger, + color: this.data.color, + title: this.data.title, + contents: this.data.contents, + hideWrapper: true + }); + var popup = popupElement.render(); + + // Position the popup next to the FileAttachment annotation's + // container. + popup.style.left = this.container.style.width; + + this.container.appendChild(popup); + } + + this.container.appendChild(trigger); + return this.container; + }, + + /** + * Download the file attachment associated with this annotation. + * + * @private + * @memberof FileAttachmentAnnotationElement + */ + _download: function FileAttachmentAnnotationElement_download() { + if (!this.downloadManager) { + warn('Download cannot be started due to unavailable download manager'); + return; + } + this.downloadManager.downloadData(this.content, this.filename, ''); + } + }); + + return FileAttachmentAnnotationElement; +})(); + /** * @typedef {Object} AnnotationLayerParameters * @property {PageViewport} viewport @@ -3243,7 +3331,8 @@ var AnnotationLayer = (function AnnotationLayerClosure() { layer: parameters.div, page: parameters.page, viewport: parameters.viewport, - linkService: parameters.linkService + linkService: parameters.linkService, + downloadManager: parameters.downloadManager }; var element = annotationElementFactory.create(properties); if (element.isRenderable) { diff --git a/build/pdf.worker.js b/build/pdf.worker.js index fcf7c4fde..89613e0a2 100644 --- a/build/pdf.worker.js +++ b/build/pdf.worker.js @@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {})); // Use strict in our context only - users might not want it 'use strict'; -var pdfjsVersion = '1.4.87'; -var pdfjsBuild = 'c53581f'; +var pdfjsVersion = '1.4.91'; +var pdfjsBuild = '41efb92'; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? @@ -2624,6 +2624,17 @@ var UNSUPPORTED_FEATURES = PDFJS.UNSUPPORTED_FEATURES = { font: 'font' }; +// Gets the file name from a given URL. +function getFilenameFromUrl(url) { + var anchor = url.indexOf('#'); + var query = url.indexOf('?'); + var end = Math.min( + anchor > 0 ? anchor : url.length, + query > 0 ? query : url.length); + return url.substring(url.lastIndexOf('/', end) + 1, end); +} +PDFJS.getFilenameFromUrl = getFilenameFromUrl; + // Combines two URLs. The baseUrl shall be absolute URL. If the url is an // absolute URL, it will be returned as is. function combineUrl(baseUrl, url) { @@ -4695,6 +4706,7 @@ exports.combineUrl = combineUrl; exports.createPromiseCapability = createPromiseCapability; exports.deprecated = deprecated; exports.error = error; +exports.getFilenameFromUrl = getFilenameFromUrl; exports.getLookupTableFactory = getLookupTableFactory; exports.info = info; exports.isArray = isArray; @@ -36187,6 +36199,7 @@ var ObjectLoader = (function() { exports.Catalog = Catalog; exports.ObjectLoader = ObjectLoader; exports.XRef = XRef; +exports.FileSpec = FileSpec; })); @@ -39997,6 +40010,7 @@ var isName = corePrimitives.isName; var Stream = coreStream.Stream; var ColorSpace = coreColorSpace.ColorSpace; var ObjectLoader = coreObj.ObjectLoader; +var FileSpec = coreObj.FileSpec; var OperatorList = coreEvaluator.OperatorList; /** @@ -40022,6 +40036,7 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ { // Return the right annotation object based on the subtype and field type. var parameters = { + xref: xref, dict: dict, ref: ref }; @@ -40055,6 +40070,9 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ { case 'StrikeOut': return new StrikeOutAnnotation(parameters); + case 'FileAttachment': + return new FileAttachmentAnnotation(parameters); + default: warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation'); @@ -40799,6 +40817,31 @@ var StrikeOutAnnotation = (function StrikeOutAnnotationClosure() { return StrikeOutAnnotation; })(); +var FileAttachmentAnnotation = (function FileAttachmentAnnotationClosure() { + function FileAttachmentAnnotation(parameters) { + Annotation.call(this, parameters); + + var dict = parameters.dict; + var file = new FileSpec(dict.get('FS'), parameters.xref); + + this.data.annotationType = AnnotationType.FILEATTACHMENT; + this.data.file = file.serializable; + + if (!dict.has('C')) { + // Fall back to the default background color. + this.data.color = null; + } + + this.data.hasPopup = dict.has('Popup'); + this.data.title = stringToPDFString(dict.get('T') || ''); + this.data.contents = stringToPDFString(dict.get('Contents') || ''); + } + + Util.inherit(FileAttachmentAnnotation, Annotation, {}); + + return FileAttachmentAnnotation; +})(); + exports.Annotation = Annotation; exports.AnnotationBorderStyle = AnnotationBorderStyle; exports.AnnotationFactory = AnnotationFactory; diff --git a/package.json b/package.json index e06e65b54..f7e72d4b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pdfjs-dist", - "version": "1.4.87", + "version": "1.4.91", "main": "build/pdf.js", "description": "Generic build of Mozilla's PDF.js library.", "keywords": [ diff --git a/web/pdf_viewer.css b/web/pdf_viewer.css index 1d005b76e..66f73cf29 100644 --- a/web/pdf_viewer.css +++ b/web/pdf_viewer.css @@ -141,7 +141,8 @@ .annotationLayer .highlightAnnotation, .annotationLayer .underlineAnnotation, .annotationLayer .squigglyAnnotation, -.annotationLayer .strikeoutAnnotation { +.annotationLayer .strikeoutAnnotation, +.annotationLayer .fileAttachmentAnnotation { cursor: pointer; } diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 73516708c..9cfaccb73 100644 --- a/web/pdf_viewer.js +++ b/web/pdf_viewer.js @@ -15,7 +15,7 @@ /*jshint globalstrict: false */ /* globals PDFJS, PDFViewer, PDFPageView, TextLayerBuilder, PDFLinkService, DefaultTextLayerFactory, AnnotationLayerBuilder, PDFHistory, - DefaultAnnotationLayerFactory, getFileName, ProgressBar */ + DefaultAnnotationLayerFactory, DownloadManager, ProgressBar */ // Initializing PDFJS global object (if still undefined) if (typeof PDFJS === 'undefined') { @@ -34,15 +34,6 @@ var MAX_AUTO_SCALE = 1.25; var SCROLLBAR_PADDING = 40; var VERTICAL_PADDING = 5; -function getFileName(url) { - var anchor = url.indexOf('#'); - var query = url.indexOf('?'); - var end = Math.min( - anchor > 0 ? anchor : url.length, - query > 0 ? query : url.length); - return url.substring(url.lastIndexOf('/', end) + 1, end); -} - /** * Returns scale factor for the canvas. It makes sense for the HiDPI displays. * @return {Object} The object with horizontal (sx) and vertical (sy) @@ -1765,6 +1756,7 @@ DefaultTextLayerFactory.prototype = { * @property {HTMLDivElement} pageDiv * @property {PDFPage} pdfPage * @property {IPDFLinkService} linkService + * @property {DownloadManager} downloadManager */ /** @@ -1779,6 +1771,7 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() { this.pageDiv = options.pageDiv; this.pdfPage = options.pdfPage; this.linkService = options.linkService; + this.downloadManager = options.downloadManager; this.div = null; } @@ -1803,7 +1796,8 @@ var AnnotationLayerBuilder = (function AnnotationLayerBuilderClosure() { div: self.div, annotations: annotations, page: self.pdfPage, - linkService: self.linkService + linkService: self.linkService, + downloadManager: self.downloadManager }; if (self.div) { @@ -1867,6 +1861,8 @@ DefaultAnnotationLayerFactory.prototype = { * @property {HTMLDivElement} container - The container for the viewer element. * @property {HTMLDivElement} viewer - (optional) The viewer element. * @property {IPDFLinkService} linkService - The navigation/linking service. + * @property {DownloadManager} downloadManager - (optional) The download + * manager component. * @property {PDFRenderingQueue} renderingQueue - (optional) The rendering * queue object. * @property {boolean} removePageBorders - (optional) Removes the border shadow @@ -1919,6 +1915,7 @@ var PDFViewer = (function pdfViewer() { this.container = options.container; this.viewer = options.viewer || options.container.firstElementChild; this.linkService = options.linkService || new SimpleLinkService(); + this.downloadManager = options.downloadManager || null; this.removePageBorders = options.removePageBorders || false; this.defaultRenderingQueue = !options.renderingQueue; @@ -2584,7 +2581,8 @@ var PDFViewer = (function pdfViewer() { return new AnnotationLayerBuilder({ pageDiv: pageDiv, pdfPage: pdfPage, - linkService: this.linkService + linkService: this.linkService, + downloadManager: this.downloadManager }); }, @@ -3038,6 +3036,90 @@ var PDFHistory = (function () { })(); +var DownloadManager = (function DownloadManagerClosure() { + + function download(blobUrl, filename) { + var a = document.createElement('a'); + if (a.click) { + // Use a.click() if available. Otherwise, Chrome might show + // "Unsafe JavaScript attempt to initiate a navigation change + // for frame with URL" and not open the PDF at all. + // Supported by (not mentioned = untested): + // - Firefox 6 - 19 (4- does not support a.click, 5 ignores a.click) + // - Chrome 19 - 26 (18- does not support a.click) + // - Opera 9 - 12.15 + // - Internet Explorer 6 - 10 + // - Safari 6 (5.1- does not support a.click) + a.href = blobUrl; + a.target = '_parent'; + // Use a.download if available. This increases the likelihood that + // the file is downloaded instead of opened by another PDF plugin. + if ('download' in a) { + a.download = filename; + } + // must be in the document for IE and recent Firefox versions. + // (otherwise .click() is ignored) + (document.body || document.documentElement).appendChild(a); + a.click(); + a.parentNode.removeChild(a); + } else { + if (window.top === window && + blobUrl.split('#')[0] === window.location.href.split('#')[0]) { + // If _parent == self, then opening an identical URL with different + // location hash will only cause a navigation, not a download. + var padCharacter = blobUrl.indexOf('?') === -1 ? '?' : '&'; + blobUrl = blobUrl.replace(/#|$/, padCharacter + '$&'); + } + window.open(blobUrl, '_parent'); + } + } + + function DownloadManager() {} + + DownloadManager.prototype = { + downloadUrl: function DownloadManager_downloadUrl(url, filename) { + if (!PDFJS.isValidUrl(url, true)) { + return; // restricted/invalid URL + } + + download(url + '#pdfjs.action=download', filename); + }, + + downloadData: function DownloadManager_downloadData(data, filename, + contentType) { + if (navigator.msSaveBlob) { // IE10 and above + return navigator.msSaveBlob(new Blob([data], { type: contentType }), + filename); + } + + var blobUrl = PDFJS.createObjectURL(data, contentType); + download(blobUrl, filename); + }, + + download: function DownloadManager_download(blob, url, filename) { + if (!URL) { + // URL.createObjectURL is not supported + this.downloadUrl(url, filename); + return; + } + + if (navigator.msSaveBlob) { + // IE10 / IE11 + if (!navigator.msSaveBlob(blob, filename)) { + this.downloadUrl(url, filename); + } + return; + } + + var blobUrl = URL.createObjectURL(blob); + download(blobUrl, filename); + } + }; + + return DownloadManager; +})(); + + PDFJS.PDFViewer = PDFViewer; PDFJS.PDFPageView = PDFPageView; PDFJS.PDFLinkService = PDFLinkService; @@ -3047,7 +3129,7 @@ var PDFHistory = (function () { PDFJS.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; PDFJS.PDFHistory = PDFHistory; - PDFJS.getFileName = getFileName; + PDFJS.DownloadManager = DownloadManager; PDFJS.ProgressBar = ProgressBar; }).call((typeof window === 'undefined') ? this : window);