Browse Source

PDF.js version 2.0.279 - See mozilla/pdf.js@75dc2bbd359990ebb1c1484f204acf66c3cb8221

master v2.0.279
pdfjsbot 7 years ago
parent
commit
45b01e3b7b
  1. 2
      bower.json
  2. 266
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 264
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 2
      build/pdf.min.js
  7. 6
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 2
      build/pdf.worker.min.js
  10. 2
      lib/core/worker.js
  11. 23
      lib/display/api.js
  12. 14
      lib/display/fetch_stream.js
  13. 4
      lib/display/global.js
  14. 12
      lib/display/network.js
  15. 15
      lib/display/network_utils.js
  16. 14
      lib/display/node_stream.js
  17. 4
      lib/display/transport_stream.js
  18. 4
      lib/pdf.js
  19. 4
      lib/pdf.worker.js
  20. 1
      lib/test/unit/api_spec.js
  21. 67
      lib/test/unit/network_utils_spec.js
  22. 12
      lib/web/app.js
  23. 18
      lib/web/pdf_document_properties.js
  24. 2
      package.json

2
bower.json

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

266
build/pdf.combined.js

@ -2706,8 +2706,8 @@ if (typeof __g == 'number') __g = global; @@ -2706,8 +2706,8 @@ if (typeof __g == 'number') __g = global;
var global = __w_pdfjs_require__(5);
var core = __w_pdfjs_require__(7);
var hide = __w_pdfjs_require__(13);
var redefine = __w_pdfjs_require__(10);
var ctx = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var PROTOTYPE = 'prototype';
var $export = function $export(type, name, source) {
var IS_FORCED = type & $export.F;
@ -2782,72 +2782,6 @@ module.exports = function (it, key) { @@ -2782,72 +2782,6 @@ module.exports = function (it, key) {
"use strict";
var global = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(13);
var has = __w_pdfjs_require__(9);
var SRC = __w_pdfjs_require__(25)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(7).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(18);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 12 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -3354,6 +3288,72 @@ exports.SimpleXMLParser = SimpleXMLParser; @@ -3354,6 +3288,72 @@ exports.SimpleXMLParser = SimpleXMLParser;
exports.StatTimer = StatTimer;
exports.DummyStatTimer = DummyStatTimer;
/***/ }),
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var global = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(13);
var has = __w_pdfjs_require__(9);
var SRC = __w_pdfjs_require__(25)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(7).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 12 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(18);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __w_pdfjs_require__) {
@ -4516,7 +4516,7 @@ module.exports = function (it, tag, stat) { @@ -4516,7 +4516,7 @@ module.exports = function (it, tag, stat) {
"use strict";
var ctx = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var call = __w_pdfjs_require__(106);
var isArrayIter = __w_pdfjs_require__(107);
var anObject = __w_pdfjs_require__(8);
@ -5697,7 +5697,7 @@ module.exports.f = function (C) { @@ -5697,7 +5697,7 @@ module.exports.f = function (C) {
"use strict";
var redefine = __w_pdfjs_require__(10);
var redefine = __w_pdfjs_require__(11);
module.exports = function (target, src, safe) {
for (var key in src) {
redefine(target, key, src[key], safe);
@ -10925,10 +10925,12 @@ exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode; @@ -10925,10 +10925,12 @@ exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.createResponseStatusError = undefined;
exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.extractFilenameFromHeader = exports.createResponseStatusError = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
function validateRangeRequestCapabilities(_ref) {
var getResponseHeader = _ref.getResponseHeader,
isHttp = _ref.isHttp,
@ -10961,6 +10963,16 @@ function validateRangeRequestCapabilities(_ref) { @@ -10961,6 +10963,16 @@ function validateRangeRequestCapabilities(_ref) {
returnValues.allowRangeRequests = true;
return returnValues;
}
function extractFilenameFromHeader(getResponseHeader) {
var contentDisposition = getResponseHeader('Content-Disposition');
if (contentDisposition) {
var parts = /.+;\s*filename=(?:'|")(.+\.pdf)(?:'|")/gi.exec(contentDisposition);
if (parts !== null && parts.length > 1) {
return (0, _dom_utils.getFilenameFromUrl)(parts[1]);
}
}
return null;
}
function createResponseStatusError(status, url) {
if (status === 404 || status === 0 && /^file:/.test(url)) {
return new _util.MissingPDFException('Missing PDF "' + url + '".');
@ -10971,6 +10983,7 @@ function validateResponseStatus(status) { @@ -10971,6 +10983,7 @@ function validateResponseStatus(status) {
return status === 200 || status === 206;
}
exports.createResponseStatusError = createResponseStatusError;
exports.extractFilenameFromHeader = extractFilenameFromHeader;
exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
exports.validateResponseStatus = validateResponseStatus;
@ -11081,7 +11094,7 @@ var classof = __w_pdfjs_require__(38); @@ -11081,7 +11094,7 @@ var classof = __w_pdfjs_require__(38);
var test = {};
test[__w_pdfjs_require__(4)('toStringTag')] = 'z';
if (test + '' != '[object z]') {
__w_pdfjs_require__(10)(Object.prototype, 'toString', function toString() {
__w_pdfjs_require__(11)(Object.prototype, 'toString', function toString() {
return '[object ' + classof(this) + ']';
}, true);
}
@ -11095,7 +11108,7 @@ if (test + '' != '[object z]') { @@ -11095,7 +11108,7 @@ if (test + '' != '[object z]') {
var LIBRARY = __w_pdfjs_require__(56);
var $export = __w_pdfjs_require__(6);
var redefine = __w_pdfjs_require__(10);
var redefine = __w_pdfjs_require__(11);
var hide = __w_pdfjs_require__(13);
var has = __w_pdfjs_require__(9);
var Iterators = __w_pdfjs_require__(21);
@ -11196,7 +11209,7 @@ module.exports = document && document.documentElement; @@ -11196,7 +11209,7 @@ module.exports = document && document.documentElement;
var $iterators = __w_pdfjs_require__(103);
var getKeys = __w_pdfjs_require__(26);
var redefine = __w_pdfjs_require__(10);
var redefine = __w_pdfjs_require__(11);
var global = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(13);
var Iterators = __w_pdfjs_require__(21);
@ -11276,7 +11289,7 @@ module.exports = function (O, D) { @@ -11276,7 +11289,7 @@ module.exports = function (O, D) {
"use strict";
var ctx = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var invoke = __w_pdfjs_require__(109);
var html = __w_pdfjs_require__(57);
var cel = __w_pdfjs_require__(30);
@ -11434,7 +11447,7 @@ module.exports = function (exec, skipClosing) { @@ -11434,7 +11447,7 @@ module.exports = function (exec, skipClosing) {
"use strict";
var ctx = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var IObject = __w_pdfjs_require__(32);
var toObject = __w_pdfjs_require__(39);
var toLength = __w_pdfjs_require__(34);
@ -11507,7 +11520,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol @@ -11507,7 +11520,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(12);
var _dom_utils = __w_pdfjs_require__(10);
var _font_loader = __w_pdfjs_require__(133);
@ -11628,7 +11641,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -11628,7 +11641,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.276';
var apiVersion = '2.0.279';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -12702,10 +12715,13 @@ var WorkerTransport = function WorkerTransportClosure() { @@ -12702,10 +12715,13 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetOutline', null);
},
getMetadata: function WorkerTransport_getMetadata() {
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) {
var _this13 = this;
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function (results) {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null
metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
contentDispositionFilename: _this13._fullReader ? _this13._fullReader.filename : null
};
});
},
@ -12713,17 +12729,17 @@ var WorkerTransport = function WorkerTransportClosure() { @@ -12713,17 +12729,17 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
var _this13 = this;
var _this14 = this;
this.messageHandler.sendWithPromise('Cleanup', null).then(function () {
for (var i = 0, ii = _this13.pageCache.length; i < ii; i++) {
var page = _this13.pageCache[i];
for (var i = 0, ii = _this14.pageCache.length; i < ii; i++) {
var page = _this14.pageCache[i];
if (page) {
page.cleanup();
}
}
_this13.commonObjs.clear();
_this13.fontLoader.clear();
_this14.commonObjs.clear();
_this14.fontLoader.clear();
});
}
};
@ -12920,8 +12936,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -12920,8 +12936,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.276';
exports.build = build = '96c573ad';
exports.version = version = '2.0.279';
exports.build = build = '75dc2bbd';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -12949,7 +12965,7 @@ var _createClass = function () { function defineProperties(target, props) { for @@ -12949,7 +12965,7 @@ var _createClass = function () { function defineProperties(target, props) { for
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(12);
var _dom_utils = __w_pdfjs_require__(10);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -24105,7 +24121,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec @@ -24105,7 +24121,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec
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; }; }();
var _dom_utils = __w_pdfjs_require__(12);
var _dom_utils = __w_pdfjs_require__(10);
var _util = __w_pdfjs_require__(0);
@ -25128,7 +25144,7 @@ exports.renderTextLayer = undefined; @@ -25128,7 +25144,7 @@ exports.renderTextLayer = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(12);
var _dom_utils = __w_pdfjs_require__(10);
var renderTextLayer = function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000;
@ -25679,7 +25695,7 @@ exports.SVGGraphics = undefined; @@ -25679,7 +25695,7 @@ exports.SVGGraphics = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(12);
var _dom_utils = __w_pdfjs_require__(10);
var _is_node = __w_pdfjs_require__(24);
@ -26718,14 +26734,14 @@ exports.SVGGraphics = SVGGraphics; @@ -26718,14 +26734,14 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.276';
var pdfjsBuild = '96c573ad';
var pdfjsVersion = '2.0.279';
var pdfjsBuild = '75dc2bbd';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(132);
var pdfjsDisplayAPI = __w_pdfjs_require__(66);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(78);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(77);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(12);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(10);
var pdfjsDisplaySVG = __w_pdfjs_require__(79);
{
var isNodeJS = __w_pdfjs_require__(24);
@ -27881,7 +27897,7 @@ module.exports = function (done, value) { @@ -27881,7 +27897,7 @@ module.exports = function (done, value) {
var LIBRARY = __w_pdfjs_require__(56);
var global = __w_pdfjs_require__(5);
var ctx = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var classof = __w_pdfjs_require__(38);
var $export = __w_pdfjs_require__(6);
var isObject = __w_pdfjs_require__(3);
@ -28370,7 +28386,7 @@ module.exports = __w_pdfjs_require__(7).WeakMap; @@ -28370,7 +28386,7 @@ module.exports = __w_pdfjs_require__(7).WeakMap;
var each = __w_pdfjs_require__(64)(0);
var redefine = __w_pdfjs_require__(10);
var redefine = __w_pdfjs_require__(11);
var meta = __w_pdfjs_require__(43);
var assign = __w_pdfjs_require__(119);
var weak = __w_pdfjs_require__(121);
@ -28611,7 +28627,7 @@ module.exports = { @@ -28611,7 +28627,7 @@ module.exports = {
var global = __w_pdfjs_require__(5);
var $export = __w_pdfjs_require__(6);
var redefine = __w_pdfjs_require__(10);
var redefine = __w_pdfjs_require__(11);
var redefineAll = __w_pdfjs_require__(42);
var meta = __w_pdfjs_require__(43);
var forOf = __w_pdfjs_require__(28);
@ -28724,7 +28740,7 @@ var check = function check(O, proto) { @@ -28724,7 +28740,7 @@ var check = function check(O, proto) {
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
try {
set = __w_pdfjs_require__(11)(Function.call, __w_pdfjs_require__(125).f(Object.prototype, '__proto__').set, 2);
set = __w_pdfjs_require__(12)(Function.call, __w_pdfjs_require__(125).f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch (e) {
@ -28809,7 +28825,7 @@ __w_pdfjs_require__(129)('WeakMap'); @@ -28809,7 +28825,7 @@ __w_pdfjs_require__(129)('WeakMap');
var $export = __w_pdfjs_require__(6);
var aFunction = __w_pdfjs_require__(18);
var ctx = __w_pdfjs_require__(11);
var ctx = __w_pdfjs_require__(12);
var forOf = __w_pdfjs_require__(28);
module.exports = function (COLLECTION) {
$export($export.S, COLLECTION, {
@ -31891,7 +31907,7 @@ Object.defineProperty(exports, "__esModule", { @@ -31891,7 +31907,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFJS = exports.globalScope = undefined;
var _dom_utils = __w_pdfjs_require__(12);
var _dom_utils = __w_pdfjs_require__(10);
var _util = __w_pdfjs_require__(0);
@ -31916,8 +31932,8 @@ if (!_global_scope2.default.PDFJS) { @@ -31916,8 +31932,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.276';
PDFJS.build = '96c573ad';
PDFJS.version = '2.0.279';
PDFJS.build = '75dc2bbd';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -34528,6 +34544,7 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { @@ -34528,6 +34544,7 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
function PDFDataTransportStreamReader(stream, queuedChunks) {
this._stream = stream;
this._done = false;
this._filename = null;
this._queuedChunks = queuedChunks || [];
this._requests = [];
this._headersReady = Promise.resolve();
@ -34552,6 +34569,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { @@ -34552,6 +34569,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
get headersReady() {
return this._headersReady;
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._stream._isRangeSupported;
},
@ -35284,7 +35304,7 @@ var WorkerMessageHandler = { @@ -35284,7 +35304,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.276';
var workerVersion = '2.0.279';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}
@ -52565,6 +52585,7 @@ var BaseFullReader = function () { @@ -52565,6 +52585,7 @@ var BaseFullReader = function () {
var source = stream.source;
this._contentLength = source.length;
this._loaded = 0;
this._filename = null;
this._disableRange = source.disableRange || false;
this._rangeChunkSize = source.rangeChunkSize;
if (!this._rangeChunkSize && !this._disableRange) {
@ -52656,6 +52677,11 @@ var BaseFullReader = function () { @@ -52656,6 +52677,11 @@ var BaseFullReader = function () {
get: function get() {
return this._headersCapability.promise;
}
}, {
key: 'filename',
get: function get() {
return this._filename;
}
}, {
key: 'contentLength',
get: function get() {
@ -52793,11 +52819,12 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) { @@ -52793,11 +52819,12 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) {
var handleResponse = function handleResponse(response) {
_this5._headersCapability.resolve();
_this5._setReadableStream(response);
var getResponseHeader = function getResponseHeader(name) {
return _this5._readableStream.headers[name.toLowerCase()];
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return _this5._readableStream.headers[name.toLowerCase()];
},
getResponseHeader: getResponseHeader,
isHttp: stream.isHttp,
rangeChunkSize: _this5._rangeChunkSize,
disableRange: _this5._disableRange
@ -52809,6 +52836,7 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) { @@ -52809,6 +52836,7 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) {
_this5._isRangeSupported = true;
}
_this5._contentLength = suggestedLength;
_this5._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
};
_this5._request = null;
if (_this5._url.protocol === 'http:') {
@ -52999,6 +53027,7 @@ var PDFFetchStreamReader = function () { @@ -52999,6 +53027,7 @@ var PDFFetchStreamReader = function () {
this._stream = stream;
this._reader = null;
this._loaded = 0;
this._filename = null;
var source = stream.source;
this._withCredentials = source.withCredentials;
this._contentLength = source.length;
@ -53025,11 +53054,12 @@ var PDFFetchStreamReader = function () { @@ -53025,11 +53054,12 @@ var PDFFetchStreamReader = function () {
}
_this._reader = response.body.getReader();
_this._headersCapability.resolve();
var getResponseHeader = function getResponseHeader(name) {
return response.headers.get(name);
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return response.headers.get(name);
},
getResponseHeader: getResponseHeader,
isHttp: _this._stream.isHttp,
rangeChunkSize: _this._rangeChunkSize,
disableRange: _this._disableRange
@ -53039,6 +53069,7 @@ var PDFFetchStreamReader = function () { @@ -53039,6 +53069,7 @@ var PDFFetchStreamReader = function () {
_this._contentLength = suggestedLength;
_this._isRangeSupported = allowRangeRequests;
_this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
if (!_this._isStreamingSupported && _this._isRangeSupported) {
_this.cancel(new _util.AbortException('streaming is disabled'));
}
@ -53089,6 +53120,11 @@ var PDFFetchStreamReader = function () { @@ -53089,6 +53120,11 @@ var PDFFetchStreamReader = function () {
get: function get() {
return this._headersCapability.promise;
}
}, {
key: 'filename',
get: function get() {
return this._filename;
}
}, {
key: 'contentLength',
get: function get() {
@ -53459,17 +53495,19 @@ function PDFNetworkStreamFullRequestReader(manager, source) { @@ -53459,17 +53495,19 @@ function PDFNetworkStreamFullRequestReader(manager, source) {
this._requests = [];
this._done = false;
this._storedError = undefined;
this._filename = null;
this.onProgress = null;
}
PDFNetworkStreamFullRequestReader.prototype = {
_onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
var fullRequestXhrId = this._fullRequestId;
var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
var getResponseHeader = function getResponseHeader(name) {
return fullRequestXhr.getResponseHeader(name);
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return fullRequestXhr.getResponseHeader(name);
},
getResponseHeader: getResponseHeader,
isHttp: this._manager.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange
@ -53481,6 +53519,7 @@ PDFNetworkStreamFullRequestReader.prototype = { @@ -53481,6 +53519,7 @@ PDFNetworkStreamFullRequestReader.prototype = {
if (allowRangeRequests) {
this._isRangeSupported = true;
}
this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
var networkManager = this._manager;
if (networkManager.isStreamingRequest(fullRequestXhrId)) {
this._isStreamingSupported = true;
@ -53535,6 +53574,9 @@ PDFNetworkStreamFullRequestReader.prototype = { @@ -53535,6 +53574,9 @@ PDFNetworkStreamFullRequestReader.prototype = {
});
}
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._isRangeSupported;
},

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

264
build/pdf.js

@ -1465,8 +1465,8 @@ if (typeof __g == 'number') __g = global; @@ -1465,8 +1465,8 @@ if (typeof __g == 'number') __g = global;
var global = __w_pdfjs_require__(3);
var core = __w_pdfjs_require__(5);
var hide = __w_pdfjs_require__(11);
var redefine = __w_pdfjs_require__(8);
var ctx = __w_pdfjs_require__(9);
var redefine = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var PROTOTYPE = 'prototype';
var $export = function $export(type, name, source) {
var IS_FORCED = type & $export.F;
@ -1541,72 +1541,6 @@ module.exports = function (it, key) { @@ -1541,72 +1541,6 @@ module.exports = function (it, key) {
"use strict";
var global = __w_pdfjs_require__(3);
var hide = __w_pdfjs_require__(11);
var has = __w_pdfjs_require__(7);
var SRC = __w_pdfjs_require__(20)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(5).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 9 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(16);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -2113,6 +2047,72 @@ exports.SimpleXMLParser = SimpleXMLParser; @@ -2113,6 +2047,72 @@ exports.SimpleXMLParser = SimpleXMLParser;
exports.StatTimer = StatTimer;
exports.DummyStatTimer = DummyStatTimer;
/***/ }),
/* 9 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var global = __w_pdfjs_require__(3);
var hide = __w_pdfjs_require__(11);
var has = __w_pdfjs_require__(7);
var SRC = __w_pdfjs_require__(20)('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__w_pdfjs_require__(5).inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/* 10 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
var aFunction = __w_pdfjs_require__(16);
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () {
return fn.apply(that, arguments);
};
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __w_pdfjs_require__) {
@ -2287,7 +2287,7 @@ module.exports = function (it, tag, stat) { @@ -2287,7 +2287,7 @@ module.exports = function (it, tag, stat) {
"use strict";
var ctx = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var call = __w_pdfjs_require__(89);
var isArrayIter = __w_pdfjs_require__(90);
var anObject = __w_pdfjs_require__(6);
@ -2506,7 +2506,7 @@ module.exports.f = function (C) { @@ -2506,7 +2506,7 @@ module.exports.f = function (C) {
"use strict";
var redefine = __w_pdfjs_require__(8);
var redefine = __w_pdfjs_require__(9);
module.exports = function (target, src, safe) {
for (var key in src) {
redefine(target, key, src[key], safe);
@ -2580,10 +2580,12 @@ var meta = module.exports = { @@ -2580,10 +2580,12 @@ var meta = module.exports = {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.createResponseStatusError = undefined;
exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.extractFilenameFromHeader = exports.createResponseStatusError = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(8);
function validateRangeRequestCapabilities(_ref) {
var getResponseHeader = _ref.getResponseHeader,
isHttp = _ref.isHttp,
@ -2616,6 +2618,16 @@ function validateRangeRequestCapabilities(_ref) { @@ -2616,6 +2618,16 @@ function validateRangeRequestCapabilities(_ref) {
returnValues.allowRangeRequests = true;
return returnValues;
}
function extractFilenameFromHeader(getResponseHeader) {
var contentDisposition = getResponseHeader('Content-Disposition');
if (contentDisposition) {
var parts = /.+;\s*filename=(?:'|")(.+\.pdf)(?:'|")/gi.exec(contentDisposition);
if (parts !== null && parts.length > 1) {
return (0, _dom_utils.getFilenameFromUrl)(parts[1]);
}
}
return null;
}
function createResponseStatusError(status, url) {
if (status === 404 || status === 0 && /^file:/.test(url)) {
return new _util.MissingPDFException('Missing PDF "' + url + '".');
@ -2626,6 +2638,7 @@ function validateResponseStatus(status) { @@ -2626,6 +2638,7 @@ function validateResponseStatus(status) {
return status === 200 || status === 206;
}
exports.createResponseStatusError = createResponseStatusError;
exports.extractFilenameFromHeader = extractFilenameFromHeader;
exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
exports.validateResponseStatus = validateResponseStatus;
@ -2736,7 +2749,7 @@ var classof = __w_pdfjs_require__(33); @@ -2736,7 +2749,7 @@ var classof = __w_pdfjs_require__(33);
var test = {};
test[__w_pdfjs_require__(2)('toStringTag')] = 'z';
if (test + '' != '[object z]') {
__w_pdfjs_require__(8)(Object.prototype, 'toString', function toString() {
__w_pdfjs_require__(9)(Object.prototype, 'toString', function toString() {
return '[object ' + classof(this) + ']';
}, true);
}
@ -2750,7 +2763,7 @@ if (test + '' != '[object z]') { @@ -2750,7 +2763,7 @@ if (test + '' != '[object z]') {
var LIBRARY = __w_pdfjs_require__(48);
var $export = __w_pdfjs_require__(4);
var redefine = __w_pdfjs_require__(8);
var redefine = __w_pdfjs_require__(9);
var hide = __w_pdfjs_require__(11);
var has = __w_pdfjs_require__(7);
var Iterators = __w_pdfjs_require__(19);
@ -2851,7 +2864,7 @@ module.exports = document && document.documentElement; @@ -2851,7 +2864,7 @@ module.exports = document && document.documentElement;
var $iterators = __w_pdfjs_require__(86);
var getKeys = __w_pdfjs_require__(21);
var redefine = __w_pdfjs_require__(8);
var redefine = __w_pdfjs_require__(9);
var global = __w_pdfjs_require__(3);
var hide = __w_pdfjs_require__(11);
var Iterators = __w_pdfjs_require__(19);
@ -2931,7 +2944,7 @@ module.exports = function (O, D) { @@ -2931,7 +2944,7 @@ module.exports = function (O, D) {
"use strict";
var ctx = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var invoke = __w_pdfjs_require__(92);
var html = __w_pdfjs_require__(49);
var cel = __w_pdfjs_require__(25);
@ -3089,7 +3102,7 @@ module.exports = function (exec, skipClosing) { @@ -3089,7 +3102,7 @@ module.exports = function (exec, skipClosing) {
"use strict";
var ctx = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var IObject = __w_pdfjs_require__(27);
var toObject = __w_pdfjs_require__(34);
var toLength = __w_pdfjs_require__(29);
@ -3162,7 +3175,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol @@ -3162,7 +3175,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(8);
var _font_loader = __w_pdfjs_require__(116);
@ -3308,7 +3321,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { @@ -3308,7 +3321,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
var apiVersion = '2.0.276';
var apiVersion = '2.0.279';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -4463,10 +4476,13 @@ var WorkerTransport = function WorkerTransportClosure() { @@ -4463,10 +4476,13 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetOutline', null);
},
getMetadata: function WorkerTransport_getMetadata() {
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) {
var _this14 = this;
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function (results) {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null
metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
contentDispositionFilename: _this14._fullReader ? _this14._fullReader.filename : null
};
});
},
@ -4474,17 +4490,17 @@ var WorkerTransport = function WorkerTransportClosure() { @@ -4474,17 +4490,17 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
var _this14 = this;
var _this15 = this;
this.messageHandler.sendWithPromise('Cleanup', null).then(function () {
for (var i = 0, ii = _this14.pageCache.length; i < ii; i++) {
var page = _this14.pageCache[i];
for (var i = 0, ii = _this15.pageCache.length; i < ii; i++) {
var page = _this15.pageCache[i];
if (page) {
page.cleanup();
}
}
_this14.commonObjs.clear();
_this14.fontLoader.clear();
_this15.commonObjs.clear();
_this15.fontLoader.clear();
});
}
};
@ -4681,8 +4697,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -4681,8 +4697,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.276';
exports.build = build = '96c573ad';
exports.version = version = '2.0.279';
exports.build = build = '75dc2bbd';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4710,7 +4726,7 @@ var _createClass = function () { function defineProperties(target, props) { for @@ -4710,7 +4726,7 @@ var _createClass = function () { function defineProperties(target, props) { for
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(8);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -4826,7 +4842,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec @@ -4826,7 +4842,7 @@ var _get = function get(object, property, receiver) { if (object === null) objec
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; }; }();
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(8);
var _util = __w_pdfjs_require__(0);
@ -5849,7 +5865,7 @@ exports.renderTextLayer = undefined; @@ -5849,7 +5865,7 @@ exports.renderTextLayer = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(8);
var renderTextLayer = function renderTextLayerClosure() {
var MAX_TEXT_DIVS_TO_RENDER = 100000;
@ -6401,7 +6417,7 @@ exports.SVGGraphics = undefined; @@ -6401,7 +6417,7 @@ exports.SVGGraphics = undefined;
var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(8);
var _is_node = __w_pdfjs_require__(24);
@ -7440,14 +7456,14 @@ exports.SVGGraphics = SVGGraphics; @@ -7440,14 +7456,14 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.276';
var pdfjsBuild = '96c573ad';
var pdfjsVersion = '2.0.279';
var pdfjsBuild = '75dc2bbd';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(115);
var pdfjsDisplayAPI = __w_pdfjs_require__(58);
var pdfjsDisplayTextLayer = __w_pdfjs_require__(61);
var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(60);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(10);
var pdfjsDisplayDOMUtils = __w_pdfjs_require__(8);
var pdfjsDisplaySVG = __w_pdfjs_require__(62);
{
var isNodeJS = __w_pdfjs_require__(24);
@ -8603,7 +8619,7 @@ module.exports = function (done, value) { @@ -8603,7 +8619,7 @@ module.exports = function (done, value) {
var LIBRARY = __w_pdfjs_require__(48);
var global = __w_pdfjs_require__(3);
var ctx = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var classof = __w_pdfjs_require__(33);
var $export = __w_pdfjs_require__(4);
var isObject = __w_pdfjs_require__(1);
@ -9092,7 +9108,7 @@ module.exports = __w_pdfjs_require__(5).WeakMap; @@ -9092,7 +9108,7 @@ module.exports = __w_pdfjs_require__(5).WeakMap;
var each = __w_pdfjs_require__(56)(0);
var redefine = __w_pdfjs_require__(8);
var redefine = __w_pdfjs_require__(9);
var meta = __w_pdfjs_require__(38);
var assign = __w_pdfjs_require__(102);
var weak = __w_pdfjs_require__(104);
@ -9333,7 +9349,7 @@ module.exports = { @@ -9333,7 +9349,7 @@ module.exports = {
var global = __w_pdfjs_require__(3);
var $export = __w_pdfjs_require__(4);
var redefine = __w_pdfjs_require__(8);
var redefine = __w_pdfjs_require__(9);
var redefineAll = __w_pdfjs_require__(37);
var meta = __w_pdfjs_require__(38);
var forOf = __w_pdfjs_require__(23);
@ -9446,7 +9462,7 @@ var check = function check(O, proto) { @@ -9446,7 +9462,7 @@ var check = function check(O, proto) {
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
try {
set = __w_pdfjs_require__(9)(Function.call, __w_pdfjs_require__(108).f(Object.prototype, '__proto__').set, 2);
set = __w_pdfjs_require__(10)(Function.call, __w_pdfjs_require__(108).f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch (e) {
@ -9531,7 +9547,7 @@ __w_pdfjs_require__(112)('WeakMap'); @@ -9531,7 +9547,7 @@ __w_pdfjs_require__(112)('WeakMap');
var $export = __w_pdfjs_require__(4);
var aFunction = __w_pdfjs_require__(16);
var ctx = __w_pdfjs_require__(9);
var ctx = __w_pdfjs_require__(10);
var forOf = __w_pdfjs_require__(23);
module.exports = function (COLLECTION) {
$export($export.S, COLLECTION, {
@ -12613,7 +12629,7 @@ Object.defineProperty(exports, "__esModule", { @@ -12613,7 +12629,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFJS = exports.globalScope = undefined;
var _dom_utils = __w_pdfjs_require__(10);
var _dom_utils = __w_pdfjs_require__(8);
var _util = __w_pdfjs_require__(0);
@ -12638,8 +12654,8 @@ if (!_global_scope2.default.PDFJS) { @@ -12638,8 +12654,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.276';
PDFJS.build = '96c573ad';
PDFJS.version = '2.0.279';
PDFJS.build = '75dc2bbd';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -15250,6 +15266,7 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { @@ -15250,6 +15266,7 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
function PDFDataTransportStreamReader(stream, queuedChunks) {
this._stream = stream;
this._done = false;
this._filename = null;
this._queuedChunks = queuedChunks || [];
this._requests = [];
this._headersReady = Promise.resolve();
@ -15274,6 +15291,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { @@ -15274,6 +15291,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
get headersReady() {
return this._headersReady;
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._stream._isRangeSupported;
},
@ -15883,6 +15903,7 @@ var BaseFullReader = function () { @@ -15883,6 +15903,7 @@ var BaseFullReader = function () {
var source = stream.source;
this._contentLength = source.length;
this._loaded = 0;
this._filename = null;
this._disableRange = source.disableRange || false;
this._rangeChunkSize = source.rangeChunkSize;
if (!this._rangeChunkSize && !this._disableRange) {
@ -15974,6 +15995,11 @@ var BaseFullReader = function () { @@ -15974,6 +15995,11 @@ var BaseFullReader = function () {
get: function get() {
return this._headersCapability.promise;
}
}, {
key: 'filename',
get: function get() {
return this._filename;
}
}, {
key: 'contentLength',
get: function get() {
@ -16111,11 +16137,12 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) { @@ -16111,11 +16137,12 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) {
var handleResponse = function handleResponse(response) {
_this5._headersCapability.resolve();
_this5._setReadableStream(response);
var getResponseHeader = function getResponseHeader(name) {
return _this5._readableStream.headers[name.toLowerCase()];
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return _this5._readableStream.headers[name.toLowerCase()];
},
getResponseHeader: getResponseHeader,
isHttp: stream.isHttp,
rangeChunkSize: _this5._rangeChunkSize,
disableRange: _this5._disableRange
@ -16127,6 +16154,7 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) { @@ -16127,6 +16154,7 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) {
_this5._isRangeSupported = true;
}
_this5._contentLength = suggestedLength;
_this5._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
};
_this5._request = null;
if (_this5._url.protocol === 'http:') {
@ -16317,6 +16345,7 @@ var PDFFetchStreamReader = function () { @@ -16317,6 +16345,7 @@ var PDFFetchStreamReader = function () {
this._stream = stream;
this._reader = null;
this._loaded = 0;
this._filename = null;
var source = stream.source;
this._withCredentials = source.withCredentials;
this._contentLength = source.length;
@ -16343,11 +16372,12 @@ var PDFFetchStreamReader = function () { @@ -16343,11 +16372,12 @@ var PDFFetchStreamReader = function () {
}
_this._reader = response.body.getReader();
_this._headersCapability.resolve();
var getResponseHeader = function getResponseHeader(name) {
return response.headers.get(name);
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return response.headers.get(name);
},
getResponseHeader: getResponseHeader,
isHttp: _this._stream.isHttp,
rangeChunkSize: _this._rangeChunkSize,
disableRange: _this._disableRange
@ -16357,6 +16387,7 @@ var PDFFetchStreamReader = function () { @@ -16357,6 +16387,7 @@ var PDFFetchStreamReader = function () {
_this._contentLength = suggestedLength;
_this._isRangeSupported = allowRangeRequests;
_this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
if (!_this._isStreamingSupported && _this._isRangeSupported) {
_this.cancel(new _util.AbortException('streaming is disabled'));
}
@ -16407,6 +16438,11 @@ var PDFFetchStreamReader = function () { @@ -16407,6 +16438,11 @@ var PDFFetchStreamReader = function () {
get: function get() {
return this._headersCapability.promise;
}
}, {
key: 'filename',
get: function get() {
return this._filename;
}
}, {
key: 'contentLength',
get: function get() {
@ -16777,17 +16813,19 @@ function PDFNetworkStreamFullRequestReader(manager, source) { @@ -16777,17 +16813,19 @@ function PDFNetworkStreamFullRequestReader(manager, source) {
this._requests = [];
this._done = false;
this._storedError = undefined;
this._filename = null;
this.onProgress = null;
}
PDFNetworkStreamFullRequestReader.prototype = {
_onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
var fullRequestXhrId = this._fullRequestId;
var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
var getResponseHeader = function getResponseHeader(name) {
return fullRequestXhr.getResponseHeader(name);
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return fullRequestXhr.getResponseHeader(name);
},
getResponseHeader: getResponseHeader,
isHttp: this._manager.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange
@ -16799,6 +16837,7 @@ PDFNetworkStreamFullRequestReader.prototype = { @@ -16799,6 +16837,7 @@ PDFNetworkStreamFullRequestReader.prototype = {
if (allowRangeRequests) {
this._isRangeSupported = true;
}
this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
var networkManager = this._manager;
if (networkManager.isStreamingRequest(fullRequestXhrId)) {
this._isStreamingSupported = true;
@ -16853,6 +16892,9 @@ PDFNetworkStreamFullRequestReader.prototype = { @@ -16853,6 +16892,9 @@ PDFNetworkStreamFullRequestReader.prototype = {
});
}
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._isRangeSupported;
},

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

6
build/pdf.worker.js vendored

@ -21955,8 +21955,8 @@ exports.PostScriptCompiler = PostScriptCompiler; @@ -21955,8 +21955,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.276';
var pdfjsBuild = '96c573ad';
var pdfjsVersion = '2.0.279';
var pdfjsBuild = '75dc2bbd';
var pdfjsCoreWorker = __w_pdfjs_require__(73);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -22169,7 +22169,7 @@ var WorkerMessageHandler = { @@ -22169,7 +22169,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
var apiVersion = docParams.apiVersion;
var workerVersion = '2.0.276';
var workerVersion = '2.0.279';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

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.276';
var workerVersion = '2.0.279';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error('The API version "' + apiVersion + '" does not match ' + ('the Worker version "' + workerVersion + '".'));
}

23
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.276';
var apiVersion = '2.0.279';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -1333,10 +1333,13 @@ var WorkerTransport = function WorkerTransportClosure() { @@ -1333,10 +1333,13 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetOutline', null);
},
getMetadata: function WorkerTransport_getMetadata() {
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) {
var _this14 = this;
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function (results) {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null
metadata: results[1] ? new _metadata.Metadata(results[1]) : null,
contentDispositionFilename: _this14._fullReader ? _this14._fullReader.filename : null
};
});
},
@ -1344,17 +1347,17 @@ var WorkerTransport = function WorkerTransportClosure() { @@ -1344,17 +1347,17 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
var _this14 = this;
var _this15 = this;
this.messageHandler.sendWithPromise('Cleanup', null).then(function () {
for (var i = 0, ii = _this14.pageCache.length; i < ii; i++) {
var page = _this14.pageCache[i];
for (var i = 0, ii = _this15.pageCache.length; i < ii; i++) {
var page = _this15.pageCache[i];
if (page) {
page.cleanup();
}
}
_this14.commonObjs.clear();
_this14.fontLoader.clear();
_this15.commonObjs.clear();
_this15.fontLoader.clear();
});
}
};
@ -1551,8 +1554,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() { @@ -1551,8 +1554,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.276';
exports.build = build = '96c573ad';
exports.version = version = '2.0.279';
exports.build = build = '75dc2bbd';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

14
lib/display/fetch_stream.js

@ -94,6 +94,7 @@ var PDFFetchStreamReader = function () { @@ -94,6 +94,7 @@ var PDFFetchStreamReader = function () {
this._stream = stream;
this._reader = null;
this._loaded = 0;
this._filename = null;
var source = stream.source;
this._withCredentials = source.withCredentials;
this._contentLength = source.length;
@ -120,11 +121,12 @@ var PDFFetchStreamReader = function () { @@ -120,11 +121,12 @@ var PDFFetchStreamReader = function () {
}
_this._reader = response.body.getReader();
_this._headersCapability.resolve();
var getResponseHeader = function getResponseHeader(name) {
return response.headers.get(name);
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return response.headers.get(name);
},
getResponseHeader: getResponseHeader,
isHttp: _this._stream.isHttp,
rangeChunkSize: _this._rangeChunkSize,
disableRange: _this._disableRange
@ -134,6 +136,7 @@ var PDFFetchStreamReader = function () { @@ -134,6 +136,7 @@ var PDFFetchStreamReader = function () {
_this._contentLength = suggestedLength;
_this._isRangeSupported = allowRangeRequests;
_this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
if (!_this._isStreamingSupported && _this._isRangeSupported) {
_this.cancel(new _util.AbortException('streaming is disabled'));
}
@ -184,6 +187,11 @@ var PDFFetchStreamReader = function () { @@ -184,6 +187,11 @@ var PDFFetchStreamReader = function () {
get: function get() {
return this._headersCapability.promise;
}
}, {
key: 'filename',
get: function get() {
return this._filename;
}
}, {
key: 'contentLength',
get: function get() {

4
lib/display/global.js

@ -51,8 +51,8 @@ if (!_global_scope2.default.PDFJS) { @@ -51,8 +51,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.276';
PDFJS.build = '96c573ad';
PDFJS.version = '2.0.279';
PDFJS.build = '75dc2bbd';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

12
lib/display/network.js

@ -283,17 +283,19 @@ function PDFNetworkStreamFullRequestReader(manager, source) { @@ -283,17 +283,19 @@ function PDFNetworkStreamFullRequestReader(manager, source) {
this._requests = [];
this._done = false;
this._storedError = undefined;
this._filename = null;
this.onProgress = null;
}
PDFNetworkStreamFullRequestReader.prototype = {
_onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() {
var fullRequestXhrId = this._fullRequestId;
var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId);
var getResponseHeader = function getResponseHeader(name) {
return fullRequestXhr.getResponseHeader(name);
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return fullRequestXhr.getResponseHeader(name);
},
getResponseHeader: getResponseHeader,
isHttp: this._manager.isHttp,
rangeChunkSize: this._rangeChunkSize,
disableRange: this._disableRange
@ -305,6 +307,7 @@ PDFNetworkStreamFullRequestReader.prototype = { @@ -305,6 +307,7 @@ PDFNetworkStreamFullRequestReader.prototype = {
if (allowRangeRequests) {
this._isRangeSupported = true;
}
this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
var networkManager = this._manager;
if (networkManager.isStreamingRequest(fullRequestXhrId)) {
this._isStreamingSupported = true;
@ -359,6 +362,9 @@ PDFNetworkStreamFullRequestReader.prototype = { @@ -359,6 +362,9 @@ PDFNetworkStreamFullRequestReader.prototype = {
});
}
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._isRangeSupported;
},

15
lib/display/network_utils.js

@ -24,10 +24,12 @@ @@ -24,10 +24,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.createResponseStatusError = undefined;
exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.extractFilenameFromHeader = exports.createResponseStatusError = undefined;
var _util = require('../shared/util');
var _dom_utils = require('./dom_utils');
function validateRangeRequestCapabilities(_ref) {
var getResponseHeader = _ref.getResponseHeader,
isHttp = _ref.isHttp,
@ -60,6 +62,16 @@ function validateRangeRequestCapabilities(_ref) { @@ -60,6 +62,16 @@ function validateRangeRequestCapabilities(_ref) {
returnValues.allowRangeRequests = true;
return returnValues;
}
function extractFilenameFromHeader(getResponseHeader) {
var contentDisposition = getResponseHeader('Content-Disposition');
if (contentDisposition) {
var parts = /.+;\s*filename=(?:'|")(.+\.pdf)(?:'|")/gi.exec(contentDisposition);
if (parts !== null && parts.length > 1) {
return (0, _dom_utils.getFilenameFromUrl)(parts[1]);
}
}
return null;
}
function createResponseStatusError(status, url) {
if (status === 404 || status === 0 && /^file:/.test(url)) {
return new _util.MissingPDFException('Missing PDF "' + url + '".');
@ -70,5 +82,6 @@ function validateResponseStatus(status) { @@ -70,5 +82,6 @@ function validateResponseStatus(status) {
return status === 200 || status === 206;
}
exports.createResponseStatusError = createResponseStatusError;
exports.extractFilenameFromHeader = extractFilenameFromHeader;
exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities;
exports.validateResponseStatus = validateResponseStatus;

14
lib/display/node_stream.js

@ -100,6 +100,7 @@ var BaseFullReader = function () { @@ -100,6 +100,7 @@ var BaseFullReader = function () {
var source = stream.source;
this._contentLength = source.length;
this._loaded = 0;
this._filename = null;
this._disableRange = source.disableRange || false;
this._rangeChunkSize = source.rangeChunkSize;
if (!this._rangeChunkSize && !this._disableRange) {
@ -191,6 +192,11 @@ var BaseFullReader = function () { @@ -191,6 +192,11 @@ var BaseFullReader = function () {
get: function get() {
return this._headersCapability.promise;
}
}, {
key: 'filename',
get: function get() {
return this._filename;
}
}, {
key: 'contentLength',
get: function get() {
@ -328,11 +334,12 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) { @@ -328,11 +334,12 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) {
var handleResponse = function handleResponse(response) {
_this5._headersCapability.resolve();
_this5._setReadableStream(response);
var getResponseHeader = function getResponseHeader(name) {
return _this5._readableStream.headers[name.toLowerCase()];
};
var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({
getResponseHeader: function getResponseHeader(name) {
return _this5._readableStream.headers[name.toLowerCase()];
},
getResponseHeader: getResponseHeader,
isHttp: stream.isHttp,
rangeChunkSize: _this5._rangeChunkSize,
disableRange: _this5._disableRange
@ -344,6 +351,7 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) { @@ -344,6 +351,7 @@ var PDFNodeStreamFullReader = function (_BaseFullReader) {
_this5._isRangeSupported = true;
}
_this5._contentLength = suggestedLength;
_this5._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader);
};
_this5._request = null;
if (_this5._url.protocol === 'http:') {

4
lib/display/transport_stream.js

@ -119,6 +119,7 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { @@ -119,6 +119,7 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
function PDFDataTransportStreamReader(stream, queuedChunks) {
this._stream = stream;
this._done = false;
this._filename = null;
this._queuedChunks = queuedChunks || [];
this._requests = [];
this._headersReady = Promise.resolve();
@ -143,6 +144,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() { @@ -143,6 +144,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
get headersReady() {
return this._headersReady;
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._stream._isRangeSupported;
},

4
lib/pdf.js

@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
*/
'use strict';
var pdfjsVersion = '2.0.276';
var pdfjsBuild = '96c573ad';
var pdfjsVersion = '2.0.279';
var pdfjsBuild = '75dc2bbd';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
*/
'use strict';
var pdfjsVersion = '2.0.276';
var pdfjsBuild = '96c573ad';
var pdfjsVersion = '2.0.279';
var pdfjsBuild = '75dc2bbd';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

1
lib/test/unit/api_spec.js

@ -690,6 +690,7 @@ describe('api', function () { @@ -690,6 +690,7 @@ describe('api', function () {
expect(metadata.info['Title']).toEqual('Basic API Test');
expect(metadata.info['PDFFormatVersion']).toEqual('1.7');
expect(metadata.metadata.get('dc:title')).toEqual('Basic API Test');
expect(metadata.contentDispositionFilename).toEqual(null);
done();
}).catch(function (reason) {
done.fail(reason);

67
lib/test/unit/network_utils_spec.js

@ -129,6 +129,73 @@ describe('network_utils', function () { @@ -129,6 +129,73 @@ describe('network_utils', function () {
});
});
});
describe('extractFilenameFromHeader', function () {
it('returns null when content disposition header is blank', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return null;
}
})).toBeNull();
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return undefined;
}
})).toBeNull();
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return '';
}
})).toBeNull();
});
it('gets the filename from the response header', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'inline';
}
})).toBeNull();
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment';
}
})).toBeNull();
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment; filename="filename.pdf"';
}
})).toEqual('filename.pdf');
});
it('returns null when content disposition is form-data', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data';
}
})).toBeNull();
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data; name="filename.pdf"';
}
})).toBeNull();
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data; name="filename.pdf"; filename="file.pdf"';
}
})).toEqual('file.pdf');
});
it('only extracts filename with pdf extension', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'attachment; filename="filename.png"';
}
})).toBeNull();
});
it('extension validation is case insensitive', function () {
expect((0, _network_utils.extractFilenameFromHeader)(function (headerName) {
if (headerName === 'Content-Disposition') {
return 'form-data; name="fieldName"; filename="file.PdF"';
}
})).toEqual('file.PdF');
});
});
describe('createResponseStatusError', function () {
it('handles missing PDF file responses', function () {
expect((0, _network_utils.createResponseStatusError)(404, 'https://foo.com/bar.pdf')).toEqual(new _util.MissingPDFException('Missing PDF "https://foo.com/bar.pdf".'));

12
lib/web/app.js

@ -150,6 +150,7 @@ var PDFViewerApplication = { @@ -150,6 +150,7 @@ var PDFViewerApplication = {
baseUrl: '',
externalServices: DefaultExternalServices,
_boundEvents: {},
contentDispositionFilename: null,
initialize: function initialize(appConfig) {
var _this = this;
@ -513,6 +514,7 @@ var PDFViewerApplication = { @@ -513,6 +514,7 @@ var PDFViewerApplication = {
this.downloadComplete = false;
this.url = '';
this.baseUrl = '';
this.contentDispositionFilename = null;
this.pdfSidebar.reset();
this.pdfOutlineViewer.reset();
this.pdfAttachmentViewer.reset();
@ -600,7 +602,7 @@ var PDFViewerApplication = { @@ -600,7 +602,7 @@ var PDFViewerApplication = {
downloadManager.downloadUrl(url, filename);
}
var url = this.baseUrl;
var filename = (0, _ui_utils.getPDFFileNameFromURL)(this.url);
var filename = this.contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url);
var downloadManager = this.downloadManager;
downloadManager.onerror = function (err) {
_this4.error('PDF failed to download: ' + err);
@ -847,10 +849,12 @@ var PDFViewerApplication = { @@ -847,10 +849,12 @@ var PDFViewerApplication = {
});
pdfDocument.getMetadata().then(function (_ref5) {
var info = _ref5.info,
metadata = _ref5.metadata;
metadata = _ref5.metadata,
contentDispositionFilename = _ref5.contentDispositionFilename;
_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]' : '') + ')');
var pdfTitle = void 0;
if (metadata && metadata.has('dc:title')) {
@ -863,7 +867,9 @@ var PDFViewerApplication = { @@ -863,7 +867,9 @@ var PDFViewerApplication = {
pdfTitle = info['Title'];
}
if (pdfTitle) {
_this6.setTitle(pdfTitle + ' - ' + document.title);
_this6.setTitle(pdfTitle + ' - ' + (contentDispositionFilename || document.title));
} else if (contentDispositionFilename) {
_this6.setTitle(contentDispositionFilename);
}
if (info.IsAcroFormPresent) {
console.warn('Warning: AcroForm/XFA is not supported');

18
lib/web/pdf_document_properties.js

@ -80,26 +80,28 @@ var PDFDocumentProperties = function () { @@ -80,26 +80,28 @@ var PDFDocumentProperties = function () {
}
_this.pdfDocument.getMetadata().then(function (_ref2) {
var info = _ref2.info,
metadata = _ref2.metadata;
metadata = _ref2.metadata,
contentDispositionFilename = _ref2.contentDispositionFilename;
return Promise.all([info, metadata, _this._parseFileSize(_this.maybeFileSize), _this._parseDate(info.CreationDate), _this._parseDate(info.ModDate)]);
return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(_this.url), _this._parseFileSize(_this.maybeFileSize), _this._parseDate(info.CreationDate), _this._parseDate(info.ModDate)]);
}).then(function (_ref3) {
var _ref4 = _slicedToArray(_ref3, 5),
var _ref4 = _slicedToArray(_ref3, 6),
info = _ref4[0],
metadata = _ref4[1],
fileSize = _ref4[2],
creationDate = _ref4[3],
modificationDate = _ref4[4];
fileName = _ref4[2],
fileSize = _ref4[3],
creationDate = _ref4[4],
modDate = _ref4[5];
freezeFieldData({
'fileName': (0, _ui_utils.getPDFFileNameFromURL)(_this.url),
'fileName': fileName,
'fileSize': fileSize,
'title': info.Title,
'author': info.Author,
'subject': info.Subject,
'keywords': info.Keywords,
'creationDate': creationDate,
'modificationDate': modificationDate,
'modificationDate': modDate,
'creator': info.Creator,
'producer': info.Producer,
'version': info.PDFFormatVersion,

2
package.json

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

Loading…
Cancel
Save