Browse Source

PDF.js version 1.9.502 - See mozilla/pdf.js@a4cc85fc5f5cb144b6ee7a7978dc83e906677233

master v1.9.502
pdfjsbot 8 years ago
parent
commit
2149b632f7
  1. 2
      bower.json
  2. 76457
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 24320
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 2
      build/pdf.min.js
  7. 63206
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 2
      build/pdf.worker.min.js
  10. 706
      lib/core/annotation.js
  11. 3
      lib/core/document.js
  12. 543
      lib/display/annotation_layer.js
  13. 4
      lib/display/api.js
  14. 4
      lib/display/global.js
  15. 4
      lib/pdf.js
  16. 4
      lib/pdf.worker.js
  17. 90
      lib/test/unit/annotation_spec.js
  18. 2
      package.json
  19. 1583
      web/compatibility.js
  20. 2
      web/compatibility.js.map
  21. 3305
      web/pdf_viewer.js
  22. 2
      web/pdf_viewer.js.map

2
bower.json

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

76457
build/pdf.combined.js

File diff suppressed because it is too large Load Diff

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

24320
build/pdf.js

File diff suppressed because it is too large Load Diff

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

63206
build/pdf.worker.js vendored

File diff suppressed because it is too large Load Diff

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

706
lib/core/annotation.js

@ -19,6 +19,10 @@ Object.defineProperty(exports, "__esModule", { @@ -19,6 +19,10 @@ Object.defineProperty(exports, "__esModule", {
});
exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = undefined;
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
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 _util = require('../shared/util');
var _obj = require('./obj');
@ -31,132 +35,153 @@ var _evaluator = require('./evaluator'); @@ -31,132 +35,153 @@ var _evaluator = require('./evaluator');
var _stream = require('./stream');
function AnnotationFactory() {}
AnnotationFactory.prototype = {
create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) {
var dict = xref.fetchIfRef(ref);
if (!(0, _primitives.isDict)(dict)) {
return;
}
var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
var subtype = dict.get('Subtype');
subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
var parameters = {
xref: xref,
dict: dict,
ref: (0, _primitives.isRef)(ref) ? ref : null,
subtype: subtype,
id: id,
pdfManager: pdfManager
};
switch (subtype) {
case 'Link':
return new LinkAnnotation(parameters);
case 'Text':
return new TextAnnotation(parameters);
case 'Widget':
var fieldType = _util.Util.getInheritableProperty(dict, 'FT');
fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
switch (fieldType) {
case 'Tx':
return new TextWidgetAnnotation(parameters);
case 'Btn':
return new ButtonWidgetAnnotation(parameters);
case 'Ch':
return new ChoiceWidgetAnnotation(parameters);
}
(0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
return new WidgetAnnotation(parameters);
case 'Popup':
return new PopupAnnotation(parameters);
case 'Line':
return new LineAnnotation(parameters);
case 'Highlight':
return new HighlightAnnotation(parameters);
case 'Underline':
return new UnderlineAnnotation(parameters);
case 'Squiggly':
return new SquigglyAnnotation(parameters);
case 'StrikeOut':
return new StrikeOutAnnotation(parameters);
case 'FileAttachment':
return new FileAttachmentAnnotation(parameters);
default:
if (!subtype) {
(0, _util.warn)('Annotation is missing the required /Subtype.');
} else {
(0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
}
return new Annotation(parameters);
}
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; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AnnotationFactory = function () {
function AnnotationFactory() {
_classCallCheck(this, AnnotationFactory);
}
};
var Annotation = function AnnotationClosure() {
function getTransformMatrix(rect, bbox, matrix) {
var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
var minX = bounds[0];
var minY = bounds[1];
var maxX = bounds[2];
var maxY = bounds[3];
if (minX === maxX || minY === maxY) {
return [1, 0, 0, 1, rect[0], rect[1]];
}
var xRatio = (rect[2] - rect[0]) / (maxX - minX);
var yRatio = (rect[3] - rect[1]) / (maxY - minY);
return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
_createClass(AnnotationFactory, null, [{
key: 'create',
value: function create(xref, ref, pdfManager, idFactory) {
var dict = xref.fetchIfRef(ref);
if (!(0, _primitives.isDict)(dict)) {
return;
}
var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + idFactory.createObjId();
var subtype = dict.get('Subtype');
subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
var parameters = {
xref: xref,
dict: dict,
ref: (0, _primitives.isRef)(ref) ? ref : null,
subtype: subtype,
id: id,
pdfManager: pdfManager
};
switch (subtype) {
case 'Link':
return new LinkAnnotation(parameters);
case 'Text':
return new TextAnnotation(parameters);
case 'Widget':
var fieldType = _util.Util.getInheritableProperty(dict, 'FT');
fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
switch (fieldType) {
case 'Tx':
return new TextWidgetAnnotation(parameters);
case 'Btn':
return new ButtonWidgetAnnotation(parameters);
case 'Ch':
return new ChoiceWidgetAnnotation(parameters);
}
(0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
return new WidgetAnnotation(parameters);
case 'Popup':
return new PopupAnnotation(parameters);
case 'Line':
return new LineAnnotation(parameters);
case 'Highlight':
return new HighlightAnnotation(parameters);
case 'Underline':
return new UnderlineAnnotation(parameters);
case 'Squiggly':
return new SquigglyAnnotation(parameters);
case 'StrikeOut':
return new StrikeOutAnnotation(parameters);
case 'FileAttachment':
return new FileAttachmentAnnotation(parameters);
default:
if (!subtype) {
(0, _util.warn)('Annotation is missing the required /Subtype.');
} else {
(0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
}
return new Annotation(parameters);
}
}
}]);
return AnnotationFactory;
}();
function getTransformMatrix(rect, bbox, matrix) {
var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
var minX = bounds[0];
var minY = bounds[1];
var maxX = bounds[2];
var maxY = bounds[3];
if (minX === maxX || minY === maxY) {
return [1, 0, 0, 1, rect[0], rect[1]];
}
var xRatio = (rect[2] - rect[0]) / (maxX - minX);
var yRatio = (rect[3] - rect[1]) / (maxY - minY);
return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
}
var Annotation = function () {
function Annotation(params) {
_classCallCheck(this, Annotation);
var dict = params.dict;
this.setFlags(dict.get('F'));
this.setRectangle(dict.getArray('Rect'));
this.setColor(dict.getArray('C'));
this.setBorderStyle(dict);
this.setAppearance(dict);
this.data = {};
this.data.id = params.id;
this.data.subtype = params.subtype;
this.data.annotationFlags = this.flags;
this.data.rect = this.rectangle;
this.data.color = this.color;
this.data.borderStyle = this.borderStyle;
this.data.hasAppearance = !!this.appearance;
this.data = {
annotationFlags: this.flags,
borderStyle: this.borderStyle,
color: this.color,
hasAppearance: !!this.appearance,
id: params.id,
rect: this.rectangle,
subtype: params.subtype
};
}
Annotation.prototype = {
_hasFlag: function Annotation_hasFlag(flags, flag) {
_createClass(Annotation, [{
key: '_hasFlag',
value: function _hasFlag(flags, flag) {
return !!(flags & flag);
},
_isViewable: function Annotation_isViewable(flags) {
}
}, {
key: '_isViewable',
value: function _isViewable(flags) {
return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
},
_isPrintable: function AnnotationFlag_isPrintable(flags) {
}
}, {
key: '_isPrintable',
value: function _isPrintable(flags) {
return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
},
get viewable() {
if (this.flags === 0) {
return true;
}
return this._isViewable(this.flags);
},
get printable() {
if (this.flags === 0) {
return false;
}
return this._isPrintable(this.flags);
},
setFlags: function Annotation_setFlags(flags) {
}
}, {
key: 'setFlags',
value: function setFlags(flags) {
this.flags = (0, _util.isInt)(flags) && flags > 0 ? flags : 0;
},
hasFlag: function Annotation_hasFlag(flag) {
}
}, {
key: 'hasFlag',
value: function hasFlag(flag) {
return this._hasFlag(this.flags, flag);
},
setRectangle: function Annotation_setRectangle(rectangle) {
}
}, {
key: 'setRectangle',
value: function setRectangle(rectangle) {
if ((0, _util.isArray)(rectangle) && rectangle.length === 4) {
this.rectangle = _util.Util.normalizeRect(rectangle);
} else {
this.rectangle = [0, 0, 0, 0];
}
},
setColor: function Annotation_setColor(color) {
}
}, {
key: 'setColor',
value: function setColor(color) {
var rgbColor = new Uint8Array(3);
if (!(0, _util.isArray)(color)) {
this.color = rgbColor;
@ -182,8 +207,10 @@ var Annotation = function AnnotationClosure() { @@ -182,8 +207,10 @@ var Annotation = function AnnotationClosure() {
this.color = rgbColor;
break;
}
},
setBorderStyle: function Annotation_setBorderStyle(borderStyle) {
}
}, {
key: 'setBorderStyle',
value: function setBorderStyle(borderStyle) {
this.borderStyle = new AnnotationBorderStyle();
if (!(0, _primitives.isDict)(borderStyle)) {
return;
@ -209,8 +236,10 @@ var Annotation = function AnnotationClosure() { @@ -209,8 +236,10 @@ var Annotation = function AnnotationClosure() {
} else {
this.borderStyle.setWidth(0);
}
},
setAppearance: function Annotation_setAppearance(dict) {
}
}, {
key: 'setAppearance',
value: function setAppearance(dict) {
this.appearance = null;
var appearanceStates = dict.get('AP');
if (!(0, _primitives.isDict)(appearanceStates)) {
@ -229,16 +258,20 @@ var Annotation = function AnnotationClosure() { @@ -229,16 +258,20 @@ var Annotation = function AnnotationClosure() {
return;
}
this.appearance = normalAppearanceState.get(as.name);
},
_preparePopup: function Annotation_preparePopup(dict) {
}
}, {
key: '_preparePopup',
value: function _preparePopup(dict) {
if (!dict.has('C')) {
this.data.color = null;
}
this.data.hasPopup = dict.has('Popup');
this.data.title = (0, _util.stringToPDFString)(dict.get('T') || '');
this.data.contents = (0, _util.stringToPDFString)(dict.get('Contents') || '');
},
loadResources: function Annotation_loadResources(keys) {
}
}, {
key: 'loadResources',
value: function loadResources(keys) {
return this.appearance.dict.getAsync('Resources').then(function (resources) {
if (!resources) {
return;
@ -248,8 +281,10 @@ var Annotation = function AnnotationClosure() { @@ -248,8 +281,10 @@ var Annotation = function AnnotationClosure() {
return resources;
});
});
},
getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
}
}, {
key: 'getOperatorList',
value: function getOperatorList(evaluator, task, renderForms) {
var _this = this;
if (!this.appearance) {
@ -276,24 +311,48 @@ var Annotation = function AnnotationClosure() { @@ -276,24 +311,48 @@ var Annotation = function AnnotationClosure() {
});
});
}
};
}, {
key: 'viewable',
get: function get() {
if (this.flags === 0) {
return true;
}
return this._isViewable(this.flags);
}
}, {
key: 'printable',
get: function get() {
if (this.flags === 0) {
return false;
}
return this._isPrintable(this.flags);
}
}]);
return Annotation;
}();
var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
var AnnotationBorderStyle = function () {
function AnnotationBorderStyle() {
_classCallCheck(this, AnnotationBorderStyle);
this.width = 1;
this.style = _util.AnnotationBorderStyleType.SOLID;
this.dashArray = [3];
this.horizontalCornerRadius = 0;
this.verticalCornerRadius = 0;
}
AnnotationBorderStyle.prototype = {
setWidth: function AnnotationBorderStyle_setWidth(width) {
_createClass(AnnotationBorderStyle, [{
key: 'setWidth',
value: function setWidth(width) {
if (width === (width | 0)) {
this.width = width;
}
},
setStyle: function AnnotationBorderStyle_setStyle(style) {
}
}, {
key: 'setStyle',
value: function setStyle(style) {
if (!style) {
return;
}
@ -316,8 +375,10 @@ var AnnotationBorderStyle = function AnnotationBorderStyleClosure() { @@ -316,8 +375,10 @@ var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
default:
break;
}
},
setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) {
}
}, {
key: 'setDashArray',
value: function setDashArray(dashArray) {
if ((0, _util.isArray)(dashArray) && dashArray.length > 0) {
var isValid = true;
var allZeros = true;
@ -339,44 +400,58 @@ var AnnotationBorderStyle = function AnnotationBorderStyleClosure() { @@ -339,44 +400,58 @@ var AnnotationBorderStyle = function AnnotationBorderStyleClosure() {
} else if (dashArray) {
this.width = 0;
}
},
setHorizontalCornerRadius: function AnnotationBorderStyle_setHorizontalCornerRadius(radius) {
}
}, {
key: 'setHorizontalCornerRadius',
value: function setHorizontalCornerRadius(radius) {
if (radius === (radius | 0)) {
this.horizontalCornerRadius = radius;
}
},
setVerticalCornerRadius: function AnnotationBorderStyle_setVerticalCornerRadius(radius) {
}
}, {
key: 'setVerticalCornerRadius',
value: function setVerticalCornerRadius(radius) {
if (radius === (radius | 0)) {
this.verticalCornerRadius = radius;
}
}
};
}]);
return AnnotationBorderStyle;
}();
var WidgetAnnotation = function WidgetAnnotationClosure() {
var WidgetAnnotation = function (_Annotation) {
_inherits(WidgetAnnotation, _Annotation);
function WidgetAnnotation(params) {
Annotation.call(this, params);
_classCallCheck(this, WidgetAnnotation);
var _this2 = _possibleConstructorReturn(this, (WidgetAnnotation.__proto__ || Object.getPrototypeOf(WidgetAnnotation)).call(this, params));
var dict = params.dict;
var data = this.data;
var data = _this2.data;
data.annotationType = _util.AnnotationType.WIDGET;
data.fieldName = this._constructFieldName(dict);
data.fieldName = _this2._constructFieldName(dict);
data.fieldValue = _util.Util.getInheritableProperty(dict, 'V', true);
data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || '');
data.defaultAppearance = _util.Util.getInheritableProperty(dict, 'DA') || '';
var fieldType = _util.Util.getInheritableProperty(dict, 'FT');
data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
this.fieldResources = _util.Util.getInheritableProperty(dict, 'DR') || _primitives.Dict.empty;
_this2.fieldResources = _util.Util.getInheritableProperty(dict, 'DR') || _primitives.Dict.empty;
data.fieldFlags = _util.Util.getInheritableProperty(dict, 'Ff');
if (!(0, _util.isInt)(data.fieldFlags) || data.fieldFlags < 0) {
data.fieldFlags = 0;
}
data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
data.readOnly = _this2.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
if (data.fieldType === 'Sig') {
this.setFlags(_util.AnnotationFlag.HIDDEN);
_this2.setFlags(_util.AnnotationFlag.HIDDEN);
}
return _this2;
}
_util.Util.inherit(WidgetAnnotation, Annotation, {
_constructFieldName: function WidgetAnnotation_constructFieldName(dict) {
_createClass(WidgetAnnotation, [{
key: '_constructFieldName',
value: function _constructFieldName(dict) {
if (!dict.has('T') && !dict.has('Parent')) {
(0, _util.warn)('Unknown field name, falling back to empty field name.');
return '';
@ -399,39 +474,56 @@ var WidgetAnnotation = function WidgetAnnotationClosure() { @@ -399,39 +474,56 @@ var WidgetAnnotation = function WidgetAnnotationClosure() {
}
}
return fieldName.join('.');
},
hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) {
}
}, {
key: 'hasFieldFlag',
value: function hasFieldFlag(flag) {
return !!(this.data.fieldFlags & flag);
}
});
}, {
key: 'getOperatorList',
value: function getOperatorList(evaluator, task, renderForms) {
if (renderForms) {
return Promise.resolve(new _evaluator.OperatorList());
}
return _get(WidgetAnnotation.prototype.__proto__ || Object.getPrototypeOf(WidgetAnnotation.prototype), 'getOperatorList', this).call(this, evaluator, task, renderForms);
}
}]);
return WidgetAnnotation;
}();
var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
}(Annotation);
var TextWidgetAnnotation = function (_WidgetAnnotation) {
_inherits(TextWidgetAnnotation, _WidgetAnnotation);
function TextWidgetAnnotation(params) {
WidgetAnnotation.call(this, params);
this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || '');
_classCallCheck(this, TextWidgetAnnotation);
var _this3 = _possibleConstructorReturn(this, (TextWidgetAnnotation.__proto__ || Object.getPrototypeOf(TextWidgetAnnotation)).call(this, params));
_this3.data.fieldValue = (0, _util.stringToPDFString)(_this3.data.fieldValue || '');
var alignment = _util.Util.getInheritableProperty(params.dict, 'Q');
if (!(0, _util.isInt)(alignment) || alignment < 0 || alignment > 2) {
alignment = null;
}
this.data.textAlignment = alignment;
_this3.data.textAlignment = alignment;
var maximumLength = _util.Util.getInheritableProperty(params.dict, 'MaxLen');
if (!(0, _util.isInt)(maximumLength) || maximumLength < 0) {
maximumLength = null;
}
this.data.maxLen = maximumLength;
this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
_this3.data.maxLen = maximumLength;
_this3.data.multiLine = _this3.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
_this3.data.comb = _this3.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this3.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this3.data.maxLen !== null;
return _this3;
}
_util.Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
var operatorList = new _evaluator.OperatorList();
if (renderForms) {
return Promise.resolve(operatorList);
}
if (this.appearance) {
return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
_createClass(TextWidgetAnnotation, [{
key: 'getOperatorList',
value: function getOperatorList(evaluator, task, renderForms) {
if (renderForms || this.appearance) {
return _get(TextWidgetAnnotation.prototype.__proto__ || Object.getPrototypeOf(TextWidgetAnnotation.prototype), 'getOperatorList', this).call(this, evaluator, task, renderForms);
}
var operatorList = new _evaluator.OperatorList();
if (!this.data.defaultAppearance) {
return Promise.resolve(operatorList);
}
@ -445,213 +537,273 @@ var TextWidgetAnnotation = function TextWidgetAnnotationClosure() { @@ -445,213 +537,273 @@ var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
return operatorList;
});
}
});
}]);
return TextWidgetAnnotation;
}();
var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() {
}(WidgetAnnotation);
var ButtonWidgetAnnotation = function (_WidgetAnnotation2) {
_inherits(ButtonWidgetAnnotation, _WidgetAnnotation2);
function ButtonWidgetAnnotation(params) {
WidgetAnnotation.call(this, params);
this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
if (this.data.checkBox) {
if (!(0, _primitives.isName)(this.data.fieldValue)) {
return;
_classCallCheck(this, ButtonWidgetAnnotation);
var _this4 = _possibleConstructorReturn(this, (ButtonWidgetAnnotation.__proto__ || Object.getPrototypeOf(ButtonWidgetAnnotation)).call(this, params));
_this4.data.checkBox = !_this4.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
if (_this4.data.checkBox) {
if (!(0, _primitives.isName)(_this4.data.fieldValue)) {
return _possibleConstructorReturn(_this4);
}
this.data.fieldValue = this.data.fieldValue.name;
_this4.data.fieldValue = _this4.data.fieldValue.name;
}
this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
if (this.data.radioButton) {
this.data.fieldValue = this.data.buttonValue = null;
_this4.data.radioButton = _this4.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
if (_this4.data.radioButton) {
_this4.data.fieldValue = _this4.data.buttonValue = null;
var fieldParent = params.dict.get('Parent');
if ((0, _primitives.isDict)(fieldParent) && fieldParent.has('V')) {
var fieldParentValue = fieldParent.get('V');
if ((0, _primitives.isName)(fieldParentValue)) {
this.data.fieldValue = fieldParentValue.name;
_this4.data.fieldValue = fieldParentValue.name;
}
}
var appearanceStates = params.dict.get('AP');
if (!(0, _primitives.isDict)(appearanceStates)) {
return;
return _possibleConstructorReturn(_this4);
}
var normalAppearanceState = appearanceStates.get('N');
if (!(0, _primitives.isDict)(normalAppearanceState)) {
return;
return _possibleConstructorReturn(_this4);
}
var keys = normalAppearanceState.getKeys();
for (var i = 0, ii = keys.length; i < ii; i++) {
if (keys[i] !== 'Off') {
this.data.buttonValue = keys[i];
_this4.data.buttonValue = keys[i];
break;
}
}
}
return _this4;
}
_util.Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, {
getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
var operatorList = new _evaluator.OperatorList();
if (renderForms) {
return Promise.resolve(operatorList);
}
if (this.appearance) {
return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
}
return Promise.resolve(operatorList);
}
});
return ButtonWidgetAnnotation;
}();
var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() {
}(WidgetAnnotation);
var ChoiceWidgetAnnotation = function (_WidgetAnnotation3) {
_inherits(ChoiceWidgetAnnotation, _WidgetAnnotation3);
function ChoiceWidgetAnnotation(params) {
WidgetAnnotation.call(this, params);
this.data.options = [];
_classCallCheck(this, ChoiceWidgetAnnotation);
var _this5 = _possibleConstructorReturn(this, (ChoiceWidgetAnnotation.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotation)).call(this, params));
_this5.data.options = [];
var options = _util.Util.getInheritableProperty(params.dict, 'Opt');
if ((0, _util.isArray)(options)) {
var xref = params.xref;
for (var i = 0, ii = options.length; i < ii; i++) {
var option = xref.fetchIfRef(options[i]);
var isOptionArray = (0, _util.isArray)(option);
this.data.options[i] = {
_this5.data.options[i] = {
exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option
};
}
}
if (!(0, _util.isArray)(this.data.fieldValue)) {
this.data.fieldValue = [this.data.fieldValue];
if (!(0, _util.isArray)(_this5.data.fieldValue)) {
_this5.data.fieldValue = [_this5.data.fieldValue];
}
this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
_this5.data.combo = _this5.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
_this5.data.multiSelect = _this5.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
return _this5;
}
_util.Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) {
var operatorList = new _evaluator.OperatorList();
if (renderForms) {
return Promise.resolve(operatorList);
}
return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms);
}
});
return ChoiceWidgetAnnotation;
}();
var TextAnnotation = function TextAnnotationClosure() {
var DEFAULT_ICON_SIZE = 22;
}(WidgetAnnotation);
var TextAnnotation = function (_Annotation2) {
_inherits(TextAnnotation, _Annotation2);
function TextAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.TEXT;
if (this.data.hasAppearance) {
this.data.name = 'NoIcon';
_classCallCheck(this, TextAnnotation);
var DEFAULT_ICON_SIZE = 22;
var _this6 = _possibleConstructorReturn(this, (TextAnnotation.__proto__ || Object.getPrototypeOf(TextAnnotation)).call(this, parameters));
_this6.data.annotationType = _util.AnnotationType.TEXT;
if (_this6.data.hasAppearance) {
_this6.data.name = 'NoIcon';
} else {
this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
_this6.data.rect[1] = _this6.data.rect[3] - DEFAULT_ICON_SIZE;
_this6.data.rect[2] = _this6.data.rect[0] + DEFAULT_ICON_SIZE;
_this6.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
}
this._preparePopup(parameters.dict);
_this6._preparePopup(parameters.dict);
return _this6;
}
_util.Util.inherit(TextAnnotation, Annotation, {});
return TextAnnotation;
}();
var LinkAnnotation = function LinkAnnotationClosure() {
}(Annotation);
var LinkAnnotation = function (_Annotation3) {
_inherits(LinkAnnotation, _Annotation3);
function LinkAnnotation(params) {
Annotation.call(this, params);
var data = this.data;
data.annotationType = _util.AnnotationType.LINK;
_classCallCheck(this, LinkAnnotation);
var _this7 = _possibleConstructorReturn(this, (LinkAnnotation.__proto__ || Object.getPrototypeOf(LinkAnnotation)).call(this, params));
_this7.data.annotationType = _util.AnnotationType.LINK;
_obj.Catalog.parseDestDictionary({
destDict: params.dict,
resultObj: data,
resultObj: _this7.data,
docBaseUrl: params.pdfManager.docBaseUrl
});
return _this7;
}
_util.Util.inherit(LinkAnnotation, Annotation, {});
return LinkAnnotation;
}();
var PopupAnnotation = function PopupAnnotationClosure() {
}(Annotation);
var PopupAnnotation = function (_Annotation4) {
_inherits(PopupAnnotation, _Annotation4);
function PopupAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.POPUP;
_classCallCheck(this, PopupAnnotation);
var _this8 = _possibleConstructorReturn(this, (PopupAnnotation.__proto__ || Object.getPrototypeOf(PopupAnnotation)).call(this, parameters));
_this8.data.annotationType = _util.AnnotationType.POPUP;
var dict = parameters.dict;
var parentItem = dict.get('Parent');
if (!parentItem) {
(0, _util.warn)('Popup annotation has a missing or invalid parent annotation.');
return;
return _possibleConstructorReturn(_this8);
}
var parentSubtype = parentItem.get('Subtype');
this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
this.data.parentId = dict.getRaw('Parent').toString();
this.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
this.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
_this8.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
_this8.data.parentId = dict.getRaw('Parent').toString();
_this8.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
_this8.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
if (!parentItem.has('C')) {
this.data.color = null;
_this8.data.color = null;
} else {
this.setColor(parentItem.getArray('C'));
this.data.color = this.color;
_this8.setColor(parentItem.getArray('C'));
_this8.data.color = _this8.color;
}
if (!this.viewable) {
if (!_this8.viewable) {
var parentFlags = parentItem.get('F');
if (this._isViewable(parentFlags)) {
this.setFlags(parentFlags);
if (_this8._isViewable(parentFlags)) {
_this8.setFlags(parentFlags);
}
}
return _this8;
}
_util.Util.inherit(PopupAnnotation, Annotation, {});
return PopupAnnotation;
}();
var LineAnnotation = function LineAnnotationClosure() {
}(Annotation);
var LineAnnotation = function (_Annotation5) {
_inherits(LineAnnotation, _Annotation5);
function LineAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.LINE;
_classCallCheck(this, LineAnnotation);
var _this9 = _possibleConstructorReturn(this, (LineAnnotation.__proto__ || Object.getPrototypeOf(LineAnnotation)).call(this, parameters));
_this9.data.annotationType = _util.AnnotationType.LINE;
var dict = parameters.dict;
this.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
this._preparePopup(dict);
_this9.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
_this9._preparePopup(dict);
return _this9;
}
_util.Util.inherit(LineAnnotation, Annotation, {});
return LineAnnotation;
}();
var HighlightAnnotation = function HighlightAnnotationClosure() {
}(Annotation);
var HighlightAnnotation = function (_Annotation6) {
_inherits(HighlightAnnotation, _Annotation6);
function HighlightAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
this._preparePopup(parameters.dict);
_classCallCheck(this, HighlightAnnotation);
var _this10 = _possibleConstructorReturn(this, (HighlightAnnotation.__proto__ || Object.getPrototypeOf(HighlightAnnotation)).call(this, parameters));
_this10.data.annotationType = _util.AnnotationType.HIGHLIGHT;
_this10._preparePopup(parameters.dict);
return _this10;
}
_util.Util.inherit(HighlightAnnotation, Annotation, {});
return HighlightAnnotation;
}();
var UnderlineAnnotation = function UnderlineAnnotationClosure() {
}(Annotation);
var UnderlineAnnotation = function (_Annotation7) {
_inherits(UnderlineAnnotation, _Annotation7);
function UnderlineAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.UNDERLINE;
this._preparePopup(parameters.dict);
_classCallCheck(this, UnderlineAnnotation);
var _this11 = _possibleConstructorReturn(this, (UnderlineAnnotation.__proto__ || Object.getPrototypeOf(UnderlineAnnotation)).call(this, parameters));
_this11.data.annotationType = _util.AnnotationType.UNDERLINE;
_this11._preparePopup(parameters.dict);
return _this11;
}
_util.Util.inherit(UnderlineAnnotation, Annotation, {});
return UnderlineAnnotation;
}();
var SquigglyAnnotation = function SquigglyAnnotationClosure() {
}(Annotation);
var SquigglyAnnotation = function (_Annotation8) {
_inherits(SquigglyAnnotation, _Annotation8);
function SquigglyAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.SQUIGGLY;
this._preparePopup(parameters.dict);
_classCallCheck(this, SquigglyAnnotation);
var _this12 = _possibleConstructorReturn(this, (SquigglyAnnotation.__proto__ || Object.getPrototypeOf(SquigglyAnnotation)).call(this, parameters));
_this12.data.annotationType = _util.AnnotationType.SQUIGGLY;
_this12._preparePopup(parameters.dict);
return _this12;
}
_util.Util.inherit(SquigglyAnnotation, Annotation, {});
return SquigglyAnnotation;
}();
var StrikeOutAnnotation = function StrikeOutAnnotationClosure() {
}(Annotation);
var StrikeOutAnnotation = function (_Annotation9) {
_inherits(StrikeOutAnnotation, _Annotation9);
function StrikeOutAnnotation(parameters) {
Annotation.call(this, parameters);
this.data.annotationType = _util.AnnotationType.STRIKEOUT;
this._preparePopup(parameters.dict);
_classCallCheck(this, StrikeOutAnnotation);
var _this13 = _possibleConstructorReturn(this, (StrikeOutAnnotation.__proto__ || Object.getPrototypeOf(StrikeOutAnnotation)).call(this, parameters));
_this13.data.annotationType = _util.AnnotationType.STRIKEOUT;
_this13._preparePopup(parameters.dict);
return _this13;
}
_util.Util.inherit(StrikeOutAnnotation, Annotation, {});
return StrikeOutAnnotation;
}();
var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() {
}(Annotation);
var FileAttachmentAnnotation = function (_Annotation10) {
_inherits(FileAttachmentAnnotation, _Annotation10);
function FileAttachmentAnnotation(parameters) {
Annotation.call(this, parameters);
_classCallCheck(this, FileAttachmentAnnotation);
var _this14 = _possibleConstructorReturn(this, (FileAttachmentAnnotation.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotation)).call(this, parameters));
var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
this.data.file = file.serializable;
this._preparePopup(parameters.dict);
_this14.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
_this14.data.file = file.serializable;
_this14._preparePopup(parameters.dict);
return _this14;
}
_util.Util.inherit(FileAttachmentAnnotation, Annotation, {});
return FileAttachmentAnnotation;
}();
}(Annotation);
exports.Annotation = Annotation;
exports.AnnotationBorderStyle = AnnotationBorderStyle;
exports.AnnotationFactory = AnnotationFactory;

3
lib/core/document.js

@ -289,10 +289,9 @@ var Page = function PageClosure() { @@ -289,10 +289,9 @@ var Page = function PageClosure() {
get annotations() {
var annotations = [];
var annotationRefs = this.getInheritedPageProp('Annots') || [];
var annotationFactory = new _annotation.AnnotationFactory();
for (var i = 0, n = annotationRefs.length; i < n; ++i) {
var annotationRef = annotationRefs[i];
var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
var annotation = _annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory);
if (annotation) {
annotations.push(annotation);
}

543
lib/display/annotation_layer.js

@ -19,58 +19,80 @@ Object.defineProperty(exports, "__esModule", { @@ -19,58 +19,80 @@ Object.defineProperty(exports, "__esModule", {
});
exports.AnnotationLayer = 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; }; }();
var _dom_utils = require('./dom_utils');
var _util = require('../shared/util');
function AnnotationElementFactory() {}
AnnotationElementFactory.prototype = {
create: function AnnotationElementFactory_create(parameters) {
var subtype = parameters.data.annotationType;
switch (subtype) {
case _util.AnnotationType.LINK:
return new LinkAnnotationElement(parameters);
case _util.AnnotationType.TEXT:
return new TextAnnotationElement(parameters);
case _util.AnnotationType.WIDGET:
var fieldType = parameters.data.fieldType;
switch (fieldType) {
case 'Tx':
return new TextWidgetAnnotationElement(parameters);
case 'Btn':
if (parameters.data.radioButton) {
return new RadioButtonWidgetAnnotationElement(parameters);
} else if (parameters.data.checkBox) {
return new CheckboxWidgetAnnotationElement(parameters);
}
(0, _util.warn)('Unimplemented button widget annotation: pushbutton');
break;
case 'Ch':
return new ChoiceWidgetAnnotationElement(parameters);
}
return new WidgetAnnotationElement(parameters);
case _util.AnnotationType.POPUP:
return new PopupAnnotationElement(parameters);
case _util.AnnotationType.LINE:
return new LineAnnotationElement(parameters);
case _util.AnnotationType.HIGHLIGHT:
return new HighlightAnnotationElement(parameters);
case _util.AnnotationType.UNDERLINE:
return new UnderlineAnnotationElement(parameters);
case _util.AnnotationType.SQUIGGLY:
return new SquigglyAnnotationElement(parameters);
case _util.AnnotationType.STRIKEOUT:
return new StrikeOutAnnotationElement(parameters);
case _util.AnnotationType.FILEATTACHMENT:
return new FileAttachmentAnnotationElement(parameters);
default:
return new AnnotationElement(parameters);
}
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; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var AnnotationElementFactory = function () {
function AnnotationElementFactory() {
_classCallCheck(this, AnnotationElementFactory);
}
};
var AnnotationElement = function AnnotationElementClosure() {
function AnnotationElement(parameters, isRenderable, ignoreBorder) {
this.isRenderable = isRenderable || false;
_createClass(AnnotationElementFactory, null, [{
key: 'create',
value: function create(parameters) {
var subtype = parameters.data.annotationType;
switch (subtype) {
case _util.AnnotationType.LINK:
return new LinkAnnotationElement(parameters);
case _util.AnnotationType.TEXT:
return new TextAnnotationElement(parameters);
case _util.AnnotationType.WIDGET:
var fieldType = parameters.data.fieldType;
switch (fieldType) {
case 'Tx':
return new TextWidgetAnnotationElement(parameters);
case 'Btn':
if (parameters.data.radioButton) {
return new RadioButtonWidgetAnnotationElement(parameters);
} else if (parameters.data.checkBox) {
return new CheckboxWidgetAnnotationElement(parameters);
}
(0, _util.warn)('Unimplemented button widget annotation: pushbutton');
break;
case 'Ch':
return new ChoiceWidgetAnnotationElement(parameters);
}
return new WidgetAnnotationElement(parameters);
case _util.AnnotationType.POPUP:
return new PopupAnnotationElement(parameters);
case _util.AnnotationType.LINE:
return new LineAnnotationElement(parameters);
case _util.AnnotationType.HIGHLIGHT:
return new HighlightAnnotationElement(parameters);
case _util.AnnotationType.UNDERLINE:
return new UnderlineAnnotationElement(parameters);
case _util.AnnotationType.SQUIGGLY:
return new SquigglyAnnotationElement(parameters);
case _util.AnnotationType.STRIKEOUT:
return new StrikeOutAnnotationElement(parameters);
case _util.AnnotationType.FILEATTACHMENT:
return new FileAttachmentAnnotationElement(parameters);
default:
return new AnnotationElement(parameters);
}
}
}]);
return AnnotationElementFactory;
}();
var AnnotationElement = function () {
function AnnotationElement(parameters) {
var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
_classCallCheck(this, AnnotationElement);
this.isRenderable = isRenderable;
this.data = parameters.data;
this.layer = parameters.layer;
this.page = parameters.page;
@ -83,8 +105,12 @@ var AnnotationElement = function AnnotationElementClosure() { @@ -83,8 +105,12 @@ var AnnotationElement = function AnnotationElementClosure() {
this.container = this._createContainer(ignoreBorder);
}
}
AnnotationElement.prototype = {
_createContainer: function AnnotationElement_createContainer(ignoreBorder) {
_createClass(AnnotationElement, [{
key: '_createContainer',
value: function _createContainer() {
var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var data = this.data,
page = this.page,
viewport = this.viewport;
@ -137,8 +163,10 @@ var AnnotationElement = function AnnotationElementClosure() { @@ -137,8 +163,10 @@ var AnnotationElement = function AnnotationElementClosure() {
container.style.width = width + 'px';
container.style.height = height + 'px';
return container;
},
_createPopup: function AnnotationElement_createPopup(container, trigger, data) {
}
}, {
key: '_createPopup',
value: function _createPopup(container, trigger, data) {
if (!trigger) {
trigger = document.createElement('div');
trigger.style.height = container.style.height;
@ -156,19 +184,29 @@ var AnnotationElement = function AnnotationElementClosure() { @@ -156,19 +184,29 @@ var AnnotationElement = function AnnotationElementClosure() {
var popup = popupElement.render();
popup.style.left = container.style.width;
container.appendChild(popup);
},
render: function AnnotationElement_render() {
throw new Error('Abstract method AnnotationElement.render called');
}
};
}, {
key: 'render',
value: function render() {
throw new Error('Abstract method `AnnotationElement.render` called');
}
}]);
return AnnotationElement;
}();
var LinkAnnotationElement = function LinkAnnotationElementClosure() {
function LinkAnnotationElement(parameters) {
AnnotationElement.call(this, parameters, true);
var LinkAnnotationElement = function (_AnnotationElement) {
_inherits(LinkAnnotationElement, _AnnotationElement);
function LinkAnnotationElement() {
_classCallCheck(this, LinkAnnotationElement);
return _possibleConstructorReturn(this, (LinkAnnotationElement.__proto__ || Object.getPrototypeOf(LinkAnnotationElement)).apply(this, arguments));
}
_util.Util.inherit(LinkAnnotationElement, AnnotationElement, {
render: function LinkAnnotationElement_render() {
_createClass(LinkAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'linkAnnotation';
var link = document.createElement('a');
(0, _dom_utils.addLinkAttributes)(link, {
@ -184,41 +222,53 @@ var LinkAnnotationElement = function LinkAnnotationElementClosure() { @@ -184,41 +222,53 @@ var LinkAnnotationElement = function LinkAnnotationElementClosure() {
}
this.container.appendChild(link);
return this.container;
},
_bindLink: function _bindLink(link, destination) {
var _this = this;
}
}, {
key: '_bindLink',
value: function _bindLink(link, destination) {
var _this2 = this;
link.href = this.linkService.getDestinationHash(destination);
link.onclick = function () {
if (destination) {
_this.linkService.navigateTo(destination);
_this2.linkService.navigateTo(destination);
}
return false;
};
if (destination) {
link.className = 'internalLink';
}
},
_bindNamedAction: function _bindNamedAction(link, action) {
var _this2 = this;
}
}, {
key: '_bindNamedAction',
value: function _bindNamedAction(link, action) {
var _this3 = this;
link.href = this.linkService.getAnchorUrl('');
link.onclick = function () {
_this2.linkService.executeNamedAction(action);
_this3.linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
}
});
}]);
return LinkAnnotationElement;
}();
var TextAnnotationElement = function TextAnnotationElementClosure() {
}(AnnotationElement);
var TextAnnotationElement = function (_AnnotationElement2) {
_inherits(TextAnnotationElement, _AnnotationElement2);
function TextAnnotationElement(parameters) {
_classCallCheck(this, TextAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable);
return _possibleConstructorReturn(this, (TextAnnotationElement.__proto__ || Object.getPrototypeOf(TextAnnotationElement)).call(this, parameters, isRenderable));
}
_util.Util.inherit(TextAnnotationElement, AnnotationElement, {
render: function TextAnnotationElement_render() {
_createClass(TextAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'textAnnotation';
var image = document.createElement('img');
image.style.height = this.container.style.height;
@ -233,28 +283,44 @@ var TextAnnotationElement = function TextAnnotationElementClosure() { @@ -233,28 +283,44 @@ var TextAnnotationElement = function TextAnnotationElementClosure() {
this.container.appendChild(image);
return this.container;
}
});
}]);
return TextAnnotationElement;
}();
var WidgetAnnotationElement = function WidgetAnnotationElementClosure() {
function WidgetAnnotationElement(parameters, isRenderable) {
AnnotationElement.call(this, parameters, isRenderable);
}(AnnotationElement);
var WidgetAnnotationElement = function (_AnnotationElement3) {
_inherits(WidgetAnnotationElement, _AnnotationElement3);
function WidgetAnnotationElement() {
_classCallCheck(this, WidgetAnnotationElement);
return _possibleConstructorReturn(this, (WidgetAnnotationElement.__proto__ || Object.getPrototypeOf(WidgetAnnotationElement)).apply(this, arguments));
}
_util.Util.inherit(WidgetAnnotationElement, AnnotationElement, {
render: function WidgetAnnotationElement_render() {
_createClass(WidgetAnnotationElement, [{
key: 'render',
value: function render() {
return this.container;
}
});
}]);
return WidgetAnnotationElement;
}();
var TextWidgetAnnotationElement = function TextWidgetAnnotationElementClosure() {
var TEXT_ALIGNMENT = ['left', 'center', 'right'];
}(AnnotationElement);
var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
_inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem);
function TextWidgetAnnotationElement(parameters) {
_classCallCheck(this, TextWidgetAnnotationElement);
var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
WidgetAnnotationElement.call(this, parameters, isRenderable);
return _possibleConstructorReturn(this, (TextWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(TextWidgetAnnotationElement)).call(this, parameters, isRenderable));
}
_util.Util.inherit(TextWidgetAnnotationElement, WidgetAnnotationElement, {
render: function TextWidgetAnnotationElement_render() {
_createClass(TextWidgetAnnotationElement, [{
key: 'render',
value: function render() {
var TEXT_ALIGNMENT = ['left', 'center', 'right'];
this.container.className = 'textWidgetAnnotation';
var element = null;
if (this.renderInteractiveForms) {
@ -292,8 +358,10 @@ var TextWidgetAnnotationElement = function TextWidgetAnnotationElementClosure() @@ -292,8 +358,10 @@ var TextWidgetAnnotationElement = function TextWidgetAnnotationElementClosure()
}
this.container.appendChild(element);
return this.container;
},
_setTextStyle: function TextWidgetAnnotationElement_setTextStyle(element, font) {
}
}, {
key: '_setTextStyle',
value: function _setTextStyle(element, font) {
var style = element.style;
style.fontSize = this.data.fontSize + 'px';
style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr';
@ -306,15 +374,23 @@ var TextWidgetAnnotationElement = function TextWidgetAnnotationElementClosure() @@ -306,15 +374,23 @@ var TextWidgetAnnotationElement = function TextWidgetAnnotationElementClosure()
var fallbackName = font.fallbackName || 'Helvetica, sans-serif';
style.fontFamily = fontFamily + fallbackName;
}
});
}]);
return TextWidgetAnnotationElement;
}();
var CheckboxWidgetAnnotationElement = function CheckboxWidgetAnnotationElementClosure() {
}(WidgetAnnotationElement);
var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) {
_inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2);
function CheckboxWidgetAnnotationElement(parameters) {
WidgetAnnotationElement.call(this, parameters, parameters.renderInteractiveForms);
_classCallCheck(this, CheckboxWidgetAnnotationElement);
return _possibleConstructorReturn(this, (CheckboxWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(CheckboxWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
}
_util.Util.inherit(CheckboxWidgetAnnotationElement, WidgetAnnotationElement, {
render: function CheckboxWidgetAnnotationElement_render() {
_createClass(CheckboxWidgetAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'buttonWidgetAnnotation checkBox';
var element = document.createElement('input');
element.disabled = this.data.readOnly;
@ -325,15 +401,23 @@ var CheckboxWidgetAnnotationElement = function CheckboxWidgetAnnotationElementCl @@ -325,15 +401,23 @@ var CheckboxWidgetAnnotationElement = function CheckboxWidgetAnnotationElementCl
this.container.appendChild(element);
return this.container;
}
});
}]);
return CheckboxWidgetAnnotationElement;
}();
var RadioButtonWidgetAnnotationElement = function RadioButtonWidgetAnnotationElementClosure() {
}(WidgetAnnotationElement);
var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) {
_inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3);
function RadioButtonWidgetAnnotationElement(parameters) {
WidgetAnnotationElement.call(this, parameters, parameters.renderInteractiveForms);
_classCallCheck(this, RadioButtonWidgetAnnotationElement);
return _possibleConstructorReturn(this, (RadioButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(RadioButtonWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
}
_util.Util.inherit(RadioButtonWidgetAnnotationElement, WidgetAnnotationElement, {
render: function RadioButtonWidgetAnnotationElement_render() {
_createClass(RadioButtonWidgetAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'buttonWidgetAnnotation radioButton';
var element = document.createElement('input');
element.disabled = this.data.readOnly;
@ -345,15 +429,23 @@ var RadioButtonWidgetAnnotationElement = function RadioButtonWidgetAnnotationEle @@ -345,15 +429,23 @@ var RadioButtonWidgetAnnotationElement = function RadioButtonWidgetAnnotationEle
this.container.appendChild(element);
return this.container;
}
});
}]);
return RadioButtonWidgetAnnotationElement;
}();
var ChoiceWidgetAnnotationElement = function ChoiceWidgetAnnotationElementClosure() {
}(WidgetAnnotationElement);
var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) {
_inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4);
function ChoiceWidgetAnnotationElement(parameters) {
WidgetAnnotationElement.call(this, parameters, parameters.renderInteractiveForms);
_classCallCheck(this, ChoiceWidgetAnnotationElement);
return _possibleConstructorReturn(this, (ChoiceWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
}
_util.Util.inherit(ChoiceWidgetAnnotationElement, WidgetAnnotationElement, {
render: function ChoiceWidgetAnnotationElement_render() {
_createClass(ChoiceWidgetAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'choiceWidgetAnnotation';
var selectElement = document.createElement('select');
selectElement.disabled = this.data.readOnly;
@ -376,17 +468,25 @@ var ChoiceWidgetAnnotationElement = function ChoiceWidgetAnnotationElementClosur @@ -376,17 +468,25 @@ var ChoiceWidgetAnnotationElement = function ChoiceWidgetAnnotationElementClosur
this.container.appendChild(selectElement);
return this.container;
}
});
}]);
return ChoiceWidgetAnnotationElement;
}();
var PopupAnnotationElement = function PopupAnnotationElementClosure() {
var IGNORE_TYPES = ['Line'];
}(WidgetAnnotationElement);
var PopupAnnotationElement = function (_AnnotationElement4) {
_inherits(PopupAnnotationElement, _AnnotationElement4);
function PopupAnnotationElement(parameters) {
_classCallCheck(this, PopupAnnotationElement);
var isRenderable = !!(parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable);
return _possibleConstructorReturn(this, (PopupAnnotationElement.__proto__ || Object.getPrototypeOf(PopupAnnotationElement)).call(this, parameters, isRenderable));
}
_util.Util.inherit(PopupAnnotationElement, AnnotationElement, {
render: function PopupAnnotationElement_render() {
_createClass(PopupAnnotationElement, [{
key: 'render',
value: function render() {
var IGNORE_TYPES = ['Line'];
this.container.className = 'popupAnnotation';
if (IGNORE_TYPES.indexOf(this.data.parentType) >= 0) {
return this.container;
@ -410,12 +510,15 @@ var PopupAnnotationElement = function PopupAnnotationElementClosure() { @@ -410,12 +510,15 @@ var PopupAnnotationElement = function PopupAnnotationElementClosure() {
this.container.appendChild(popup.render());
return this.container;
}
});
}]);
return PopupAnnotationElement;
}();
var PopupElement = function PopupElementClosure() {
var BACKGROUND_ENLIGHT = 0.7;
}(AnnotationElement);
var PopupElement = function () {
function PopupElement(parameters) {
_classCallCheck(this, PopupElement);
this.container = parameters.container;
this.trigger = parameters.trigger;
this.color = parameters.color;
@ -424,8 +527,11 @@ var PopupElement = function PopupElementClosure() { @@ -424,8 +527,11 @@ var PopupElement = function PopupElementClosure() {
this.hideWrapper = parameters.hideWrapper || false;
this.pinned = false;
}
PopupElement.prototype = {
render: function PopupElement_render() {
_createClass(PopupElement, [{
key: 'render',
value: function render() {
var BACKGROUND_ENLIGHT = 0.7;
var wrapper = document.createElement('div');
wrapper.className = 'popupWrapper';
this.hideElement = this.hideWrapper ? wrapper : this.container;
@ -450,8 +556,10 @@ var PopupElement = function PopupElementClosure() { @@ -450,8 +556,10 @@ var PopupElement = function PopupElementClosure() {
popup.appendChild(contents);
wrapper.appendChild(popup);
return wrapper;
},
_formatContents: function PopupElement_formatContents(contents) {
}
}, {
key: '_formatContents',
value: function _formatContents(contents) {
var p = document.createElement('p');
var lines = contents.split(/(?:\r\n?|\n)/);
for (var i = 0, ii = lines.length; i < ii; ++i) {
@ -462,15 +570,21 @@ var PopupElement = function PopupElementClosure() { @@ -462,15 +570,21 @@ var PopupElement = function PopupElementClosure() {
}
}
return p;
},
_toggle: function PopupElement_toggle() {
}
}, {
key: '_toggle',
value: function _toggle() {
if (this.pinned) {
this._hide(true);
} else {
this._show(true);
}
},
_show: function PopupElement_show(pin) {
}
}, {
key: '_show',
value: function _show() {
var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (pin) {
this.pinned = true;
}
@ -478,8 +592,12 @@ var PopupElement = function PopupElementClosure() { @@ -478,8 +592,12 @@ var PopupElement = function PopupElementClosure() {
this.hideElement.removeAttribute('hidden');
this.container.style.zIndex += 1;
}
},
_hide: function PopupElement_hide(unpin) {
}
}, {
key: '_hide',
value: function _hide() {
var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (unpin) {
this.pinned = false;
}
@ -488,17 +606,25 @@ var PopupElement = function PopupElementClosure() { @@ -488,17 +606,25 @@ var PopupElement = function PopupElementClosure() {
this.container.style.zIndex -= 1;
}
}
};
}]);
return PopupElement;
}();
var LineAnnotationElement = function LineAnnotationElementClosure() {
var SVG_NS = 'http://www.w3.org/2000/svg';
var LineAnnotationElement = function (_AnnotationElement5) {
_inherits(LineAnnotationElement, _AnnotationElement5);
function LineAnnotationElement(parameters) {
_classCallCheck(this, LineAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable, true);
return _possibleConstructorReturn(this, (LineAnnotationElement.__proto__ || Object.getPrototypeOf(LineAnnotationElement)).call(this, parameters, isRenderable, true));
}
_util.Util.inherit(LineAnnotationElement, AnnotationElement, {
render: function LineAnnotationElement_render() {
_createClass(LineAnnotationElement, [{
key: 'render',
value: function render() {
var SVG_NS = 'http://www.w3.org/2000/svg';
this.container.className = 'lineAnnotation';
var data = this.data;
var width = data.rect[2] - data.rect[0];
@ -521,87 +647,129 @@ var LineAnnotationElement = function LineAnnotationElementClosure() { @@ -521,87 +647,129 @@ var LineAnnotationElement = function LineAnnotationElementClosure() {
this._createPopup(this.container, line, this.data);
return this.container;
}
});
}]);
return LineAnnotationElement;
}();
var HighlightAnnotationElement = function HighlightAnnotationElementClosure() {
}(AnnotationElement);
var HighlightAnnotationElement = function (_AnnotationElement6) {
_inherits(HighlightAnnotationElement, _AnnotationElement6);
function HighlightAnnotationElement(parameters) {
_classCallCheck(this, HighlightAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable, true);
return _possibleConstructorReturn(this, (HighlightAnnotationElement.__proto__ || Object.getPrototypeOf(HighlightAnnotationElement)).call(this, parameters, isRenderable, true));
}
_util.Util.inherit(HighlightAnnotationElement, AnnotationElement, {
render: function HighlightAnnotationElement_render() {
_createClass(HighlightAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'highlightAnnotation';
if (!this.data.hasPopup) {
this._createPopup(this.container, null, this.data);
}
return this.container;
}
});
}]);
return HighlightAnnotationElement;
}();
var UnderlineAnnotationElement = function UnderlineAnnotationElementClosure() {
}(AnnotationElement);
var UnderlineAnnotationElement = function (_AnnotationElement7) {
_inherits(UnderlineAnnotationElement, _AnnotationElement7);
function UnderlineAnnotationElement(parameters) {
_classCallCheck(this, UnderlineAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable, true);
return _possibleConstructorReturn(this, (UnderlineAnnotationElement.__proto__ || Object.getPrototypeOf(UnderlineAnnotationElement)).call(this, parameters, isRenderable, true));
}
_util.Util.inherit(UnderlineAnnotationElement, AnnotationElement, {
render: function UnderlineAnnotationElement_render() {
_createClass(UnderlineAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'underlineAnnotation';
if (!this.data.hasPopup) {
this._createPopup(this.container, null, this.data);
}
return this.container;
}
});
}]);
return UnderlineAnnotationElement;
}();
var SquigglyAnnotationElement = function SquigglyAnnotationElementClosure() {
}(AnnotationElement);
var SquigglyAnnotationElement = function (_AnnotationElement8) {
_inherits(SquigglyAnnotationElement, _AnnotationElement8);
function SquigglyAnnotationElement(parameters) {
_classCallCheck(this, SquigglyAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable, true);
return _possibleConstructorReturn(this, (SquigglyAnnotationElement.__proto__ || Object.getPrototypeOf(SquigglyAnnotationElement)).call(this, parameters, isRenderable, true));
}
_util.Util.inherit(SquigglyAnnotationElement, AnnotationElement, {
render: function SquigglyAnnotationElement_render() {
_createClass(SquigglyAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'squigglyAnnotation';
if (!this.data.hasPopup) {
this._createPopup(this.container, null, this.data);
}
return this.container;
}
});
}]);
return SquigglyAnnotationElement;
}();
var StrikeOutAnnotationElement = function StrikeOutAnnotationElementClosure() {
}(AnnotationElement);
var StrikeOutAnnotationElement = function (_AnnotationElement9) {
_inherits(StrikeOutAnnotationElement, _AnnotationElement9);
function StrikeOutAnnotationElement(parameters) {
_classCallCheck(this, StrikeOutAnnotationElement);
var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
AnnotationElement.call(this, parameters, isRenderable, true);
return _possibleConstructorReturn(this, (StrikeOutAnnotationElement.__proto__ || Object.getPrototypeOf(StrikeOutAnnotationElement)).call(this, parameters, isRenderable, true));
}
_util.Util.inherit(StrikeOutAnnotationElement, AnnotationElement, {
render: function StrikeOutAnnotationElement_render() {
_createClass(StrikeOutAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'strikeoutAnnotation';
if (!this.data.hasPopup) {
this._createPopup(this.container, null, this.data);
}
return this.container;
}
});
}]);
return StrikeOutAnnotationElement;
}();
var FileAttachmentAnnotationElement = function FileAttachmentAnnotationElementClosure() {
}(AnnotationElement);
var FileAttachmentAnnotationElement = function (_AnnotationElement10) {
_inherits(FileAttachmentAnnotationElement, _AnnotationElement10);
function FileAttachmentAnnotationElement(parameters) {
AnnotationElement.call(this, parameters, true);
var file = this.data.file;
this.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
this.content = file.content;
this.linkService.onFileAttachmentAnnotation({
_classCallCheck(this, FileAttachmentAnnotationElement);
var _this16 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
var file = _this16.data.file;
_this16.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename);
_this16.content = file.content;
_this16.linkService.onFileAttachmentAnnotation({
id: (0, _util.stringToPDFString)(file.filename),
filename: file.filename,
content: file.content
});
return _this16;
}
_util.Util.inherit(FileAttachmentAnnotationElement, AnnotationElement, {
render: function FileAttachmentAnnotationElement_render() {
_createClass(FileAttachmentAnnotationElement, [{
key: 'render',
value: function render() {
this.container.className = 'fileAttachmentAnnotation';
var trigger = document.createElement('div');
trigger.style.height = this.container.style.height;
@ -612,27 +780,35 @@ var FileAttachmentAnnotationElement = function FileAttachmentAnnotationElementCl @@ -612,27 +780,35 @@ var FileAttachmentAnnotationElement = function FileAttachmentAnnotationElementCl
}
this.container.appendChild(trigger);
return this.container;
},
_download: function FileAttachmentAnnotationElement_download() {
}
}, {
key: '_download',
value: function _download() {
if (!this.downloadManager) {
(0, _util.warn)('Download cannot be started due to unavailable download manager');
return;
}
this.downloadManager.downloadData(this.content, this.filename, '');
}
});
}]);
return FileAttachmentAnnotationElement;
}();
var AnnotationLayer = function AnnotationLayerClosure() {
return {
render: function AnnotationLayer_render(parameters) {
var annotationElementFactory = new AnnotationElementFactory();
}(AnnotationElement);
var AnnotationLayer = function () {
function AnnotationLayer() {
_classCallCheck(this, AnnotationLayer);
}
_createClass(AnnotationLayer, null, [{
key: 'render',
value: function render(parameters) {
for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
var data = parameters.annotations[i];
if (!data) {
continue;
}
var element = annotationElementFactory.create({
var element = AnnotationElementFactory.create({
data: data,
layer: parameters.div,
page: parameters.page,
@ -646,8 +822,10 @@ var AnnotationLayer = function AnnotationLayerClosure() { @@ -646,8 +822,10 @@ var AnnotationLayer = function AnnotationLayerClosure() {
parameters.div.appendChild(element.render());
}
}
},
update: function AnnotationLayer_update(parameters) {
}
}, {
key: 'update',
value: function update(parameters) {
for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
var data = parameters.annotations[i];
var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]');
@ -657,6 +835,9 @@ var AnnotationLayer = function AnnotationLayerClosure() { @@ -657,6 +835,9 @@ var AnnotationLayer = function AnnotationLayerClosure() {
}
parameters.div.removeAttribute('hidden');
}
};
}]);
return AnnotationLayer;
}();
exports.AnnotationLayer = AnnotationLayer;

4
lib/display/api.js

@ -1581,8 +1581,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1581,8 +1581,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.9.496';
exports.build = build = '26568254';
exports.version = version = '1.9.502';
exports.build = build = 'a4cc85fc';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -45,8 +45,8 @@ if (!_global_scope2.default.PDFJS) { @@ -45,8 +45,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '1.9.496';
PDFJS.build = '26568254';
PDFJS.version = '1.9.502';
PDFJS.build = 'a4cc85fc';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.9.496';
var pdfjsBuild = '26568254';
var pdfjsVersion = '1.9.502';
var pdfjsBuild = 'a4cc85fc';
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,7 +14,7 @@ @@ -14,7 +14,7 @@
*/
'use strict';
var pdfjsVersion = '1.9.496';
var pdfjsBuild = '26568254';
var pdfjsVersion = '1.9.502';
var pdfjsBuild = 'a4cc85fc';
var pdfjsCoreWorker = require('./core/worker.js');
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

90
lib/test/unit/annotation_spec.js

@ -41,15 +41,13 @@ describe('annotation', function () { @@ -41,15 +41,13 @@ describe('annotation', function () {
};
}
IdFactoryMock.prototype = {};
var annotationFactory, pdfManagerMock, idFactoryMock;
var pdfManagerMock, idFactoryMock;
beforeAll(function (done) {
annotationFactory = new _annotation.AnnotationFactory();
pdfManagerMock = new PDFManagerMock({ docBaseUrl: null });
idFactoryMock = new IdFactoryMock({});
done();
});
afterAll(function () {
annotationFactory = null;
pdfManagerMock = null;
idFactoryMock = null;
});
@ -63,7 +61,7 @@ describe('annotation', function () { @@ -63,7 +61,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.id).toEqual('10R');
@ -77,8 +75,8 @@ describe('annotation', function () { @@ -77,8 +75,8 @@ describe('annotation', function () {
prefix: 'p0_',
startObjId: 0
});
var annotation1 = annotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory);
var annotation2 = annotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory);
var annotation1 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory);
var annotation2 = _annotation.AnnotationFactory.create(xref, annotationDict, pdfManagerMock, idFactory);
var data1 = annotation1.data,
data2 = annotation2.data;
expect(data1.annotationType).toEqual(_util.AnnotationType.LINK);
@ -94,7 +92,7 @@ describe('annotation', function () { @@ -94,7 +92,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toBeUndefined();
});
@ -260,7 +258,7 @@ describe('annotation', function () { @@ -260,7 +258,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual('http://www.ctan.org/tex-archive/info/lshort');
@ -281,7 +279,7 @@ describe('annotation', function () { @@ -281,7 +279,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual('http://www.hmrc.gov.uk/');
@ -302,7 +300,7 @@ describe('annotation', function () { @@ -302,7 +300,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual(new URL((0, _util.stringToUTF8String)('http://www.example.com/\xC3\xBC\xC3\xB6\xC3\xA4')).href);
@ -323,7 +321,7 @@ describe('annotation', function () { @@ -323,7 +321,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toBeUndefined();
@ -346,7 +344,7 @@ describe('annotation', function () { @@ -346,7 +344,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toBeUndefined();
@ -370,7 +368,7 @@ describe('annotation', function () { @@ -370,7 +368,7 @@ describe('annotation', function () {
data: annotationDict
}]);
var pdfManager = new PDFManagerMock({ docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf' });
var annotation = annotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual('http://www.example.com/0013/001346/134685E.pdf#4.3');
@ -392,7 +390,7 @@ describe('annotation', function () { @@ -392,7 +390,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual('http://www.example.com/test.pdf#15');
@ -415,7 +413,7 @@ describe('annotation', function () { @@ -415,7 +413,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual(new URL('http://www.example.com/test.pdf#' + '[14,{"name":"XYZ"},null,298.043,null]').href);
@ -443,7 +441,7 @@ describe('annotation', function () { @@ -443,7 +441,7 @@ describe('annotation', function () {
data: annotationDict
}]);
var pdfManager = new PDFManagerMock({ docBaseUrl: 'http://www.example.com/test/pdfs/qwerty.pdf' });
var annotation = annotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManager, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual(new URL('http://www.example.com/test/pdfs/Part II/Part II.pdf').href);
@ -470,7 +468,7 @@ describe('annotation', function () { @@ -470,7 +468,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toEqual(expectedUrl);
@ -511,7 +509,7 @@ describe('annotation', function () { @@ -511,7 +509,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toBeUndefined();
@ -528,7 +526,7 @@ describe('annotation', function () { @@ -528,7 +526,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toBeUndefined();
@ -545,7 +543,7 @@ describe('annotation', function () { @@ -545,7 +543,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toBeUndefined();
@ -569,7 +567,7 @@ describe('annotation', function () { @@ -569,7 +567,7 @@ describe('annotation', function () {
ref: annotationRef,
data: annotationDict
}]);
var annotation = annotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, annotationRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINK);
expect(data.url).toBeUndefined();
@ -594,7 +592,7 @@ describe('annotation', function () { @@ -594,7 +592,7 @@ describe('annotation', function () {
ref: widgetRef,
data: widgetDict
}]);
var annotation = annotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.fieldName).toEqual('');
@ -606,7 +604,7 @@ describe('annotation', function () { @@ -606,7 +604,7 @@ describe('annotation', function () {
ref: widgetRef,
data: widgetDict
}]);
var annotation = annotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.fieldName).toEqual('foo');
@ -624,7 +622,7 @@ describe('annotation', function () { @@ -624,7 +622,7 @@ describe('annotation', function () {
ref: widgetRef,
data: widgetDict
}]);
var annotation = annotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.fieldName).toEqual('foo.bar.baz');
@ -640,7 +638,7 @@ describe('annotation', function () { @@ -640,7 +638,7 @@ describe('annotation', function () {
ref: widgetRef,
data: widgetDict
}]);
var annotation = annotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, widgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.fieldName).toEqual('foo.bar');
@ -664,7 +662,7 @@ describe('annotation', function () { @@ -664,7 +662,7 @@ describe('annotation', function () {
ref: textWidgetRef,
data: textWidgetDict
}]);
var annotation = annotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.textAlignment).toEqual(null);
@ -682,7 +680,7 @@ describe('annotation', function () { @@ -682,7 +680,7 @@ describe('annotation', function () {
ref: textWidgetRef,
data: textWidgetDict
}]);
var annotation = annotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.textAlignment).toEqual(null);
@ -700,7 +698,7 @@ describe('annotation', function () { @@ -700,7 +698,7 @@ describe('annotation', function () {
ref: textWidgetRef,
data: textWidgetDict
}]);
var annotation = annotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.textAlignment).toEqual(1);
@ -715,7 +713,7 @@ describe('annotation', function () { @@ -715,7 +713,7 @@ describe('annotation', function () {
ref: textWidgetRef,
data: textWidgetDict
}]);
var annotation = annotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.comb).toEqual(false);
@ -728,7 +726,7 @@ describe('annotation', function () { @@ -728,7 +726,7 @@ describe('annotation', function () {
ref: textWidgetRef,
data: textWidgetDict
}]);
var annotation = annotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.comb).toEqual(true);
@ -744,7 +742,7 @@ describe('annotation', function () { @@ -744,7 +742,7 @@ describe('annotation', function () {
ref: textWidgetRef,
data: textWidgetDict
}]);
var annotation = annotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, textWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
var valid = invalidFieldFlags.length === 0;
@ -774,7 +772,7 @@ describe('annotation', function () { @@ -774,7 +772,7 @@ describe('annotation', function () {
ref: buttonWidgetRef,
data: buttonWidgetDict
}]);
var annotation = annotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.checkBox).toEqual(true);
@ -796,7 +794,7 @@ describe('annotation', function () { @@ -796,7 +794,7 @@ describe('annotation', function () {
ref: buttonWidgetRef,
data: buttonWidgetDict
}]);
var annotation = annotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.checkBox).toEqual(false);
@ -816,7 +814,7 @@ describe('annotation', function () { @@ -816,7 +814,7 @@ describe('annotation', function () {
ref: buttonWidgetRef,
data: buttonWidgetDict
}]);
var annotation = annotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, buttonWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.checkBox).toEqual(false);
@ -843,7 +841,7 @@ describe('annotation', function () { @@ -843,7 +841,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.options).toEqual([]);
@ -873,7 +871,7 @@ describe('annotation', function () { @@ -873,7 +871,7 @@ describe('annotation', function () {
ref: optionOneRef,
data: optionOneArr
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.options).toEqual(expected);
@ -898,7 +896,7 @@ describe('annotation', function () { @@ -898,7 +896,7 @@ describe('annotation', function () {
ref: optionBarRef,
data: optionBarStr
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.options).toEqual(expected);
@ -920,7 +918,7 @@ describe('annotation', function () { @@ -920,7 +918,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.options).toEqual(expected);
@ -933,7 +931,7 @@ describe('annotation', function () { @@ -933,7 +931,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.fieldValue).toEqual(fieldValue);
@ -946,7 +944,7 @@ describe('annotation', function () { @@ -946,7 +944,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.fieldValue).toEqual([fieldValue]);
@ -957,7 +955,7 @@ describe('annotation', function () { @@ -957,7 +955,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.readOnly).toEqual(false);
@ -971,7 +969,7 @@ describe('annotation', function () { @@ -971,7 +969,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.readOnly).toEqual(false);
@ -985,7 +983,7 @@ describe('annotation', function () { @@ -985,7 +983,7 @@ describe('annotation', function () {
ref: choiceWidgetRef,
data: choiceWidgetDict
}]);
var annotation = annotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, choiceWidgetRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.WIDGET);
expect(data.readOnly).toEqual(true);
@ -1004,7 +1002,7 @@ describe('annotation', function () { @@ -1004,7 +1002,7 @@ describe('annotation', function () {
ref: lineRef,
data: lineDict
}]);
var annotation = annotationFactory.create(xref, lineRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, lineRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.LINE);
expect(data.lineCoordinates).toEqual([1, 2, 3, 4]);
@ -1045,7 +1043,7 @@ describe('annotation', function () { @@ -1045,7 +1043,7 @@ describe('annotation', function () {
embeddedFileDict.assignXref(xref);
fileSpecDict.assignXref(xref);
fileAttachmentDict.assignXref(xref);
var annotation = annotationFactory.create(xref, fileAttachmentRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, fileAttachmentRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.FILEATTACHMENT);
expect(data.file.filename).toEqual('Test.txt');
@ -1068,7 +1066,7 @@ describe('annotation', function () { @@ -1068,7 +1066,7 @@ describe('annotation', function () {
ref: popupRef,
data: popupDict
}]);
var annotation = annotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock);
var annotation = _annotation.AnnotationFactory.create(xref, popupRef, pdfManagerMock, idFactoryMock);
var data = annotation.data;
expect(data.annotationType).toEqual(_util.AnnotationType.POPUP);
expect(data.annotationFlags).toEqual(25);

2
package.json

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

1583
web/compatibility.js

File diff suppressed because it is too large Load Diff

2
web/compatibility.js.map

File diff suppressed because one or more lines are too long

3305
web/pdf_viewer.js

File diff suppressed because it is too large Load Diff

2
web/pdf_viewer.js.map

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