|
@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {}));
|
|
// Use strict in our context only - users might not want it
|
|
// Use strict in our context only - users might not want it
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
-var pdfjsVersion = '1.6.214';
|
|
|
|
-var pdfjsBuild = '7b2a9ee';
|
|
|
|
|
|
+var pdfjsVersion = '1.6.217';
|
|
|
|
+var pdfjsBuild = '9b3a91f';
|
|
|
|
|
|
var pdfjsFilePath =
|
|
var pdfjsFilePath =
|
|
typeof document !== 'undefined' && document.currentScript ?
|
|
typeof document !== 'undefined' && document.currentScript ?
|
|
@@ -1878,15 +1878,15 @@ var Util = (function UtilClosure() {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- Util.getInheritableProperty = function Util_getInheritableProperty(dict,
|
|
|
|
- name) {
|
|
|
|
|
|
+ Util.getInheritableProperty =
|
|
|
|
+ function Util_getInheritableProperty(dict, name, getArray) {
|
|
while (dict && !dict.has(name)) {
|
|
while (dict && !dict.has(name)) {
|
|
dict = dict.get('Parent');
|
|
dict = dict.get('Parent');
|
|
}
|
|
}
|
|
if (!dict) {
|
|
if (!dict) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- return dict.get(name);
|
|
|
|
|
|
+ return getArray ? dict.getArray(name) : dict.get(name);
|
|
};
|
|
};
|
|
|
|
|
|
Util.inherit = function Util_inherit(sub, base, prototype) {
|
|
Util.inherit = function Util_inherit(sub, base, prototype) {
|
|
@@ -24229,6 +24229,8 @@ AnnotationElementFactory.prototype =
|
|
switch (fieldType) {
|
|
switch (fieldType) {
|
|
case 'Tx':
|
|
case 'Tx':
|
|
return new TextWidgetAnnotationElement(parameters);
|
|
return new TextWidgetAnnotationElement(parameters);
|
|
|
|
+ case 'Ch':
|
|
|
|
+ return new ChoiceWidgetAnnotationElement(parameters);
|
|
}
|
|
}
|
|
return new WidgetAnnotationElement(parameters);
|
|
return new WidgetAnnotationElement(parameters);
|
|
|
|
|
|
@@ -24553,9 +24555,7 @@ var TextAnnotationElement = (function TextAnnotationElementClosure() {
|
|
* @alias WidgetAnnotationElement
|
|
* @alias WidgetAnnotationElement
|
|
*/
|
|
*/
|
|
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
|
|
var WidgetAnnotationElement = (function WidgetAnnotationElementClosure() {
|
|
- function WidgetAnnotationElement(parameters) {
|
|
|
|
- var isRenderable = parameters.renderInteractiveForms ||
|
|
|
|
- (!parameters.data.hasAppearance && !!parameters.data.fieldValue);
|
|
|
|
|
|
+ function WidgetAnnotationElement(parameters, isRenderable) {
|
|
AnnotationElement.call(this, parameters, isRenderable);
|
|
AnnotationElement.call(this, parameters, isRenderable);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -24585,7 +24585,9 @@ var TextWidgetAnnotationElement = (
|
|
var TEXT_ALIGNMENT = ['left', 'center', 'right'];
|
|
var TEXT_ALIGNMENT = ['left', 'center', 'right'];
|
|
|
|
|
|
function TextWidgetAnnotationElement(parameters) {
|
|
function TextWidgetAnnotationElement(parameters) {
|
|
- WidgetAnnotationElement.call(this, parameters);
|
|
|
|
|
|
+ var isRenderable = parameters.renderInteractiveForms ||
|
|
|
|
+ (!parameters.data.hasAppearance && !!parameters.data.fieldValue);
|
|
|
|
+ WidgetAnnotationElement.call(this, parameters, isRenderable);
|
|
}
|
|
}
|
|
|
|
|
|
Util.inherit(TextWidgetAnnotationElement, WidgetAnnotationElement, {
|
|
Util.inherit(TextWidgetAnnotationElement, WidgetAnnotationElement, {
|
|
@@ -24681,6 +24683,64 @@ var TextWidgetAnnotationElement = (
|
|
return TextWidgetAnnotationElement;
|
|
return TextWidgetAnnotationElement;
|
|
})();
|
|
})();
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * @class
|
|
|
|
+ * @alias ChoiceWidgetAnnotationElement
|
|
|
|
+ */
|
|
|
|
+var ChoiceWidgetAnnotationElement = (
|
|
|
|
+ function ChoiceWidgetAnnotationElementClosure() {
|
|
|
|
+ function ChoiceWidgetAnnotationElement(parameters) {
|
|
|
|
+ WidgetAnnotationElement.call(this, parameters,
|
|
|
|
+ parameters.renderInteractiveForms);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Util.inherit(ChoiceWidgetAnnotationElement, WidgetAnnotationElement, {
|
|
|
|
+ /**
|
|
|
|
+ * Render the choice widget annotation's HTML element in the empty
|
|
|
|
+ * container.
|
|
|
|
+ *
|
|
|
|
+ * @public
|
|
|
|
+ * @memberof ChoiceWidgetAnnotationElement
|
|
|
|
+ * @returns {HTMLSectionElement}
|
|
|
|
+ */
|
|
|
|
+ render: function ChoiceWidgetAnnotationElement_render() {
|
|
|
|
+ this.container.className = 'choiceWidgetAnnotation';
|
|
|
|
+
|
|
|
|
+ var selectElement = document.createElement('select');
|
|
|
|
+ selectElement.disabled = this.data.readOnly;
|
|
|
|
+
|
|
|
|
+ if (!this.data.combo) {
|
|
|
|
+ // List boxes have a size and (optionally) multiple selection.
|
|
|
|
+ selectElement.size = this.data.options.length;
|
|
|
|
+
|
|
|
|
+ if (this.data.multiSelect) {
|
|
|
|
+ selectElement.multiple = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Insert the options into the choice field.
|
|
|
|
+ for (var i = 0, ii = this.data.options.length; i < ii; i++) {
|
|
|
|
+ var option = this.data.options[i];
|
|
|
|
+
|
|
|
|
+ var optionElement = document.createElement('option');
|
|
|
|
+ optionElement.textContent = option.displayValue;
|
|
|
|
+ optionElement.value = option.exportValue;
|
|
|
|
+
|
|
|
|
+ if (this.data.fieldValue.indexOf(option.displayValue) >= 0) {
|
|
|
|
+ optionElement.setAttribute('selected', true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ selectElement.appendChild(optionElement);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.container.appendChild(selectElement);
|
|
|
|
+ return this.container;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return ChoiceWidgetAnnotationElement;
|
|
|
|
+})();
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @class
|
|
* @class
|
|
* @alias PopupAnnotationElement
|
|
* @alias PopupAnnotationElement
|
|
@@ -49229,6 +49289,8 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
|
switch (fieldType) {
|
|
switch (fieldType) {
|
|
case 'Tx':
|
|
case 'Tx':
|
|
return new TextWidgetAnnotation(parameters);
|
|
return new TextWidgetAnnotation(parameters);
|
|
|
|
+ case 'Ch':
|
|
|
|
+ return new ChoiceWidgetAnnotation(parameters);
|
|
}
|
|
}
|
|
warn('Unimplemented widget field type "' + fieldType + '", ' +
|
|
warn('Unimplemented widget field type "' + fieldType + '", ' +
|
|
'falling back to base field type.');
|
|
'falling back to base field type.');
|
|
@@ -49742,8 +49804,8 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {
|
|
var data = this.data;
|
|
var data = this.data;
|
|
|
|
|
|
data.annotationType = AnnotationType.WIDGET;
|
|
data.annotationType = AnnotationType.WIDGET;
|
|
- data.fieldValue = stringToPDFString(
|
|
|
|
- Util.getInheritableProperty(dict, 'V') || '');
|
|
|
|
|
|
+ data.fieldValue = Util.getInheritableProperty(dict, 'V',
|
|
|
|
+ /* getArray = */ true);
|
|
data.alternativeText = stringToPDFString(dict.get('TU') || '');
|
|
data.alternativeText = stringToPDFString(dict.get('TU') || '');
|
|
data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
|
|
data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || '';
|
|
var fieldType = Util.getInheritableProperty(dict, 'FT');
|
|
var fieldType = Util.getInheritableProperty(dict, 'FT');
|
|
@@ -49755,6 +49817,8 @@ var WidgetAnnotation = (function WidgetAnnotationClosure() {
|
|
data.fieldFlags = 0;
|
|
data.fieldFlags = 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
|
|
|
|
+
|
|
// Hide signatures because we cannot validate them.
|
|
// Hide signatures because we cannot validate them.
|
|
if (data.fieldType === 'Sig') {
|
|
if (data.fieldType === 'Sig') {
|
|
this.setFlags(AnnotationFlag.HIDDEN);
|
|
this.setFlags(AnnotationFlag.HIDDEN);
|
|
@@ -49816,6 +49880,9 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
|
|
function TextWidgetAnnotation(params) {
|
|
function TextWidgetAnnotation(params) {
|
|
WidgetAnnotation.call(this, params);
|
|
WidgetAnnotation.call(this, params);
|
|
|
|
|
|
|
|
+ // The field value is always a string.
|
|
|
|
+ this.data.fieldValue = stringToPDFString(this.data.fieldValue || '');
|
|
|
|
+
|
|
// Determine the alignment of text in the field.
|
|
// Determine the alignment of text in the field.
|
|
var alignment = Util.getInheritableProperty(params.dict, 'Q');
|
|
var alignment = Util.getInheritableProperty(params.dict, 'Q');
|
|
if (!isInt(alignment) || alignment < 0 || alignment > 2) {
|
|
if (!isInt(alignment) || alignment < 0 || alignment > 2) {
|
|
@@ -49831,7 +49898,6 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
|
|
this.data.maxLen = maximumLength;
|
|
this.data.maxLen = maximumLength;
|
|
|
|
|
|
// Process field flags for the display layer.
|
|
// Process field flags for the display layer.
|
|
- this.data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
|
|
|
|
this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
|
|
this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
|
|
this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) &&
|
|
this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) &&
|
|
!this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) &&
|
|
!this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) &&
|
|
@@ -49875,6 +49941,62 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
|
|
return TextWidgetAnnotation;
|
|
return TextWidgetAnnotation;
|
|
})();
|
|
})();
|
|
|
|
|
|
|
|
+var ChoiceWidgetAnnotation = (function ChoiceWidgetAnnotationClosure() {
|
|
|
|
+ function ChoiceWidgetAnnotation(params) {
|
|
|
|
+ WidgetAnnotation.call(this, params);
|
|
|
|
+
|
|
|
|
+ // Determine the options. The options array may consist of strings or
|
|
|
|
+ // arrays. If the array consists of arrays, then the first element of
|
|
|
|
+ // each array is the export value and the second element of each array is
|
|
|
|
+ // the display value. If the array consists of strings, then these
|
|
|
|
+ // represent both the export and display value. In this case, we convert
|
|
|
|
+ // it to an array of arrays as well for convenience in the display layer.
|
|
|
|
+ this.data.options = [];
|
|
|
|
+
|
|
|
|
+ var options = params.dict.getArray('Opt');
|
|
|
|
+ if (isArray(options)) {
|
|
|
|
+ for (var i = 0, ii = options.length; i < ii; i++) {
|
|
|
|
+ var option = options[i];
|
|
|
|
+
|
|
|
|
+ this.data.options[i] = {
|
|
|
|
+ exportValue: isArray(option) ? option[0] : option,
|
|
|
|
+ displayValue: isArray(option) ? option[1] : option,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Determine the field value. In this case, it may be a string or an
|
|
|
|
+ // array of strings. For convenience in the display layer, convert the
|
|
|
|
+ // string to an array of one string as well.
|
|
|
|
+ if (!isArray(this.data.fieldValue)) {
|
|
|
|
+ this.data.fieldValue = [this.data.fieldValue];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Process field flags for the display layer.
|
|
|
|
+ this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
|
|
|
|
+ this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, {
|
|
|
|
+ getOperatorList:
|
|
|
|
+ function ChoiceWidgetAnnotation_getOperatorList(evaluator, task,
|
|
|
|
+ renderForms) {
|
|
|
|
+ var operatorList = new OperatorList();
|
|
|
|
+
|
|
|
|
+ // Do not render form elements on the canvas when interactive forms are
|
|
|
|
+ // enabled. The display layer is responsible for rendering them instead.
|
|
|
|
+ if (renderForms) {
|
|
|
|
+ return Promise.resolve(operatorList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Annotation.prototype.getOperatorList.call(this, evaluator, task,
|
|
|
|
+ renderForms);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return ChoiceWidgetAnnotation;
|
|
|
|
+})();
|
|
|
|
+
|
|
var TextAnnotation = (function TextAnnotationClosure() {
|
|
var TextAnnotation = (function TextAnnotationClosure() {
|
|
var DEFAULT_ICON_SIZE = 22; // px
|
|
var DEFAULT_ICON_SIZE = 22; // px
|
|
|
|
|