Browse Source

PDF.js version 2.0.374 - See mozilla/pdf.js@538dda1096b36d76d75af9eb63a3675fedbe2d19

master v2.0.374
pdfjsbot 7 years ago
parent
commit
9b509778b1
  1. 2
      bower.json
  2. 130
      build/pdf.js
  3. 2
      build/pdf.js.map
  4. 2
      build/pdf.min.js
  5. 29
      build/pdf.worker.js
  6. 2
      build/pdf.worker.js.map
  7. 2
      build/pdf.worker.min.js
  8. 2
      lib/core/worker.js
  9. 18
      lib/display/annotation_layer.js
  10. 10
      lib/display/api.js
  11. 60
      lib/display/dom_utils.js
  12. 14
      lib/display/global.js
  13. 5
      lib/pdf.js
  14. 4
      lib/pdf.worker.js
  15. 23
      lib/shared/compatibility.js
  16. 27
      lib/test/unit/dom_utils_spec.js
  17. 10
      lib/web/annotation_layer_builder.js
  18. 57
      lib/web/app.js
  19. 19
      lib/web/base_viewer.js
  20. 2
      lib/web/chromecom.js
  21. 1
      lib/web/debugger.js
  22. 2
      lib/web/firefoxcom.js
  23. 6
      lib/web/genericcom.js
  24. 5
      lib/web/interfaces.js
  25. 11
      lib/web/pdf_link_service.js
  26. 34
      lib/web/pdf_outline_viewer.js
  27. 29
      lib/web/pdf_page_view.js
  28. 3
      lib/web/preferences.js
  29. 12
      lib/web/ui_utils.js
  30. 45
      lib/web/viewer_compatibility.js
  31. 2
      package.json
  32. 117
      web/pdf_viewer.js
  33. 2
      web/pdf_viewer.js.map

2
bower.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.363",
"version": "2.0.374",
"main": [
"build/pdf.js",
"build/pdf.worker.js"

130
build/pdf.js

@ -1598,7 +1598,7 @@ module.exports = function (fn, that, length) { @@ -1598,7 +1598,7 @@ module.exports = function (fn, that, length) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DummyStatTimer = exports.StatTimer = exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = undefined;
exports.DummyStatTimer = exports.StatTimer = exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.addLinkAttributes = exports.RenderingCancelledException = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -1901,20 +1901,18 @@ var LinkTarget = { @@ -1901,20 +1901,18 @@ var LinkTarget = {
TOP: 4
};
var LinkTargetStringMap = ['', '_self', '_blank', '_parent', '_top'];
function addLinkAttributes(link, params) {
var url = params && params.url;
function addLinkAttributes(link) {
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
url = _ref3.url,
target = _ref3.target,
rel = _ref3.rel;
link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : '';
if (url) {
var target = params.target;
if (typeof target === 'undefined') {
target = getDefaultSetting('externalLinkTarget');
}
link.target = LinkTargetStringMap[target];
var rel = params.rel;
if (typeof rel === 'undefined') {
rel = getDefaultSetting('externalLinkRel');
}
link.rel = rel;
var LinkTargetValues = Object.values(LinkTarget);
var targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE;
link.target = LinkTargetStringMap[targetIndex];
link.rel = typeof rel === 'string' ? rel : DEFAULT_LINK_REL;
}
}
function getFilenameFromUrl(url) {
@ -1938,8 +1936,6 @@ function getDefaultSetting(id) { @@ -1938,8 +1936,6 @@ function getDefaultSetting(id) {
return globalSettings ? globalSettings.disableFontFace : false;
case 'disableCreateObjectURL':
return globalSettings ? globalSettings.disableCreateObjectURL : false;
case 'disableWebGL':
return globalSettings ? globalSettings.disableWebGL : true;
case 'cMapUrl':
return globalSettings ? globalSettings.cMapUrl : null;
case 'cMapPacked':
@ -1952,45 +1948,12 @@ function getDefaultSetting(id) { @@ -1952,45 +1948,12 @@ function getDefaultSetting(id) {
return globalSettings ? globalSettings.workerSrc : null;
case 'maxImageSize':
return globalSettings ? globalSettings.maxImageSize : -1;
case 'imageResourcesPath':
return globalSettings ? globalSettings.imageResourcesPath : '';
case 'isEvalSupported':
return globalSettings ? globalSettings.isEvalSupported : true;
case 'externalLinkTarget':
if (!globalSettings) {
return LinkTarget.NONE;
}
switch (globalSettings.externalLinkTarget) {
case LinkTarget.NONE:
case LinkTarget.SELF:
case LinkTarget.BLANK:
case LinkTarget.PARENT:
case LinkTarget.TOP:
return globalSettings.externalLinkTarget;
}
(0, _util.warn)('PDFJS.externalLinkTarget is invalid: ' + globalSettings.externalLinkTarget);
globalSettings.externalLinkTarget = LinkTarget.NONE;
return LinkTarget.NONE;
case 'externalLinkRel':
return globalSettings ? globalSettings.externalLinkRel : DEFAULT_LINK_REL;
case 'enableStats':
return !!(globalSettings && globalSettings.enableStats);
default:
throw new Error('Unknown default setting: ' + id);
}
}
function isExternalLinkTargetSet() {
var externalLinkTarget = getDefaultSetting('externalLinkTarget');
switch (externalLinkTarget) {
case LinkTarget.NONE:
return false;
case LinkTarget.SELF:
case LinkTarget.BLANK:
case LinkTarget.PARENT:
case LinkTarget.TOP:
return true;
}
}
var StatTimer = function () {
function StatTimer() {
@ -2079,7 +2042,6 @@ var DummyStatTimer = function () { @@ -2079,7 +2042,6 @@ var DummyStatTimer = function () {
exports.RenderingCancelledException = RenderingCancelledException;
exports.addLinkAttributes = addLinkAttributes;
exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.getFilenameFromUrl = getFilenameFromUrl;
exports.LinkTarget = LinkTarget;
exports.getDefaultSetting = getDefaultSetting;
@ -3299,7 +3261,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -3299,7 +3261,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.363';
var apiVersion = '2.0.374';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -3493,7 +3455,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { @@ -3493,7 +3455,7 @@ var PDFPageProxy = function PDFPageProxyClosure() {
this.pageIndex = pageIndex;
this.pageInfo = pageInfo;
this.transport = transport;
this._stats = (0, _dom_utils.getDefaultSetting)('enableStats') ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer;
this._stats = (0, _dom_utils.getDefaultSetting)('pdfBug') ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer;
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
this.cleanupAfterRender = false;
@ -3540,7 +3502,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { @@ -3540,7 +3502,7 @@ var PDFPageProxy = function PDFPageProxyClosure() {
this.pendingCleanup = false;
var renderingIntent = params.intent === 'print' ? 'print' : 'display';
var canvasFactory = params.canvasFactory || new _dom_utils.DOMCanvasFactory();
var webGLContext = new _webgl.WebGLContext({ enable: !(0, _dom_utils.getDefaultSetting)('disableWebGL') });
var webGLContext = new _webgl.WebGLContext({ enable: params.enableWebGL });
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null);
}
@ -4698,8 +4660,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -4698,8 +4660,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.363';
exports.build = build = '2e780d4e';
exports.version = version = '2.0.374';
exports.build = build = '538dda10';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -5041,16 +5003,20 @@ var LinkAnnotationElement = function (_AnnotationElement) { @@ -5041,16 +5003,20 @@ var LinkAnnotationElement = function (_AnnotationElement) {
key: 'render',
value: function render() {
this.container.className = 'linkAnnotation';
var data = this.data,
linkService = this.linkService;
var link = document.createElement('a');
(0, _dom_utils.addLinkAttributes)(link, {
url: this.data.url,
target: this.data.newWindow ? _dom_utils.LinkTarget.BLANK : undefined
url: data.url,
target: data.newWindow ? _dom_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
rel: linkService.externalLinkRel
});
if (!this.data.url) {
if (this.data.action) {
this._bindNamedAction(link, this.data.action);
if (!data.url) {
if (data.action) {
this._bindNamedAction(link, data.action);
} else {
this._bindLink(link, this.data.dest);
this._bindLink(link, data.dest);
}
}
this.container.appendChild(link);
@ -5824,7 +5790,7 @@ var AnnotationLayer = function () { @@ -5824,7 +5790,7 @@ var AnnotationLayer = function () {
viewport: parameters.viewport,
linkService: parameters.linkService,
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'),
imageResourcesPath: parameters.imageResourcesPath || '',
renderInteractiveForms: parameters.renderInteractiveForms || false,
svgFactory: new _dom_utils.DOMSVGFactory()
});
@ -7457,8 +7423,8 @@ exports.SVGGraphics = SVGGraphics; @@ -7457,8 +7423,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsVersion = '2.0.374';
var pdfjsBuild = '538dda10';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(120);
var pdfjsDisplayAPI = __w_pdfjs_require__(58);
@ -7510,6 +7476,7 @@ exports.shadow = pdfjsSharedUtil.shadow; @@ -7510,6 +7476,7 @@ exports.shadow = pdfjsSharedUtil.shadow;
exports.createBlob = pdfjsSharedUtil.createBlob;
exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget;
exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
/***/ }),
@ -7525,7 +7492,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -7525,7 +7492,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
var globalScope = __w_pdfjs_require__(15);
var isNodeJS = __w_pdfjs_require__(25);
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
var isAndroid = /Android/.test(userAgent);
var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
var isIE = userAgent.indexOf('Trident') >= 0;
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
@ -7556,34 +7522,12 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -7556,34 +7522,12 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
PDFJS.disableCreateObjectURL = true;
}
})();
(function checkNavigatorLanguage() {
if (typeof navigator === 'undefined') {
return;
}
if ('language' in navigator) {
return;
}
PDFJS.locale = navigator.userLanguage || 'en-US';
})();
(function checkRangeRequests() {
if (isSafari || isIOS) {
PDFJS.disableRange = true;
PDFJS.disableStream = true;
}
})();
(function checkCanvasSizeLimitation() {
if (isIOS || isAndroid) {
PDFJS.maxCanvasPixels = 5242880;
}
})();
(function checkFullscreenSupport() {
if (!hasDOM) {
return;
}
if (isIE && window.parent !== window) {
PDFJS.disableFullscreen = true;
}
})();
(function checkCurrentScript() {
if (!hasDOM) {
return;
@ -12718,10 +12662,10 @@ Object.defineProperty(exports, "__esModule", { @@ -12718,10 +12662,10 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFJS = exports.globalScope = undefined;
var _dom_utils = __w_pdfjs_require__(10);
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _api = __w_pdfjs_require__(58);
var _annotation_layer = __w_pdfjs_require__(60);
@ -12742,10 +12686,6 @@ if (!_global_scope2.default.PDFJS) { @@ -12742,10 +12686,6 @@ if (!_global_scope2.default.PDFJS) {
_global_scope2.default.PDFJS = {};
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.363';
PDFJS.build = '2e780d4e';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
(0, _util.setVerbosityLevel)(PDFJS.verbosity);
@ -12765,7 +12705,6 @@ Object.defineProperty(PDFJS, 'verbosity', { @@ -12765,7 +12705,6 @@ Object.defineProperty(PDFJS, 'verbosity', {
PDFJS.VERBOSITY_LEVELS = _util.VERBOSITY_LEVELS;
PDFJS.OPS = _util.OPS;
PDFJS.UNSUPPORTED_FEATURES = _util.UNSUPPORTED_FEATURES;
PDFJS.isValidUrl = _dom_utils.isValidUrl;
PDFJS.shadow = _util.shadow;
PDFJS.createBlob = _util.createBlob;
PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) {
@ -12791,7 +12730,6 @@ PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize; @@ -12791,7 +12730,6 @@ PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize;
PDFJS.cMapUrl = PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl;
PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
PDFJS.disableFontFace = PDFJS.disableFontFace === undefined ? false : PDFJS.disableFontFace;
PDFJS.imageResourcesPath = PDFJS.imageResourcesPath === undefined ? '' : PDFJS.imageResourcesPath;
PDFJS.workerSrc = PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc;
PDFJS.workerPort = PDFJS.workerPort === undefined ? null : PDFJS.workerPort;
PDFJS.disableRange = PDFJS.disableRange === undefined ? false : PDFJS.disableRange;
@ -12800,7 +12738,6 @@ PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.di @@ -12800,7 +12738,6 @@ PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.di
PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug;
PDFJS.postMessageTransfers = PDFJS.postMessageTransfers === undefined ? true : PDFJS.postMessageTransfers;
PDFJS.disableCreateObjectURL = PDFJS.disableCreateObjectURL === undefined ? false : PDFJS.disableCreateObjectURL;
PDFJS.disableWebGL = PDFJS.disableWebGL === undefined ? true : PDFJS.disableWebGL;
PDFJS.externalLinkTarget = PDFJS.externalLinkTarget === undefined ? _dom_utils.LinkTarget.NONE : PDFJS.externalLinkTarget;
PDFJS.externalLinkRel = PDFJS.externalLinkRel === undefined ? _dom_utils.DEFAULT_LINK_REL : PDFJS.externalLinkRel;
PDFJS.isEvalSupported = PDFJS.isEvalSupported === undefined ? true : PDFJS.isEvalSupported;
@ -12808,10 +12745,7 @@ PDFJS.getDocument = _api.getDocument; @@ -12808,10 +12745,7 @@ PDFJS.getDocument = _api.getDocument;
PDFJS.LoopbackPort = _api.LoopbackPort;
PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport;
PDFJS.PDFWorker = _api.PDFWorker;
PDFJS.LinkTarget = _dom_utils.LinkTarget;
PDFJS.addLinkAttributes = _dom_utils.addLinkAttributes;
PDFJS.getFilenameFromUrl = _dom_utils.getFilenameFromUrl;
PDFJS.isExternalLinkTargetSet = _dom_utils.isExternalLinkTargetSet;
PDFJS.AnnotationLayer = _annotation_layer.AnnotationLayer;
PDFJS.renderTextLayer = _text_layer.renderTextLayer;
PDFJS.Metadata = _metadata.Metadata;

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

2
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

29
build/pdf.worker.js vendored

@ -22313,8 +22313,8 @@ exports.PostScriptCompiler = PostScriptCompiler; @@ -22313,8 +22313,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsVersion = '2.0.374';
var pdfjsBuild = '538dda10';
var pdfjsCoreWorker = __w_pdfjs_require__(74);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22527,7 +22527,7 @@ var WorkerMessageHandler = { @@ -22527,7 +22527,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.363';
var workerVersion = '2.0.374';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}
@ -22927,7 +22927,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -22927,7 +22927,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
var globalScope = __w_pdfjs_require__(76);
var isNodeJS = __w_pdfjs_require__(44);
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
var isAndroid = /Android/.test(userAgent);
var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
var isIE = userAgent.indexOf('Trident') >= 0;
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
@ -22958,34 +22957,12 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -22958,34 +22957,12 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
PDFJS.disableCreateObjectURL = true;
}
})();
(function checkNavigatorLanguage() {
if (typeof navigator === 'undefined') {
return;
}
if ('language' in navigator) {
return;
}
PDFJS.locale = navigator.userLanguage || 'en-US';
})();
(function checkRangeRequests() {
if (isSafari || isIOS) {
PDFJS.disableRange = true;
PDFJS.disableStream = true;
}
})();
(function checkCanvasSizeLimitation() {
if (isIOS || isAndroid) {
PDFJS.maxCanvasPixels = 5242880;
}
})();
(function checkFullscreenSupport() {
if (!hasDOM) {
return;
}
if (isIE && window.parent !== window) {
PDFJS.disableFullscreen = true;
}
})();
(function checkCurrentScript() {
if (!hasDOM) {
return;

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

2
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

2
lib/core/worker.js

@ -223,7 +223,7 @@ var WorkerMessageHandler = { @@ -223,7 +223,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.363';
var workerVersion = '2.0.374';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

18
lib/display/annotation_layer.js

@ -228,16 +228,20 @@ var LinkAnnotationElement = function (_AnnotationElement) { @@ -228,16 +228,20 @@ var LinkAnnotationElement = function (_AnnotationElement) {
key: 'render',
value: function render() {
this.container.className = 'linkAnnotation';
var data = this.data,
linkService = this.linkService;
var link = document.createElement('a');
(0, _dom_utils.addLinkAttributes)(link, {
url: this.data.url,
target: this.data.newWindow ? _dom_utils.LinkTarget.BLANK : undefined
url: data.url,
target: data.newWindow ? _dom_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
rel: linkService.externalLinkRel
});
if (!this.data.url) {
if (this.data.action) {
this._bindNamedAction(link, this.data.action);
if (!data.url) {
if (data.action) {
this._bindNamedAction(link, data.action);
} else {
this._bindLink(link, this.data.dest);
this._bindLink(link, data.dest);
}
}
this.container.appendChild(link);
@ -1011,7 +1015,7 @@ var AnnotationLayer = function () { @@ -1011,7 +1015,7 @@ var AnnotationLayer = function () {
viewport: parameters.viewport,
linkService: parameters.linkService,
downloadManager: parameters.downloadManager,
imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'),
imageResourcesPath: parameters.imageResourcesPath || '',
renderInteractiveForms: parameters.renderInteractiveForms || false,
svgFactory: new _dom_utils.DOMSVGFactory()
});

10
lib/display/api.js

@ -178,7 +178,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -178,7 +178,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.363';
var apiVersion = '2.0.374';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -372,7 +372,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { @@ -372,7 +372,7 @@ var PDFPageProxy = function PDFPageProxyClosure() {
this.pageIndex = pageIndex;
this.pageInfo = pageInfo;
this.transport = transport;
this._stats = (0, _dom_utils.getDefaultSetting)('enableStats') ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer;
this._stats = (0, _dom_utils.getDefaultSetting)('pdfBug') ? new _dom_utils.StatTimer() : _dom_utils.DummyStatTimer;
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
this.cleanupAfterRender = false;
@ -419,7 +419,7 @@ var PDFPageProxy = function PDFPageProxyClosure() { @@ -419,7 +419,7 @@ var PDFPageProxy = function PDFPageProxyClosure() {
this.pendingCleanup = false;
var renderingIntent = params.intent === 'print' ? 'print' : 'display';
var canvasFactory = params.canvasFactory || new _dom_utils.DOMCanvasFactory();
var webGLContext = new _webgl.WebGLContext({ enable: !(0, _dom_utils.getDefaultSetting)('disableWebGL') });
var webGLContext = new _webgl.WebGLContext({ enable: params.enableWebGL });
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null);
}
@ -1577,8 +1577,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -1577,8 +1577,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.363';
exports.build = build = '2e780d4e';
exports.version = version = '2.0.374';
exports.build = build = '538dda10';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

60
lib/display/dom_utils.js

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DummyStatTimer = exports.StatTimer = exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = undefined;
exports.DummyStatTimer = exports.StatTimer = exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.addLinkAttributes = exports.RenderingCancelledException = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -327,20 +327,18 @@ var LinkTarget = { @@ -327,20 +327,18 @@ var LinkTarget = {
TOP: 4
};
var LinkTargetStringMap = ['', '_self', '_blank', '_parent', '_top'];
function addLinkAttributes(link, params) {
var url = params && params.url;
function addLinkAttributes(link) {
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
url = _ref3.url,
target = _ref3.target,
rel = _ref3.rel;
link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : '';
if (url) {
var target = params.target;
if (typeof target === 'undefined') {
target = getDefaultSetting('externalLinkTarget');
}
link.target = LinkTargetStringMap[target];
var rel = params.rel;
if (typeof rel === 'undefined') {
rel = getDefaultSetting('externalLinkRel');
}
link.rel = rel;
var LinkTargetValues = Object.values(LinkTarget);
var targetIndex = LinkTargetValues.includes(target) ? target : LinkTarget.NONE;
link.target = LinkTargetStringMap[targetIndex];
link.rel = typeof rel === 'string' ? rel : DEFAULT_LINK_REL;
}
}
function getFilenameFromUrl(url) {
@ -364,8 +362,6 @@ function getDefaultSetting(id) { @@ -364,8 +362,6 @@ function getDefaultSetting(id) {
return globalSettings ? globalSettings.disableFontFace : false;
case 'disableCreateObjectURL':
return globalSettings ? globalSettings.disableCreateObjectURL : false;
case 'disableWebGL':
return globalSettings ? globalSettings.disableWebGL : true;
case 'cMapUrl':
return globalSettings ? globalSettings.cMapUrl : null;
case 'cMapPacked':
@ -378,45 +374,12 @@ function getDefaultSetting(id) { @@ -378,45 +374,12 @@ function getDefaultSetting(id) {
return globalSettings ? globalSettings.workerSrc : null;
case 'maxImageSize':
return globalSettings ? globalSettings.maxImageSize : -1;
case 'imageResourcesPath':
return globalSettings ? globalSettings.imageResourcesPath : '';
case 'isEvalSupported':
return globalSettings ? globalSettings.isEvalSupported : true;
case 'externalLinkTarget':
if (!globalSettings) {
return LinkTarget.NONE;
}
switch (globalSettings.externalLinkTarget) {
case LinkTarget.NONE:
case LinkTarget.SELF:
case LinkTarget.BLANK:
case LinkTarget.PARENT:
case LinkTarget.TOP:
return globalSettings.externalLinkTarget;
}
(0, _util.warn)('PDFJS.externalLinkTarget is invalid: ' + globalSettings.externalLinkTarget);
globalSettings.externalLinkTarget = LinkTarget.NONE;
return LinkTarget.NONE;
case 'externalLinkRel':
return globalSettings ? globalSettings.externalLinkRel : DEFAULT_LINK_REL;
case 'enableStats':
return !!(globalSettings && globalSettings.enableStats);
default:
throw new Error('Unknown default setting: ' + id);
}
}
function isExternalLinkTargetSet() {
var externalLinkTarget = getDefaultSetting('externalLinkTarget');
switch (externalLinkTarget) {
case LinkTarget.NONE:
return false;
case LinkTarget.SELF:
case LinkTarget.BLANK:
case LinkTarget.PARENT:
case LinkTarget.TOP:
return true;
}
}
var StatTimer = function () {
function StatTimer() {
@ -505,7 +468,6 @@ var DummyStatTimer = function () { @@ -505,7 +468,6 @@ var DummyStatTimer = function () {
exports.RenderingCancelledException = RenderingCancelledException;
exports.addLinkAttributes = addLinkAttributes;
exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.getFilenameFromUrl = getFilenameFromUrl;
exports.LinkTarget = LinkTarget;
exports.getDefaultSetting = getDefaultSetting;

14
lib/display/global.js

@ -26,10 +26,10 @@ Object.defineProperty(exports, "__esModule", { @@ -26,10 +26,10 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFJS = exports.globalScope = undefined;
var _dom_utils = require('./dom_utils');
var _util = require('../shared/util');
var _dom_utils = require('./dom_utils');
var _api = require('./api');
var _annotation_layer = require('./annotation_layer');
@ -50,10 +50,6 @@ if (!_global_scope2.default.PDFJS) { @@ -50,10 +50,6 @@ if (!_global_scope2.default.PDFJS) {
_global_scope2.default.PDFJS = {};
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.363';
PDFJS.build = '2e780d4e';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
(0, _util.setVerbosityLevel)(PDFJS.verbosity);
@ -73,7 +69,6 @@ Object.defineProperty(PDFJS, 'verbosity', { @@ -73,7 +69,6 @@ Object.defineProperty(PDFJS, 'verbosity', {
PDFJS.VERBOSITY_LEVELS = _util.VERBOSITY_LEVELS;
PDFJS.OPS = _util.OPS;
PDFJS.UNSUPPORTED_FEATURES = _util.UNSUPPORTED_FEATURES;
PDFJS.isValidUrl = _dom_utils.isValidUrl;
PDFJS.shadow = _util.shadow;
PDFJS.createBlob = _util.createBlob;
PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) {
@ -99,7 +94,6 @@ PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize; @@ -99,7 +94,6 @@ PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize;
PDFJS.cMapUrl = PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl;
PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked;
PDFJS.disableFontFace = PDFJS.disableFontFace === undefined ? false : PDFJS.disableFontFace;
PDFJS.imageResourcesPath = PDFJS.imageResourcesPath === undefined ? '' : PDFJS.imageResourcesPath;
PDFJS.workerSrc = PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc;
PDFJS.workerPort = PDFJS.workerPort === undefined ? null : PDFJS.workerPort;
PDFJS.disableRange = PDFJS.disableRange === undefined ? false : PDFJS.disableRange;
@ -108,7 +102,6 @@ PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.di @@ -108,7 +102,6 @@ PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.di
PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug;
PDFJS.postMessageTransfers = PDFJS.postMessageTransfers === undefined ? true : PDFJS.postMessageTransfers;
PDFJS.disableCreateObjectURL = PDFJS.disableCreateObjectURL === undefined ? false : PDFJS.disableCreateObjectURL;
PDFJS.disableWebGL = PDFJS.disableWebGL === undefined ? true : PDFJS.disableWebGL;
PDFJS.externalLinkTarget = PDFJS.externalLinkTarget === undefined ? _dom_utils.LinkTarget.NONE : PDFJS.externalLinkTarget;
PDFJS.externalLinkRel = PDFJS.externalLinkRel === undefined ? _dom_utils.DEFAULT_LINK_REL : PDFJS.externalLinkRel;
PDFJS.isEvalSupported = PDFJS.isEvalSupported === undefined ? true : PDFJS.isEvalSupported;
@ -116,10 +109,7 @@ PDFJS.getDocument = _api.getDocument; @@ -116,10 +109,7 @@ PDFJS.getDocument = _api.getDocument;
PDFJS.LoopbackPort = _api.LoopbackPort;
PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport;
PDFJS.PDFWorker = _api.PDFWorker;
PDFJS.LinkTarget = _dom_utils.LinkTarget;
PDFJS.addLinkAttributes = _dom_utils.addLinkAttributes;
PDFJS.getFilenameFromUrl = _dom_utils.getFilenameFromUrl;
PDFJS.isExternalLinkTargetSet = _dom_utils.isExternalLinkTargetSet;
PDFJS.AnnotationLayer = _annotation_layer.AnnotationLayer;
PDFJS.renderTextLayer = _text_layer.renderTextLayer;
PDFJS.Metadata = _metadata.Metadata;

5
lib/pdf.js

@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
*/
'use strict';
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsVersion = '2.0.374';
var pdfjsBuild = '538dda10';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');
@ -74,4 +74,5 @@ exports.shadow = pdfjsSharedUtil.shadow; @@ -74,4 +74,5 @@ exports.shadow = pdfjsSharedUtil.shadow;
exports.createBlob = pdfjsSharedUtil.createBlob;
exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
exports.LinkTarget = pdfjsDisplayDOMUtils.LinkTarget;
exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;

4
lib/pdf.worker.js vendored

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
*/
'use strict';
var pdfjsVersion = '2.0.363';
var pdfjsBuild = '2e780d4e';
var pdfjsVersion = '2.0.374';
var pdfjsBuild = '538dda10';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

23
lib/shared/compatibility.js

@ -27,7 +27,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -27,7 +27,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
var globalScope = require('./global_scope');
var isNodeJS = require('./is_node');
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
var isAndroid = /Android/.test(userAgent);
var isIOSChrome = userAgent.indexOf('CriOS') >= 0;
var isIE = userAgent.indexOf('Trident') >= 0;
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
@ -58,34 +57,12 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { @@ -58,34 +57,12 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
PDFJS.disableCreateObjectURL = true;
}
})();
(function checkNavigatorLanguage() {
if (typeof navigator === 'undefined') {
return;
}
if ('language' in navigator) {
return;
}
PDFJS.locale = navigator.userLanguage || 'en-US';
})();
(function checkRangeRequests() {
if (isSafari || isIOS) {
PDFJS.disableRange = true;
PDFJS.disableStream = true;
}
})();
(function checkCanvasSizeLimitation() {
if (isIOS || isAndroid) {
PDFJS.maxCanvasPixels = 5242880;
}
})();
(function checkFullscreenSupport() {
if (!hasDOM) {
return;
}
if (isIE && window.parent !== window) {
PDFJS.disableFullscreen = true;
}
})();
(function checkCurrentScript() {
if (!hasDOM) {
return;

27
lib/test/unit/dom_utils_spec.js

@ -27,8 +27,6 @@ var _is_node = require('../../shared/is_node'); @@ -27,8 +27,6 @@ var _is_node = require('../../shared/is_node');
var _is_node2 = _interopRequireDefault(_is_node);
var _global = require('../../display/global');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
describe('dom_utils', function () {
@ -88,29 +86,4 @@ describe('dom_utils', function () { @@ -88,29 +86,4 @@ describe('dom_utils', function () {
expect(result).toEqual(expected);
});
});
describe('isExternalLinkTargetSet', function () {
var savedExternalLinkTarget;
beforeAll(function (done) {
savedExternalLinkTarget = _global.PDFJS.externalLinkTarget;
done();
});
afterAll(function () {
_global.PDFJS.externalLinkTarget = savedExternalLinkTarget;
});
it('handles the predefined LinkTargets', function () {
for (var key in _dom_utils.LinkTarget) {
var linkTarget = _dom_utils.LinkTarget[key];
_global.PDFJS.externalLinkTarget = linkTarget;
expect((0, _dom_utils.isExternalLinkTargetSet)()).toEqual(!!linkTarget);
}
});
it('handles incorrect LinkTargets', function () {
var targets = [true, '', false, -1, '_blank', null];
for (var i = 0, ii = targets.length; i < ii; i++) {
var linkTarget = targets[i];
_global.PDFJS.externalLinkTarget = linkTarget;
expect((0, _dom_utils.isExternalLinkTargetSet)()).toEqual(false);
}
});
});
});

10
lib/web/annotation_layer_builder.js

@ -42,6 +42,8 @@ var AnnotationLayerBuilder = function () { @@ -42,6 +42,8 @@ var AnnotationLayerBuilder = function () {
pdfPage = _ref.pdfPage,
linkService = _ref.linkService,
downloadManager = _ref.downloadManager,
_ref$imageResourcesPa = _ref.imageResourcesPath,
imageResourcesPath = _ref$imageResourcesPa === undefined ? '' : _ref$imageResourcesPa,
_ref$renderInteractiv = _ref.renderInteractiveForms,
renderInteractiveForms = _ref$renderInteractiv === undefined ? false : _ref$renderInteractiv,
_ref$l10n = _ref.l10n,
@ -53,6 +55,7 @@ var AnnotationLayerBuilder = function () { @@ -53,6 +55,7 @@ var AnnotationLayerBuilder = function () {
this.pdfPage = pdfPage;
this.linkService = linkService;
this.downloadManager = downloadManager;
this.imageResourcesPath = imageResourcesPath;
this.renderInteractiveForms = renderInteractiveForms;
this.l10n = l10n;
this.div = null;
@ -75,6 +78,7 @@ var AnnotationLayerBuilder = function () { @@ -75,6 +78,7 @@ var AnnotationLayerBuilder = function () {
div: _this.div,
annotations: annotations,
page: _this.pdfPage,
imageResourcesPath: _this.imageResourcesPath,
renderInteractiveForms: _this.renderInteractiveForms,
linkService: _this.linkService,
downloadManager: _this.downloadManager
@ -120,12 +124,14 @@ var DefaultAnnotationLayerFactory = function () { @@ -120,12 +124,14 @@ var DefaultAnnotationLayerFactory = function () {
_createClass(DefaultAnnotationLayerFactory, [{
key: 'createAnnotationLayerBuilder',
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
var renderInteractiveForms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _ui_utils.NullL10n;
var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n;
return new AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
imageResourcesPath: imageResourcesPath,
renderInteractiveForms: renderInteractiveForms,
linkService: new _pdf_link_service.SimpleLinkService(),
l10n: l10n

57
lib/web/app.js

@ -70,6 +70,8 @@ var _secondary_toolbar = require('./secondary_toolbar'); @@ -70,6 +70,8 @@ var _secondary_toolbar = require('./secondary_toolbar');
var _toolbar = require('./toolbar');
var _viewer_compatibility = require('./viewer_compatibility');
var _view_history = require('./view_history');
var DEFAULT_SCALE_DELTA = 1.1;
@ -134,6 +136,7 @@ var PDFViewerApplication = { @@ -134,6 +136,7 @@ var PDFViewerApplication = {
isInitialViewSet: false,
downloadComplete: false,
viewerPrefs: {
enableWebGL: false,
sidebarViewOnLoad: _pdf_sidebar.SidebarView.NONE,
pdfBugEnabled: false,
showPreviousViewOnLoad: true,
@ -141,7 +144,7 @@ var PDFViewerApplication = { @@ -141,7 +144,7 @@ var PDFViewerApplication = {
disablePageMode: false,
disablePageLabels: false,
renderer: 'canvas',
enhanceTextSelection: false,
textLayerMode: _ui_utils.TextLayerMode.ENABLE,
renderInteractiveForms: false,
enablePrintAutoRotate: false
},
@ -170,8 +173,8 @@ var PDFViewerApplication = { @@ -170,8 +173,8 @@ var PDFViewerApplication = {
_this.l10n.translate(appContainer).then(function () {
_this.eventBus.dispatch('localized');
});
if (_this.isViewerEmbedded && !_pdf.PDFJS.isExternalLinkTargetSet()) {
_pdf.PDFJS.externalLinkTarget = _pdf.PDFJS.LinkTarget.TOP;
if (_this.isViewerEmbedded && _pdf.PDFJS.externalLinkTarget === _pdf.LinkTarget.NONE) {
_pdf.PDFJS.externalLinkTarget = _pdf.LinkTarget.TOP;
}
_this.initialized = true;
});
@ -181,7 +184,7 @@ var PDFViewerApplication = { @@ -181,7 +184,7 @@ var PDFViewerApplication = {
viewerPrefs = this.viewerPrefs;
return Promise.all([preferences.get('enableWebGL').then(function resolved(value) {
_pdf.PDFJS.disableWebGL = !value;
viewerPrefs['enableWebGL'] = value;
}), preferences.get('sidebarViewOnLoad').then(function resolved(value) {
viewerPrefs['sidebarViewOnLoad'] = value;
}), preferences.get('pdfBugEnabled').then(function resolved(value) {
@ -190,13 +193,11 @@ var PDFViewerApplication = { @@ -190,13 +193,11 @@ var PDFViewerApplication = {
viewerPrefs['showPreviousViewOnLoad'] = value;
}), preferences.get('defaultZoomValue').then(function resolved(value) {
viewerPrefs['defaultZoomValue'] = value;
}), preferences.get('enhanceTextSelection').then(function resolved(value) {
viewerPrefs['enhanceTextSelection'] = value;
}), preferences.get('disableTextLayer').then(function resolved(value) {
if (_pdf.PDFJS.disableTextLayer === true) {
}), preferences.get('textLayerMode').then(function resolved(value) {
if (viewerPrefs['textLayerMode'] === _ui_utils.TextLayerMode.DISABLE) {
return;
}
_pdf.PDFJS.disableTextLayer = value;
viewerPrefs['textLayerMode'] = value;
}), preferences.get('disableRange').then(function resolved(value) {
if (_pdf.PDFJS.disableRange === true) {
return;
@ -217,7 +218,7 @@ var PDFViewerApplication = { @@ -217,7 +218,7 @@ var PDFViewerApplication = {
}), preferences.get('useOnlyCssZoom').then(function resolved(value) {
_pdf.PDFJS.useOnlyCssZoom = value;
}), preferences.get('externalLinkTarget').then(function resolved(value) {
if (_pdf.PDFJS.isExternalLinkTargetSet()) {
if (_pdf.PDFJS.externalLinkTarget !== _pdf.LinkTarget.NONE) {
return;
}
_pdf.PDFJS.externalLinkTarget = value;
@ -260,7 +261,7 @@ var PDFViewerApplication = { @@ -260,7 +261,7 @@ var PDFViewerApplication = {
_pdf.PDFJS.disableHistory = hashParams['disablehistory'] === 'true';
}
if ('webgl' in hashParams) {
_pdf.PDFJS.disableWebGL = hashParams['webgl'] !== 'true';
viewerPrefs['enableWebGL'] = hashParams['webgl'] === 'true';
}
if ('useonlycsszoom' in hashParams) {
_pdf.PDFJS.useOnlyCssZoom = hashParams['useonlycsszoom'] === 'true';
@ -271,7 +272,7 @@ var PDFViewerApplication = { @@ -271,7 +272,7 @@ var PDFViewerApplication = {
if ('textlayer' in hashParams) {
switch (hashParams['textlayer']) {
case 'off':
_pdf.PDFJS.disableTextLayer = true;
viewerPrefs['textLayerMode'] = _ui_utils.TextLayerMode.DISABLE;
break;
case 'visible':
case 'shadow':
@ -283,8 +284,7 @@ var PDFViewerApplication = { @@ -283,8 +284,7 @@ var PDFViewerApplication = {
}
if ('pdfbug' in hashParams) {
_pdf.PDFJS.pdfBug = true;
var pdfBug = hashParams['pdfbug'];
var enabled = pdfBug.split(',');
var enabled = hashParams['pdfbug'].split(',');
waitOn.push(loadAndEnablePDFBug(enabled));
}
if ('locale' in hashParams) {
@ -294,7 +294,7 @@ var PDFViewerApplication = { @@ -294,7 +294,7 @@ var PDFViewerApplication = {
return Promise.all(waitOn);
},
_initializeL10n: function _initializeL10n() {
this.l10n = this.externalServices.createL10n();
this.l10n = this.externalServices.createL10n({ locale: _pdf.PDFJS.locale });
return this.l10n.getDirection().then(function (dir) {
document.getElementsByTagName('html')[0].dir = dir;
});
@ -312,7 +312,11 @@ var PDFViewerApplication = { @@ -312,7 +312,11 @@ var PDFViewerApplication = {
var pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue();
pdfRenderingQueue.onIdle = _this2.cleanup.bind(_this2);
_this2.pdfRenderingQueue = pdfRenderingQueue;
var pdfLinkService = new _pdf_link_service.PDFLinkService({ eventBus: eventBus });
var pdfLinkService = new _pdf_link_service.PDFLinkService({
eventBus: eventBus,
externalLinkTarget: _pdf.PDFJS.externalLinkTarget,
externalLinkRel: _pdf.PDFJS.externalLinkRel
});
_this2.pdfLinkService = pdfLinkService;
var downloadManager = _this2.externalServices.createDownloadManager();
_this2.downloadManager = downloadManager;
@ -326,10 +330,14 @@ var PDFViewerApplication = { @@ -326,10 +330,14 @@ var PDFViewerApplication = {
linkService: pdfLinkService,
downloadManager: downloadManager,
renderer: viewerPrefs['renderer'],
enableWebGL: viewerPrefs['enableWebGL'],
l10n: _this2.l10n,
enhanceTextSelection: viewerPrefs['enhanceTextSelection'],
textLayerMode: viewerPrefs['textLayerMode'],
imageResourcesPath: _pdf.PDFJS.imageResourcesPath,
renderInteractiveForms: viewerPrefs['renderInteractiveForms'],
enablePrintAutoRotate: viewerPrefs['enablePrintAutoRotate']
enablePrintAutoRotate: viewerPrefs['enablePrintAutoRotate'],
useOnlyCssZoom: _pdf.PDFJS.useOnlyCssZoom,
maxCanvasPixels: _pdf.PDFJS.maxCanvasPixels
});
pdfRenderingQueue.setViewer(_this2.pdfViewer);
pdfLinkService.setViewer(_this2.pdfViewer);
@ -451,7 +459,7 @@ var PDFViewerApplication = { @@ -451,7 +459,7 @@ var PDFViewerApplication = {
if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) {
support = false;
}
if (support && _pdf.PDFJS.disableFullscreen === true) {
if (support && _viewer_compatibility.viewerCompatibilityParams['disableFullscreen'] === true) {
support = false;
}
return (0, _pdf.shadow)(this, 'supportsFullscreen', support);
@ -855,7 +863,7 @@ var PDFViewerApplication = { @@ -855,7 +863,7 @@ var PDFViewerApplication = {
_this6.documentInfo = info;
_this6.metadata = metadata;
_this6.contentDispositionFilename = contentDispositionFilename;
console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdf.version || '-') + (!_pdf.PDFJS.disableWebGL ? ' [WebGL]' : '') + ')');
console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdf.version || '-') + (_this6.viewerPrefs['enableWebGL'] ? ' [WebGL]' : '') + ')');
var pdfTitle = void 0;
if (metadata && metadata.has('dc:title')) {
var title = metadata.get('dc:title');
@ -1130,10 +1138,7 @@ function loadAndEnablePDFBug(enabledTabs) { @@ -1130,10 +1138,7 @@ function loadAndEnablePDFBug(enabledTabs) {
script.src = appConfig.debuggerScriptPath;
script.onload = function () {
PDFBug.enable(enabledTabs);
PDFBug.init({
PDFJS: _pdf.PDFJS,
OPS: _pdf.OPS
}, appConfig.mainContainer);
PDFBug.init({ OPS: _pdf.OPS }, appConfig.mainContainer);
resolve();
};
script.onerror = function () {
@ -1232,7 +1237,7 @@ function webViewerPageRendered(evt) { @@ -1232,7 +1237,7 @@ function webViewerPageRendered(evt) {
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex);
thumbnailView.setImage(pageView);
}
if (_pdf.PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) {
if (typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) {
Stats.add(pageNumber, pageView.stats);
}
if (pageView.error) {
@ -1445,7 +1450,7 @@ function webViewerPageChanging(evt) { @@ -1445,7 +1450,7 @@ function webViewerPageChanging(evt) {
if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) {
PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);
}
if (_pdf.PDFJS.pdfBug && typeof Stats !== 'undefined' && Stats.enabled) {
if (typeof Stats !== 'undefined' && Stats.enabled) {
var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);
if (pageView && pageView.stats) {
Stats.add(page, pageView.stats);

19
lib/web/base_viewer.js

@ -93,10 +93,15 @@ var BaseViewer = function () { @@ -93,10 +93,15 @@ var BaseViewer = function () {
this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
this.downloadManager = options.downloadManager || null;
this.removePageBorders = options.removePageBorders || false;
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.imageResourcesPath = options.imageResourcesPath || '';
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
this.maxCanvasPixels = options.maxCanvasPixels;
this.l10n = options.l10n || _ui_utils.NullL10n;
this.defaultRenderingQueue = !options.renderingQueue;
if (this.defaultRenderingQueue) {
@ -189,7 +194,7 @@ var BaseViewer = function () { @@ -189,7 +194,7 @@ var BaseViewer = function () {
var viewport = pdfPage.getViewport(scale * _ui_utils.CSS_UNITS);
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
var textLayerFactory = null;
if (!_pdf.PDFJS.disableTextLayer) {
if (_this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE) {
textLayerFactory = _this;
}
var pageView = new _pdf_page_view.PDFPageView({
@ -200,10 +205,14 @@ var BaseViewer = function () { @@ -200,10 +205,14 @@ var BaseViewer = function () {
defaultViewport: viewport.clone(),
renderingQueue: _this.renderingQueue,
textLayerFactory: textLayerFactory,
textLayerMode: _this.textLayerMode,
annotationLayerFactory: _this,
enhanceTextSelection: _this.enhanceTextSelection,
imageResourcesPath: _this.imageResourcesPath,
renderInteractiveForms: _this.renderInteractiveForms,
renderer: _this.renderer,
enableWebGL: _this.enableWebGL,
useOnlyCssZoom: _this.useOnlyCssZoom,
maxCanvasPixels: _this.maxCanvasPixels,
l10n: _this.l10n
});
bindOnAfterAndBeforeDraw(pageView);
@ -633,12 +642,14 @@ var BaseViewer = function () { @@ -633,12 +642,14 @@ var BaseViewer = function () {
}, {
key: 'createAnnotationLayerBuilder',
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
var renderInteractiveForms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _ui_utils.NullL10n;
var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n;
return new _annotation_layer_builder.AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
imageResourcesPath: imageResourcesPath,
renderInteractiveForms: renderInteractiveForms,
linkService: this.linkService,
downloadManager: this.downloadManager,

2
lib/web/chromecom.js

@ -312,7 +312,7 @@ ChromeExternalServices.createDownloadManager = function () { @@ -312,7 +312,7 @@ ChromeExternalServices.createDownloadManager = function () {
ChromeExternalServices.createPreferences = function () {
return new ChromePreferences();
};
ChromeExternalServices.createL10n = function () {
ChromeExternalServices.createL10n = function (options) {
return new _genericl10n.GenericL10n(navigator.language);
};
_app.PDFViewerApplication.externalServices = ChromeExternalServices;

1
lib/web/debugger.js

@ -444,7 +444,6 @@ var Stats = function Stats() { @@ -444,7 +444,6 @@ var Stats = function Stats() {
manager: null,
init: function init(pdfjsLib) {
this.panel.setAttribute('style', 'padding: 5px;');
pdfjsLib.PDFJS.enableStats = true;
},
enabled: false,

2
lib/web/firefoxcom.js

@ -281,7 +281,7 @@ _app.PDFViewerApplication.externalServices = { @@ -281,7 +281,7 @@ _app.PDFViewerApplication.externalServices = {
createPreferences: function createPreferences() {
return new FirefoxPreferences();
},
createL10n: function createL10n() {
createL10n: function createL10n(options) {
var mozL10n = document.mozL10n;
return new MozL10n(mozL10n);
},

6
lib/web/genericcom.js

@ -36,8 +36,6 @@ var _download_manager = require('./download_manager'); @@ -36,8 +36,6 @@ var _download_manager = require('./download_manager');
var _genericl10n = require('./genericl10n');
var _pdf = require('../pdf');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
@ -84,8 +82,8 @@ GenericExternalServices.createDownloadManager = function () { @@ -84,8 +82,8 @@ GenericExternalServices.createDownloadManager = function () {
GenericExternalServices.createPreferences = function () {
return new GenericPreferences();
};
GenericExternalServices.createL10n = function () {
return new _genericl10n.GenericL10n(_pdf.PDFJS.locale);
GenericExternalServices.createL10n = function (options) {
return new _genericl10n.GenericL10n(options.locale);
};
_app.PDFViewerApplication.externalServices = GenericExternalServices;
exports.GenericCom = GenericCom;

5
lib/web/interfaces.js

@ -144,8 +144,9 @@ var IPDFAnnotationLayerFactory = function () { @@ -144,8 +144,9 @@ var IPDFAnnotationLayerFactory = function () {
_createClass(IPDFAnnotationLayerFactory, [{
key: 'createAnnotationLayerBuilder',
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
var renderInteractiveForms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
}
}]);

11
lib/web/pdf_link_service.js

@ -39,11 +39,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons @@ -39,11 +39,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var PDFLinkService = function () {
function PDFLinkService() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
eventBus = _ref.eventBus;
eventBus = _ref.eventBus,
_ref$externalLinkTarg = _ref.externalLinkTarget,
externalLinkTarget = _ref$externalLinkTarg === undefined ? null : _ref$externalLinkTarg,
_ref$externalLinkRel = _ref.externalLinkRel,
externalLinkRel = _ref$externalLinkRel === undefined ? null : _ref$externalLinkRel;
_classCallCheck(this, PDFLinkService);
this.eventBus = eventBus || (0, _dom_events.getGlobalEventBus)();
this.externalLinkTarget = externalLinkTarget;
this.externalLinkRel = externalLinkRel;
this.baseUrl = null;
this.pdfDocument = null;
this.pdfViewer = null;
@ -373,6 +379,9 @@ function isValidExplicitDestination(dest) { @@ -373,6 +379,9 @@ function isValidExplicitDestination(dest) {
var SimpleLinkService = function () {
function SimpleLinkService() {
_classCallCheck(this, SimpleLinkService);
this.externalLinkTarget = null;
this.externalLinkRel = null;
}
_createClass(SimpleLinkService, [{

34
lib/web/pdf_outline_viewer.js

@ -66,33 +66,41 @@ var PDFOutlineViewer = function () { @@ -66,33 +66,41 @@ var PDFOutlineViewer = function () {
}
}, {
key: '_bindLink',
value: function _bindLink(element, item) {
value: function _bindLink(element, _ref2) {
var _this = this;
if (item.url) {
var url = _ref2.url,
newWindow = _ref2.newWindow,
dest = _ref2.dest;
var linkService = this.linkService;
if (url) {
(0, _pdf.addLinkAttributes)(element, {
url: item.url,
target: item.newWindow ? _pdf.PDFJS.LinkTarget.BLANK : undefined
url: url,
target: newWindow ? _pdf.LinkTarget.BLANK : linkService.externalLinkTarget,
rel: linkService.externalLinkRel
});
return;
}
var destination = item.dest;
element.href = this.linkService.getDestinationHash(destination);
element.href = this.linkService.getDestinationHash(dest);
element.onclick = function () {
if (destination) {
_this.linkService.navigateTo(destination);
if (dest) {
_this.linkService.navigateTo(dest);
}
return false;
};
}
}, {
key: '_setStyles',
value: function _setStyles(element, item) {
value: function _setStyles(element, _ref3) {
var bold = _ref3.bold,
italic = _ref3.italic;
var styleStr = '';
if (item.bold) {
if (bold) {
styleStr += 'font-weight: bold;';
}
if (item.italic) {
if (italic) {
styleStr += 'font-style: italic;';
}
if (styleStr) {
@ -135,8 +143,8 @@ var PDFOutlineViewer = function () { @@ -135,8 +143,8 @@ var PDFOutlineViewer = function () {
}
}, {
key: 'render',
value: function render(_ref2) {
var outline = _ref2.outline;
value: function render(_ref4) {
var outline = _ref4.outline;
var outlineCount = 0;
if (this.outline) {

29
lib/web/pdf_page_view.js

@ -36,8 +36,12 @@ var _dom_events = require('./dom_events'); @@ -36,8 +36,12 @@ var _dom_events = require('./dom_events');
var _pdf_rendering_queue = require('./pdf_rendering_queue');
var _viewer_compatibility = require('./viewer_compatibility');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var MAX_CANVAS_PIXELS = _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216;
var PDFPageView = function () {
function PDFPageView(options) {
_classCallCheck(this, PDFPageView);
@ -53,13 +57,17 @@ var PDFPageView = function () { @@ -53,13 +57,17 @@ var PDFPageView = function () {
this.viewport = defaultViewport;
this.pdfPageRotate = defaultViewport.rotation;
this.hasRestrictedScaling = false;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
this.imageResourcesPath = options.imageResourcesPath || '';
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
this.eventBus = options.eventBus || (0, _dom_events.getGlobalEventBus)();
this.renderingQueue = options.renderingQueue;
this.textLayerFactory = options.textLayerFactory;
this.annotationLayerFactory = options.annotationLayerFactory;
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.l10n = options.l10n || _ui_utils.NullL10n;
this.paintTask = null;
this.paintedViewportMap = new WeakMap();
@ -181,14 +189,14 @@ var PDFPageView = function () { @@ -181,14 +189,14 @@ var PDFPageView = function () {
return;
}
var isScalingRestricted = false;
if (this.canvas && _pdf.PDFJS.maxCanvasPixels > 0) {
if (this.canvas && this.maxCanvasPixels > 0) {
var outputScale = this.outputScale;
if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > _pdf.PDFJS.maxCanvasPixels) {
if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) {
isScalingRestricted = true;
}
}
if (this.canvas) {
if (_pdf.PDFJS.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
this.cssTransform(this.canvas, true);
this.eventBus.dispatch('pagerendered', {
source: this,
@ -316,7 +324,7 @@ var PDFPageView = function () { @@ -316,7 +324,7 @@ var PDFPageView = function () {
div.appendChild(canvasWrapper);
}
var textLayer = null;
if (this.textLayerFactory) {
if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) {
var textLayerDiv = document.createElement('div');
textLayerDiv.className = 'textLayer';
textLayerDiv.style.width = canvasWrapper.style.width;
@ -326,7 +334,7 @@ var PDFPageView = function () { @@ -326,7 +334,7 @@ var PDFPageView = function () {
} else {
div.appendChild(textLayerDiv);
}
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.enhanceTextSelection);
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE);
}
this.textLayer = textLayer;
var renderContinueCallback = null;
@ -388,7 +396,7 @@ var PDFPageView = function () { @@ -388,7 +396,7 @@ var PDFPageView = function () {
});
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.renderInteractiveForms, this.l10n);
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n);
}
this.annotationLayer.render(this.viewport, 'display');
}
@ -428,15 +436,15 @@ var PDFPageView = function () { @@ -428,15 +436,15 @@ var PDFPageView = function () {
var ctx = canvas.getContext('2d', { alpha: false });
var outputScale = (0, _ui_utils.getOutputScale)(ctx);
this.outputScale = outputScale;
if (_pdf.PDFJS.useOnlyCssZoom) {
if (this.useOnlyCssZoom) {
var actualSizeViewport = viewport.clone({ scale: _ui_utils.CSS_UNITS });
outputScale.sx *= actualSizeViewport.width / viewport.width;
outputScale.sy *= actualSizeViewport.height / viewport.height;
outputScale.scaled = true;
}
if (_pdf.PDFJS.maxCanvasPixels > 0) {
if (this.maxCanvasPixels > 0) {
var pixelsInViewport = viewport.width * viewport.height;
var maxScale = Math.sqrt(_pdf.PDFJS.maxCanvasPixels / pixelsInViewport);
var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
outputScale.sx = maxScale;
outputScale.sy = maxScale;
@ -458,6 +466,7 @@ var PDFPageView = function () { @@ -458,6 +466,7 @@ var PDFPageView = function () {
canvasContext: ctx,
transform: transform,
viewport: this.viewport,
enableWebGL: this.enableWebGL,
renderInteractiveForms: this.renderInteractiveForms
};
var renderTask = this.pdfPage.render(renderContext);

3
lib/web/preferences.js

@ -48,10 +48,9 @@ function getDefaultPreferences() { @@ -48,10 +48,9 @@ function getDefaultPreferences() {
"disableStream": false,
"disableAutoFetch": false,
"disableFontFace": false,
"disableTextLayer": false,
"textLayerMode": 1,
"useOnlyCssZoom": false,
"externalLinkTarget": 0,
"enhanceTextSelection": false,
"renderer": "canvas",
"renderInteractiveForms": false,
"enablePrintAutoRotate": false,

12
lib/web/ui_utils.js

@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -53,6 +53,11 @@ var RendererType = { @@ -53,6 +53,11 @@ var RendererType = {
CANVAS: 'canvas',
SVG: 'svg'
};
var TextLayerMode = {
DISABLE: 0,
ENABLE: 1,
ENABLE_ENHANCE: 2
};
function formatL10nValue(text, args) {
if (!args) {
return text;
@ -72,13 +77,11 @@ var NullL10n = { @@ -72,13 +77,11 @@ var NullL10n = {
return Promise.resolve();
}
};
_pdf.PDFJS.disableFullscreen = _pdf.PDFJS.disableFullscreen === undefined ? false : _pdf.PDFJS.disableFullscreen;
_pdf.PDFJS.useOnlyCssZoom = _pdf.PDFJS.useOnlyCssZoom === undefined ? false : _pdf.PDFJS.useOnlyCssZoom;
_pdf.PDFJS.maxCanvasPixels = _pdf.PDFJS.maxCanvasPixels === undefined ? 16777216 : _pdf.PDFJS.maxCanvasPixels;
_pdf.PDFJS.disableHistory = _pdf.PDFJS.disableHistory === undefined ? false : _pdf.PDFJS.disableHistory;
_pdf.PDFJS.disableTextLayer = _pdf.PDFJS.disableTextLayer === undefined ? false : _pdf.PDFJS.disableTextLayer;
{
_pdf.PDFJS.locale = _pdf.PDFJS.locale === undefined && typeof navigator !== 'undefined' ? navigator.language : _pdf.PDFJS.locale;
_pdf.PDFJS.locale = (_pdf.PDFJS.locale === undefined && typeof navigator !== 'undefined' ? navigator.language : _pdf.PDFJS.locale) || 'en-US';
}
function getOutputScale(ctx) {
var devicePixelRatio = window.devicePixelRatio || 1;
@ -533,6 +536,7 @@ exports.isFileSchema = isFileSchema; @@ -533,6 +536,7 @@ exports.isFileSchema = isFileSchema;
exports.cloneObj = cloneObj;
exports.PresentationModeState = PresentationModeState;
exports.RendererType = RendererType;
exports.TextLayerMode = TextLayerMode;
exports.mozL10n = mozL10n;
exports.NullL10n = NullL10n;
exports.EventBus = EventBus;

45
lib/web/viewer_compatibility.js

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2017 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var compatibilityParams = Object.create(null);
{
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
var isAndroid = /Android/.test(userAgent);
var isIE = /Trident/.test(userAgent);
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
(function checkFullscreenSupport() {
if (isIE && window.parent !== window) {
compatibilityParams.disableFullscreen = true;
}
})();
(function checkCanvasSizeLimitation() {
if (isIOS || isAndroid) {
compatibilityParams.maxCanvasPixels = 5242880;
}
})();
}
var viewerCompatibilityParams = Object.freeze(compatibilityParams);
exports.viewerCompatibilityParams = viewerCompatibilityParams;

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "pdfjs-dist",
"version": "2.0.363",
"version": "2.0.374",
"main": "build/pdf.js",
"description": "Generic build of Mozilla's PDF.js library.",
"keywords": [

117
web/pdf_viewer.js

@ -120,7 +120,7 @@ module.exports = pdfjsLib; @@ -120,7 +120,7 @@ module.exports = pdfjsLib;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
exports.waitOnEventOrTimeout = exports.WaitOnType = exports.localized = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.mozL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@ -149,6 +149,11 @@ var RendererType = { @@ -149,6 +149,11 @@ var RendererType = {
CANVAS: 'canvas',
SVG: 'svg'
};
var TextLayerMode = {
DISABLE: 0,
ENABLE: 1,
ENABLE_ENHANCE: 2
};
function formatL10nValue(text, args) {
if (!args) {
return text;
@ -168,13 +173,11 @@ var NullL10n = { @@ -168,13 +173,11 @@ var NullL10n = {
return Promise.resolve();
}
};
_pdfjsLib.PDFJS.disableFullscreen = _pdfjsLib.PDFJS.disableFullscreen === undefined ? false : _pdfjsLib.PDFJS.disableFullscreen;
_pdfjsLib.PDFJS.useOnlyCssZoom = _pdfjsLib.PDFJS.useOnlyCssZoom === undefined ? false : _pdfjsLib.PDFJS.useOnlyCssZoom;
_pdfjsLib.PDFJS.maxCanvasPixels = _pdfjsLib.PDFJS.maxCanvasPixels === undefined ? 16777216 : _pdfjsLib.PDFJS.maxCanvasPixels;
_pdfjsLib.PDFJS.disableHistory = _pdfjsLib.PDFJS.disableHistory === undefined ? false : _pdfjsLib.PDFJS.disableHistory;
_pdfjsLib.PDFJS.disableTextLayer = _pdfjsLib.PDFJS.disableTextLayer === undefined ? false : _pdfjsLib.PDFJS.disableTextLayer;
{
_pdfjsLib.PDFJS.locale = _pdfjsLib.PDFJS.locale === undefined && typeof navigator !== 'undefined' ? navigator.language : _pdfjsLib.PDFJS.locale;
_pdfjsLib.PDFJS.locale = (_pdfjsLib.PDFJS.locale === undefined && typeof navigator !== 'undefined' ? navigator.language : _pdfjsLib.PDFJS.locale) || 'en-US';
}
function getOutputScale(ctx) {
var devicePixelRatio = window.devicePixelRatio || 1;
@ -629,6 +632,7 @@ exports.isFileSchema = isFileSchema; @@ -629,6 +632,7 @@ exports.isFileSchema = isFileSchema;
exports.cloneObj = cloneObj;
exports.PresentationModeState = PresentationModeState;
exports.RendererType = RendererType;
exports.TextLayerMode = TextLayerMode;
exports.mozL10n = mozL10n;
exports.NullL10n = NullL10n;
exports.EventBus = EventBus;
@ -796,11 +800,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons @@ -796,11 +800,17 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var PDFLinkService = function () {
function PDFLinkService() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
eventBus = _ref.eventBus;
eventBus = _ref.eventBus,
_ref$externalLinkTarg = _ref.externalLinkTarget,
externalLinkTarget = _ref$externalLinkTarg === undefined ? null : _ref$externalLinkTarg,
_ref$externalLinkRel = _ref.externalLinkRel,
externalLinkRel = _ref$externalLinkRel === undefined ? null : _ref$externalLinkRel;
_classCallCheck(this, PDFLinkService);
this.eventBus = eventBus || (0, _dom_events.getGlobalEventBus)();
this.externalLinkTarget = externalLinkTarget;
this.externalLinkRel = externalLinkRel;
this.baseUrl = null;
this.pdfDocument = null;
this.pdfViewer = null;
@ -1130,6 +1140,9 @@ function isValidExplicitDestination(dest) { @@ -1130,6 +1140,9 @@ function isValidExplicitDestination(dest) {
var SimpleLinkService = function () {
function SimpleLinkService() {
_classCallCheck(this, SimpleLinkService);
this.externalLinkTarget = null;
this.externalLinkRel = null;
}
_createClass(SimpleLinkService, [{
@ -1209,6 +1222,8 @@ var AnnotationLayerBuilder = function () { @@ -1209,6 +1222,8 @@ var AnnotationLayerBuilder = function () {
pdfPage = _ref.pdfPage,
linkService = _ref.linkService,
downloadManager = _ref.downloadManager,
_ref$imageResourcesPa = _ref.imageResourcesPath,
imageResourcesPath = _ref$imageResourcesPa === undefined ? '' : _ref$imageResourcesPa,
_ref$renderInteractiv = _ref.renderInteractiveForms,
renderInteractiveForms = _ref$renderInteractiv === undefined ? false : _ref$renderInteractiv,
_ref$l10n = _ref.l10n,
@ -1220,6 +1235,7 @@ var AnnotationLayerBuilder = function () { @@ -1220,6 +1235,7 @@ var AnnotationLayerBuilder = function () {
this.pdfPage = pdfPage;
this.linkService = linkService;
this.downloadManager = downloadManager;
this.imageResourcesPath = imageResourcesPath;
this.renderInteractiveForms = renderInteractiveForms;
this.l10n = l10n;
this.div = null;
@ -1242,6 +1258,7 @@ var AnnotationLayerBuilder = function () { @@ -1242,6 +1258,7 @@ var AnnotationLayerBuilder = function () {
div: _this.div,
annotations: annotations,
page: _this.pdfPage,
imageResourcesPath: _this.imageResourcesPath,
renderInteractiveForms: _this.renderInteractiveForms,
linkService: _this.linkService,
downloadManager: _this.downloadManager
@ -1287,12 +1304,14 @@ var DefaultAnnotationLayerFactory = function () { @@ -1287,12 +1304,14 @@ var DefaultAnnotationLayerFactory = function () {
_createClass(DefaultAnnotationLayerFactory, [{
key: 'createAnnotationLayerBuilder',
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
var renderInteractiveForms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _ui_utils.NullL10n;
var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n;
return new AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
imageResourcesPath: imageResourcesPath,
renderInteractiveForms: renderInteractiveForms,
linkService: new _pdf_link_service.SimpleLinkService(),
l10n: l10n
@ -1672,8 +1691,12 @@ var _dom_events = __w_pdfjs_require__(2); @@ -1672,8 +1691,12 @@ var _dom_events = __w_pdfjs_require__(2);
var _pdf_rendering_queue = __w_pdfjs_require__(7);
var _viewer_compatibility = __w_pdfjs_require__(15);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var MAX_CANVAS_PIXELS = _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216;
var PDFPageView = function () {
function PDFPageView(options) {
_classCallCheck(this, PDFPageView);
@ -1689,13 +1712,17 @@ var PDFPageView = function () { @@ -1689,13 +1712,17 @@ var PDFPageView = function () {
this.viewport = defaultViewport;
this.pdfPageRotate = defaultViewport.rotation;
this.hasRestrictedScaling = false;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
this.imageResourcesPath = options.imageResourcesPath || '';
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
this.eventBus = options.eventBus || (0, _dom_events.getGlobalEventBus)();
this.renderingQueue = options.renderingQueue;
this.textLayerFactory = options.textLayerFactory;
this.annotationLayerFactory = options.annotationLayerFactory;
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.l10n = options.l10n || _ui_utils.NullL10n;
this.paintTask = null;
this.paintedViewportMap = new WeakMap();
@ -1817,14 +1844,14 @@ var PDFPageView = function () { @@ -1817,14 +1844,14 @@ var PDFPageView = function () {
return;
}
var isScalingRestricted = false;
if (this.canvas && _pdfjsLib.PDFJS.maxCanvasPixels > 0) {
if (this.canvas && this.maxCanvasPixels > 0) {
var outputScale = this.outputScale;
if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > _pdfjsLib.PDFJS.maxCanvasPixels) {
if ((Math.floor(this.viewport.width) * outputScale.sx | 0) * (Math.floor(this.viewport.height) * outputScale.sy | 0) > this.maxCanvasPixels) {
isScalingRestricted = true;
}
}
if (this.canvas) {
if (_pdfjsLib.PDFJS.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
if (this.useOnlyCssZoom || this.hasRestrictedScaling && isScalingRestricted) {
this.cssTransform(this.canvas, true);
this.eventBus.dispatch('pagerendered', {
source: this,
@ -1952,7 +1979,7 @@ var PDFPageView = function () { @@ -1952,7 +1979,7 @@ var PDFPageView = function () {
div.appendChild(canvasWrapper);
}
var textLayer = null;
if (this.textLayerFactory) {
if (this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE && this.textLayerFactory) {
var textLayerDiv = document.createElement('div');
textLayerDiv.className = 'textLayer';
textLayerDiv.style.width = canvasWrapper.style.width;
@ -1962,7 +1989,7 @@ var PDFPageView = function () { @@ -1962,7 +1989,7 @@ var PDFPageView = function () {
} else {
div.appendChild(textLayerDiv);
}
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.enhanceTextSelection);
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport, this.textLayerMode === _ui_utils.TextLayerMode.ENABLE_ENHANCE);
}
this.textLayer = textLayer;
var renderContinueCallback = null;
@ -2024,7 +2051,7 @@ var PDFPageView = function () { @@ -2024,7 +2051,7 @@ var PDFPageView = function () {
});
if (this.annotationLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.renderInteractiveForms, this.l10n);
this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n);
}
this.annotationLayer.render(this.viewport, 'display');
}
@ -2064,15 +2091,15 @@ var PDFPageView = function () { @@ -2064,15 +2091,15 @@ var PDFPageView = function () {
var ctx = canvas.getContext('2d', { alpha: false });
var outputScale = (0, _ui_utils.getOutputScale)(ctx);
this.outputScale = outputScale;
if (_pdfjsLib.PDFJS.useOnlyCssZoom) {
if (this.useOnlyCssZoom) {
var actualSizeViewport = viewport.clone({ scale: _ui_utils.CSS_UNITS });
outputScale.sx *= actualSizeViewport.width / viewport.width;
outputScale.sy *= actualSizeViewport.height / viewport.height;
outputScale.scaled = true;
}
if (_pdfjsLib.PDFJS.maxCanvasPixels > 0) {
if (this.maxCanvasPixels > 0) {
var pixelsInViewport = viewport.width * viewport.height;
var maxScale = Math.sqrt(_pdfjsLib.PDFJS.maxCanvasPixels / pixelsInViewport);
var maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);
if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
outputScale.sx = maxScale;
outputScale.sy = maxScale;
@ -2094,6 +2121,7 @@ var PDFPageView = function () { @@ -2094,6 +2121,7 @@ var PDFPageView = function () {
canvasContext: ctx,
transform: transform,
viewport: this.viewport,
enableWebGL: this.enableWebGL,
renderInteractiveForms: this.renderInteractiveForms
};
var renderTask = this.pdfPage.render(renderContext);
@ -2394,10 +2422,15 @@ var BaseViewer = function () { @@ -2394,10 +2422,15 @@ var BaseViewer = function () {
this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
this.downloadManager = options.downloadManager || null;
this.removePageBorders = options.removePageBorders || false;
this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE;
this.enhanceTextSelection = options.enhanceTextSelection || false;
this.imageResourcesPath = options.imageResourcesPath || '';
this.renderInteractiveForms = options.renderInteractiveForms || false;
this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;
this.renderer = options.renderer || _ui_utils.RendererType.CANVAS;
this.enableWebGL = options.enableWebGL || false;
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
this.maxCanvasPixels = options.maxCanvasPixels;
this.l10n = options.l10n || _ui_utils.NullL10n;
this.defaultRenderingQueue = !options.renderingQueue;
if (this.defaultRenderingQueue) {
@ -2490,7 +2523,7 @@ var BaseViewer = function () { @@ -2490,7 +2523,7 @@ var BaseViewer = function () {
var viewport = pdfPage.getViewport(scale * _ui_utils.CSS_UNITS);
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
var textLayerFactory = null;
if (!_pdfjsLib.PDFJS.disableTextLayer) {
if (_this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE) {
textLayerFactory = _this;
}
var pageView = new _pdf_page_view.PDFPageView({
@ -2501,10 +2534,14 @@ var BaseViewer = function () { @@ -2501,10 +2534,14 @@ var BaseViewer = function () {
defaultViewport: viewport.clone(),
renderingQueue: _this.renderingQueue,
textLayerFactory: textLayerFactory,
textLayerMode: _this.textLayerMode,
annotationLayerFactory: _this,
enhanceTextSelection: _this.enhanceTextSelection,
imageResourcesPath: _this.imageResourcesPath,
renderInteractiveForms: _this.renderInteractiveForms,
renderer: _this.renderer,
enableWebGL: _this.enableWebGL,
useOnlyCssZoom: _this.useOnlyCssZoom,
maxCanvasPixels: _this.maxCanvasPixels,
l10n: _this.l10n
});
bindOnAfterAndBeforeDraw(pageView);
@ -2934,12 +2971,14 @@ var BaseViewer = function () { @@ -2934,12 +2971,14 @@ var BaseViewer = function () {
}, {
key: 'createAnnotationLayerBuilder',
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
var renderInteractiveForms = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var l10n = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _ui_utils.NullL10n;
var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n;
return new _annotation_layer_builder.AnnotationLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
imageResourcesPath: imageResourcesPath,
renderInteractiveForms: renderInteractiveForms,
linkService: this.linkService,
downloadManager: this.downloadManager,
@ -3147,9 +3186,9 @@ var _pdfjs2 = _interopRequireDefault(_pdfjs); @@ -3147,9 +3186,9 @@ var _pdfjs2 = _interopRequireDefault(_pdfjs);
var _pdf_page_view = __w_pdfjs_require__(6);
var _pdf_single_page_viewer = __w_pdfjs_require__(15);
var _pdf_single_page_viewer = __w_pdfjs_require__(16);
var _pdf_viewer = __w_pdfjs_require__(16);
var _pdf_viewer = __w_pdfjs_require__(17);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@ -4940,6 +4979,36 @@ exports.isDestArraysEqual = isDestArraysEqual; @@ -4940,6 +4979,36 @@ exports.isDestArraysEqual = isDestArraysEqual;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var compatibilityParams = Object.create(null);
{
var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || '';
var isAndroid = /Android/.test(userAgent);
var isIE = /Trident/.test(userAgent);
var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
(function checkFullscreenSupport() {
if (isIE && window.parent !== window) {
compatibilityParams.disableFullscreen = true;
}
})();
(function checkCanvasSizeLimitation() {
if (isIOS || isAndroid) {
compatibilityParams.maxCanvasPixels = 5242880;
}
})();
}
var viewerCompatibilityParams = Object.freeze(compatibilityParams);
exports.viewerCompatibilityParams = viewerCompatibilityParams;
/***/ }),
/* 16 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -5097,7 +5166,7 @@ var PDFSinglePageViewer = function (_BaseViewer) { @@ -5097,7 +5166,7 @@ var PDFSinglePageViewer = function (_BaseViewer) {
exports.PDFSinglePageViewer = PDFSinglePageViewer;
/***/ }),
/* 16 */
/* 17 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";

2
web/pdf_viewer.js.map

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save