Browse Source

PDF.js version 1.8.327 - See mozilla/pdf.js@b3e4361d7baa539e81c0bf9851879bb59216c4f9

master v1.8.327
pdfjsbot 8 years ago
parent
commit
efca3b7f5d
  1. 2
      bower.json
  2. 12
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 12
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 6
      build/pdf.min.js
  7. 4
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 6
      build/pdf.worker.min.js
  10. 4
      lib/display/api.js
  11. 4
      lib/display/global.js
  12. 4
      lib/pdf.js
  13. 4
      lib/pdf.worker.js
  14. 3
      lib/web/app.js
  15. 155
      lib/web/pdf_document_properties.js
  16. 16
      lib/web/preferences.js
  17. 12
      lib/web/ui_utils.js
  18. 2
      package.json
  19. 12
      web/pdf_viewer.js
  20. 2
      web/pdf_viewer.js.map

2
bower.json

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

12
build/pdf.combined.js

@ -12779,8 +12779,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -12779,8 +12779,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.325';
exports.build = build = '50d026fb';
exports.version = version = '1.8.327';
exports.build = build = 'b3e4361d';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -28185,8 +28185,8 @@ if (!_util.globalScope.PDFJS) { @@ -28185,8 +28185,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.325';
PDFJS.build = '50d026fb';
PDFJS.version = '1.8.327';
PDFJS.build = 'b3e4361d';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -43772,8 +43772,8 @@ exports.TilingPattern = TilingPattern; @@ -43772,8 +43772,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.325';
var pdfjsBuild = '50d026fb';
var pdfjsVersion = '1.8.327';
var pdfjsBuild = 'b3e4361d';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
var pdfjsDisplayAPI = __w_pdfjs_require__(10);

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

12
build/pdf.js

@ -3486,8 +3486,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3486,8 +3486,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.325';
exports.build = build = '50d026fb';
exports.version = version = '1.8.327';
exports.build = build = 'b3e4361d';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -5460,8 +5460,8 @@ if (!_util.globalScope.PDFJS) { @@ -5460,8 +5460,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.325';
PDFJS.build = '50d026fb';
PDFJS.version = '1.8.327';
PDFJS.build = 'b3e4361d';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -7956,8 +7956,8 @@ exports.TilingPattern = TilingPattern; @@ -7956,8 +7956,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.325';
var pdfjsBuild = '50d026fb';
var pdfjsVersion = '1.8.327';
var pdfjsBuild = 'b3e4361d';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

6
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

4
build/pdf.worker.js vendored

@ -37137,8 +37137,8 @@ exports.Type1Parser = Type1Parser; @@ -37137,8 +37137,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.325';
var pdfjsBuild = '50d026fb';
var pdfjsVersion = '1.8.327';
var pdfjsBuild = 'b3e4361d';
var pdfjsCoreWorker = __w_pdfjs_require__(8);
{
__w_pdfjs_require__(19);

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

6
build/pdf.worker.min.js vendored

File diff suppressed because one or more lines are too long

4
lib/display/api.js

@ -1405,8 +1405,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1405,8 +1405,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.325';
exports.build = build = '50d026fb';
exports.version = version = '1.8.327';
exports.build = build = 'b3e4361d';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) { @@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.325';
PDFJS.build = '50d026fb';
PDFJS.version = '1.8.327';
PDFJS.build = 'b3e4361d';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.325';
var pdfjsBuild = '50d026fb';
var pdfjsVersion = '1.8.327';
var pdfjsBuild = 'b3e4361d';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.325';
var pdfjsBuild = '50d026fb';
var pdfjsVersion = '1.8.327';
var pdfjsBuild = 'b3e4361d';
var pdfjsCoreWorker = require('./core/worker.js');
{
require('./core/network.js');

3
lib/web/app.js

@ -410,6 +410,7 @@ var PDFViewerApplication = { @@ -410,6 +410,7 @@ var PDFViewerApplication = {
this.pdfThumbnailViewer.setDocument(null);
this.pdfViewer.setDocument(null);
this.pdfLinkService.setDocument(null, null);
this.pdfDocumentProperties.setDocument(null, null);
}
this.store = null;
this.isInitialViewSet = false;
@ -585,7 +586,6 @@ var PDFViewerApplication = { @@ -585,7 +586,6 @@ var PDFViewerApplication = {
var self = this;
scale = scale || _ui_utils.UNKNOWN_SCALE;
this.pdfDocument = pdfDocument;
this.pdfDocumentProperties.setDocumentAndUrl(pdfDocument, this.url);
var downloadedPromise = pdfDocument.getDownloadInfo().then(function () {
self.downloadComplete = true;
self.loadingBar.hide();
@ -597,6 +597,7 @@ var PDFViewerApplication = { @@ -597,6 +597,7 @@ var PDFViewerApplication = {
var baseDocumentUrl;
baseDocumentUrl = null;
this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);
this.pdfDocumentProperties.setDocument(pdfDocument, this.url);
var pdfViewer = this.pdfViewer;
pdfViewer.currentScale = scale;
pdfViewer.setDocument(pdfDocument);

155
lib/web/pdf_document_properties.js

@ -29,20 +29,24 @@ var _overlay_manager = require('./overlay_manager'); @@ -29,20 +29,24 @@ var _overlay_manager = require('./overlay_manager');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var DEFAULT_FIELD_CONTENT = '-';
var PDFDocumentProperties = function () {
function PDFDocumentProperties(options) {
function PDFDocumentProperties(_ref) {
var overlayName = _ref.overlayName,
fields = _ref.fields,
container = _ref.container,
closeButton = _ref.closeButton;
_classCallCheck(this, PDFDocumentProperties);
this.overlayName = options.overlayName;
this.fields = options.fields;
this.container = options.container;
this.rawFileSize = 0;
this.url = null;
this.pdfDocument = null;
if (options.closeButton) {
options.closeButton.addEventListener('click', this.close.bind(this));
this.overlayName = overlayName;
this.fields = fields;
this.container = container;
this._reset();
if (closeButton) {
closeButton.addEventListener('click', this.close.bind(this));
}
this._dataAvailableCapability = (0, _pdfjs.createPromiseCapability)();
_overlay_manager.OverlayManager.register(this.overlayName, this.container, this.close.bind(this));
}
@ -51,8 +55,47 @@ var PDFDocumentProperties = function () { @@ -51,8 +55,47 @@ var PDFDocumentProperties = function () {
value: function open() {
var _this = this;
var freezeFieldData = function freezeFieldData(data) {
Object.defineProperty(_this, 'fieldData', {
value: Object.freeze(data),
writable: false,
enumerable: true,
configurable: true
});
};
Promise.all([_overlay_manager.OverlayManager.open(this.overlayName), this._dataAvailableCapability.promise]).then(function () {
_this._getProperties();
if (_this.fieldData) {
_this._updateUI();
return;
}
_this.pdfDocument.getMetadata().then(function (_ref2) {
var info = _ref2.info,
metadata = _ref2.metadata;
freezeFieldData({
'fileName': (0, _ui_utils.getPDFFileNameFromURL)(_this.url),
'fileSize': _this._parseFileSize(_this.maybeFileSize),
'title': info.Title,
'author': info.Author,
'subject': info.Subject,
'keywords': info.Keywords,
'creationDate': _this._parseDate(info.CreationDate),
'modificationDate': _this._parseDate(info.ModDate),
'creator': info.Creator,
'producer': info.Producer,
'version': info.PDFFormatVersion,
'pageCount': _this.pdfDocument.numPages
});
_this._updateUI();
return _this.pdfDocument.getDownloadInfo();
}).then(function (_ref3) {
var length = _ref3.length;
var data = (0, _ui_utils.cloneObj)(_this.fieldData);
data['fileSize'] = _this._parseFileSize(length);
freezeFieldData(data);
_this._updateUI();
});
});
}
}, {
@ -61,66 +104,60 @@ var PDFDocumentProperties = function () { @@ -61,66 +104,60 @@ var PDFDocumentProperties = function () {
_overlay_manager.OverlayManager.close(this.overlayName);
}
}, {
key: 'setFileSize',
value: function setFileSize(fileSize) {
if (fileSize > 0) {
this.rawFileSize = fileSize;
key: 'setDocument',
value: function setDocument(pdfDocument, url) {
if (this.pdfDocument) {
this._reset();
this._updateUI(true);
}
if (!pdfDocument) {
return;
}
}
}, {
key: 'setDocumentAndUrl',
value: function setDocumentAndUrl(pdfDocument, url) {
this.pdfDocument = pdfDocument;
this.url = url;
this._dataAvailableCapability.resolve();
}
}, {
key: '_getProperties',
value: function _getProperties() {
var _this2 = this;
if (!_overlay_manager.OverlayManager.active) {
return;
key: 'setFileSize',
value: function setFileSize(fileSize) {
if (typeof fileSize === 'number' && fileSize > 0) {
this.maybeFileSize = fileSize;
}
this.pdfDocument.getDownloadInfo().then(function (data) {
if (data.length === _this2.rawFileSize) {
return;
}
_this2.setFileSize(data.length);
_this2._updateUI(_this2.fields['fileSize'], _this2._parseFileSize());
});
this.pdfDocument.getMetadata().then(function (data) {
var content = {
'fileName': (0, _ui_utils.getPDFFileNameFromURL)(_this2.url),
'fileSize': _this2._parseFileSize(),
'title': data.info.Title,
'author': data.info.Author,
'subject': data.info.Subject,
'keywords': data.info.Keywords,
'creationDate': _this2._parseDate(data.info.CreationDate),
'modificationDate': _this2._parseDate(data.info.ModDate),
'creator': data.info.Creator,
'producer': data.info.Producer,
'version': data.info.PDFFormatVersion,
'pageCount': _this2.pdfDocument.numPages
};
for (var identifier in content) {
_this2._updateUI(_this2.fields[identifier], content[identifier]);
}
});
}
}, {
key: '_reset',
value: function _reset() {
this.pdfDocument = null;
this.url = null;
this.maybeFileSize = 0;
delete this.fieldData;
this._dataAvailableCapability = (0, _pdfjs.createPromiseCapability)();
}
}, {
key: '_updateUI',
value: function _updateUI(field, content) {
if (field && content !== undefined && content !== '') {
field.textContent = content;
value: function _updateUI() {
var reset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (reset || !this.fieldData) {
for (var id in this.fields) {
this.fields[id].textContent = DEFAULT_FIELD_CONTENT;
}
return;
}
if (_overlay_manager.OverlayManager.active !== this.overlayName) {
return;
}
for (var _id in this.fields) {
var content = this.fieldData[_id];
this.fields[_id].textContent = content || content === 0 ? content : DEFAULT_FIELD_CONTENT;
}
}
}, {
key: '_parseFileSize',
value: function _parseFileSize() {
var fileSize = this.rawFileSize,
kb = fileSize / 1024;
var fileSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var kb = fileSize / 1024;
if (!kb) {
return;
} else if (kb < 1024) {
@ -137,10 +174,10 @@ var PDFDocumentProperties = function () { @@ -137,10 +174,10 @@ var PDFDocumentProperties = function () {
}, {
key: '_parseDate',
value: function _parseDate(inputDate) {
var dateToParse = inputDate;
if (dateToParse === undefined) {
return '';
if (!inputDate) {
return;
}
var dateToParse = inputDate;
if (dateToParse.substring(0, 2) === 'D:') {
dateToParse = dateToParse.substring(2);
}

16
lib/web/preferences.js

@ -17,11 +17,14 @@ @@ -17,11 +17,14 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BasePreferences = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
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 _ui_utils = require("./ui_utils");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var defaultPreferences = null;
@ -50,15 +53,6 @@ function getDefaultPreferences() { @@ -50,15 +53,6 @@ function getDefaultPreferences() {
}
return defaultPreferences;
}
function cloneObj(obj) {
var result = {};
for (var i in obj) {
if (Object.prototype.hasOwnProperty.call(obj, i)) {
result[i] = obj[i];
}
}
return result;
}
var BasePreferences = function () {
function BasePreferences() {
@ -77,7 +71,7 @@ var BasePreferences = function () { @@ -77,7 +71,7 @@ var BasePreferences = function () {
enumerable: true,
configurable: false
});
_this.prefs = cloneObj(defaults);
_this.prefs = (0, _ui_utils.cloneObj)(defaults);
return _this._readFromStorage(defaults);
}).then(function (prefObj) {
if (prefObj) {
@ -102,7 +96,7 @@ var BasePreferences = function () { @@ -102,7 +96,7 @@ var BasePreferences = function () {
var _this2 = this;
return this._initializedPromise.then(function () {
_this2.prefs = cloneObj(_this2.defaults);
_this2.prefs = (0, _ui_utils.cloneObj)(_this2.defaults);
return _this2._writeToStorage(_this2.defaults);
});
}

12
lib/web/ui_utils.js

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
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.mozL10n = exports.RendererType = 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.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.mozL10n = exports.RendererType = exports.cloneObj = 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 _pdfjs = require('./pdfjs');
@ -289,6 +289,15 @@ function normalizeWheelEventDelta(evt) { @@ -289,6 +289,15 @@ function normalizeWheelEventDelta(evt) {
}
return delta;
}
function cloneObj(obj) {
var result = {};
for (var i in obj) {
if (Object.prototype.hasOwnProperty.call(obj, i)) {
result[i] = obj[i];
}
}
return result;
}
var animationStarted = new Promise(function (resolve) {
window.requestAnimationFrame(resolve);
});
@ -409,6 +418,7 @@ exports.UNKNOWN_SCALE = UNKNOWN_SCALE; @@ -409,6 +418,7 @@ exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
exports.VERTICAL_PADDING = VERTICAL_PADDING;
exports.cloneObj = cloneObj;
exports.RendererType = RendererType;
exports.mozL10n = mozL10n;
exports.EventBus = EventBus;

2
package.json

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

12
web/pdf_viewer.js

@ -122,7 +122,7 @@ return /******/ (function(modules) { // webpackBootstrap @@ -122,7 +122,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
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.mozL10n = exports.RendererType = 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.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.mozL10n = exports.RendererType = exports.cloneObj = 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 _pdfjs = __w_pdfjs_require__(0);
@ -394,6 +394,15 @@ function normalizeWheelEventDelta(evt) { @@ -394,6 +394,15 @@ function normalizeWheelEventDelta(evt) {
}
return delta;
}
function cloneObj(obj) {
var result = {};
for (var i in obj) {
if (Object.prototype.hasOwnProperty.call(obj, i)) {
result[i] = obj[i];
}
}
return result;
}
var animationStarted = new Promise(function (resolve) {
window.requestAnimationFrame(resolve);
});
@ -514,6 +523,7 @@ exports.UNKNOWN_SCALE = UNKNOWN_SCALE; @@ -514,6 +523,7 @@ exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
exports.VERTICAL_PADDING = VERTICAL_PADDING;
exports.cloneObj = cloneObj;
exports.RendererType = RendererType;
exports.mozL10n = mozL10n;
exports.EventBus = EventBus;

2
web/pdf_viewer.js.map

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