@syncfusion/ej2-pdf 25.2.3 → 25.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/ej2-pdf.umd.min.js +2 -2
- package/dist/ej2-pdf.umd.min.js.map +1 -1
- package/dist/es6/ej2-pdf.es2015.js +267 -77
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +285 -77
- package/dist/es6/ej2-pdf.es5.js.map +1 -1
- package/dist/global/ej2-pdf.min.js +2 -2
- package/dist/global/ej2-pdf.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +6 -6
- package/src/pdf/core/annotations/annotation.d.ts +5 -1
- package/src/pdf/core/annotations/annotation.js +69 -23
- package/src/pdf/core/form/field.d.ts +75 -1
- package/src/pdf/core/form/field.js +216 -54
package/dist/es6/ej2-pdf.es5.js
CHANGED
|
@@ -15450,6 +15450,7 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
15450
15450
|
function PdfField() {
|
|
15451
15451
|
this._visible = true;
|
|
15452
15452
|
this._isTransparentBackColor = false;
|
|
15453
|
+
this._isTransparentBorderColor = false;
|
|
15453
15454
|
this._defaultFont = new PdfStandardFont(PdfFontFamily.helvetica, 8);
|
|
15454
15455
|
this._appearanceFont = new PdfStandardFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
|
|
15455
15456
|
this._defaultItemFont = new PdfStandardFont(PdfFontFamily.timesRoman, 12);
|
|
@@ -16069,29 +16070,12 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
16069
16070
|
* ```
|
|
16070
16071
|
*/
|
|
16071
16072
|
get: function () {
|
|
16072
|
-
|
|
16073
|
-
var widget = this.itemAt(this._defaultIndex);
|
|
16074
|
-
if (widget && widget.borderColor) {
|
|
16075
|
-
value = widget.borderColor;
|
|
16076
|
-
}
|
|
16077
|
-
else if (this._mkDictionary) {
|
|
16078
|
-
var dictionary = this._mkDictionary;
|
|
16079
|
-
if (dictionary && dictionary.has('BC')) {
|
|
16080
|
-
var colorArray = dictionary.getArray('BC');
|
|
16081
|
-
if (colorArray) {
|
|
16082
|
-
value = _parseColor(colorArray);
|
|
16083
|
-
}
|
|
16084
|
-
}
|
|
16085
|
-
}
|
|
16086
|
-
if (typeof value === 'undefined' || value === null) {
|
|
16087
|
-
value = [0, 0, 0];
|
|
16088
|
-
}
|
|
16089
|
-
return value;
|
|
16073
|
+
return this._parseBorderColor(true);
|
|
16090
16074
|
},
|
|
16091
16075
|
/**
|
|
16092
16076
|
* Sets the border color of the field.
|
|
16093
16077
|
*
|
|
16094
|
-
* @param {number[]}
|
|
16078
|
+
* @param {number[]} Value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
16095
16079
|
* ```typescript
|
|
16096
16080
|
* // Load an existing PDF document
|
|
16097
16081
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
@@ -16106,26 +16090,7 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
16106
16090
|
* ```
|
|
16107
16091
|
*/
|
|
16108
16092
|
set: function (value) {
|
|
16109
|
-
|
|
16110
|
-
if (widget && widget.borderColor !== value) {
|
|
16111
|
-
widget.borderColor = value;
|
|
16112
|
-
}
|
|
16113
|
-
else {
|
|
16114
|
-
var mkDict = this._mkDictionary;
|
|
16115
|
-
if (typeof mkDict === 'undefined') {
|
|
16116
|
-
var dictionary = new _PdfDictionary(this._crossReference);
|
|
16117
|
-
dictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
16118
|
-
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
16119
|
-
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
16120
|
-
this._dictionary.update('MK', dictionary);
|
|
16121
|
-
}
|
|
16122
|
-
else if (!mkDict.has('BC') || _parseColor(mkDict.getArray('BC')) !== value) {
|
|
16123
|
-
mkDict.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
16124
|
-
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
16125
|
-
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
16126
|
-
this._dictionary._updated = true;
|
|
16127
|
-
}
|
|
16128
|
-
}
|
|
16093
|
+
this._updateBorderColor(value, true);
|
|
16129
16094
|
},
|
|
16130
16095
|
enumerable: true,
|
|
16131
16096
|
configurable: true
|
|
@@ -16721,6 +16686,25 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
16721
16686
|
enumerable: true,
|
|
16722
16687
|
configurable: true
|
|
16723
16688
|
});
|
|
16689
|
+
Object.defineProperty(PdfField.prototype, "_hasBorderColor", {
|
|
16690
|
+
get: function () {
|
|
16691
|
+
if (this._isLoaded) {
|
|
16692
|
+
var mkDictionary = this._mkDictionary;
|
|
16693
|
+
if (!mkDictionary) {
|
|
16694
|
+
var item = this.itemAt(this._defaultIndex);
|
|
16695
|
+
if (item && item._dictionary.has('MK')) {
|
|
16696
|
+
mkDictionary = item._dictionary.get('MK');
|
|
16697
|
+
}
|
|
16698
|
+
}
|
|
16699
|
+
return (mkDictionary && mkDictionary.has('BC'));
|
|
16700
|
+
}
|
|
16701
|
+
else {
|
|
16702
|
+
return !this._isTransparentBorderColor;
|
|
16703
|
+
}
|
|
16704
|
+
},
|
|
16705
|
+
enumerable: true,
|
|
16706
|
+
configurable: true
|
|
16707
|
+
});
|
|
16724
16708
|
PdfField.prototype._parseBackColor = function (hasTransparency) {
|
|
16725
16709
|
var value;
|
|
16726
16710
|
if ((!hasTransparency) || ((this._isLoaded && this._hasBackColor) || (!this._isLoaded && !this._isTransparentBackColor))) {
|
|
@@ -16743,6 +16727,28 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
16743
16727
|
}
|
|
16744
16728
|
return value;
|
|
16745
16729
|
};
|
|
16730
|
+
PdfField.prototype._parseBorderColor = function (hasTransparency) {
|
|
16731
|
+
var value;
|
|
16732
|
+
if ((!hasTransparency) || ((this._isLoaded && this._hasBorderColor) || (!this._isLoaded && !this._isTransparentBorderColor))) {
|
|
16733
|
+
var widget = this.itemAt(this._defaultIndex);
|
|
16734
|
+
if (widget && widget.borderColor) {
|
|
16735
|
+
value = widget.borderColor;
|
|
16736
|
+
}
|
|
16737
|
+
else if (this._mkDictionary) {
|
|
16738
|
+
var mkDict = this._mkDictionary;
|
|
16739
|
+
if (mkDict && mkDict.has('BC')) {
|
|
16740
|
+
var bgArray = mkDict.getArray('BC');
|
|
16741
|
+
if (bgArray) {
|
|
16742
|
+
value = _parseColor(bgArray);
|
|
16743
|
+
}
|
|
16744
|
+
}
|
|
16745
|
+
}
|
|
16746
|
+
if (typeof value === 'undefined' || value === null) {
|
|
16747
|
+
value = [0, 0, 0];
|
|
16748
|
+
}
|
|
16749
|
+
}
|
|
16750
|
+
return value;
|
|
16751
|
+
};
|
|
16746
16752
|
PdfField.prototype._updateBackColor = function (value, hasTransparency) {
|
|
16747
16753
|
if (hasTransparency === void 0) { hasTransparency = false; }
|
|
16748
16754
|
if (hasTransparency && value.length === 4 && value[3] !== 255) {
|
|
@@ -16784,6 +16790,53 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
16784
16790
|
}
|
|
16785
16791
|
}
|
|
16786
16792
|
};
|
|
16793
|
+
PdfField.prototype._updateBorderColor = function (value, hasTransparency) {
|
|
16794
|
+
if (hasTransparency === void 0) { hasTransparency = false; }
|
|
16795
|
+
if (hasTransparency && value.length === 4 && value[3] !== 255) {
|
|
16796
|
+
this._isTransparentBorderColor = true;
|
|
16797
|
+
if (this._dictionary.has('BC')) {
|
|
16798
|
+
delete this._dictionary._map.BC;
|
|
16799
|
+
}
|
|
16800
|
+
var mkDictionary = this._mkDictionary;
|
|
16801
|
+
if (mkDictionary && mkDictionary.has('BC')) {
|
|
16802
|
+
delete mkDictionary._map.BC;
|
|
16803
|
+
if (this._dictionary.has('BS')) {
|
|
16804
|
+
var bsDictionary = this._dictionary.get('BS');
|
|
16805
|
+
if (bsDictionary && bsDictionary.has('W')) {
|
|
16806
|
+
delete bsDictionary._map.W;
|
|
16807
|
+
}
|
|
16808
|
+
}
|
|
16809
|
+
this._dictionary._updated = true;
|
|
16810
|
+
}
|
|
16811
|
+
var item = this.itemAt(this._defaultIndex);
|
|
16812
|
+
if (item) {
|
|
16813
|
+
item.borderColor = value;
|
|
16814
|
+
}
|
|
16815
|
+
}
|
|
16816
|
+
else {
|
|
16817
|
+
this._isTransparentBorderColor = false;
|
|
16818
|
+
var widget = this.itemAt(this._defaultIndex);
|
|
16819
|
+
if (widget && widget.borderColor !== value) {
|
|
16820
|
+
widget.borderColor = value;
|
|
16821
|
+
}
|
|
16822
|
+
else {
|
|
16823
|
+
var mkDictionary = this._mkDictionary;
|
|
16824
|
+
if (typeof mkDictionary === 'undefined') {
|
|
16825
|
+
var dictionary = new _PdfDictionary(this._crossReference);
|
|
16826
|
+
dictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
16827
|
+
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
16828
|
+
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
16829
|
+
this._dictionary.update('MK', dictionary);
|
|
16830
|
+
}
|
|
16831
|
+
else if (!mkDictionary.has('BC') || _parseColor(mkDictionary.getArray('BC')) !== value) {
|
|
16832
|
+
mkDictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
16833
|
+
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
16834
|
+
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
16835
|
+
this._dictionary._updated = true;
|
|
16836
|
+
}
|
|
16837
|
+
}
|
|
16838
|
+
}
|
|
16839
|
+
};
|
|
16787
16840
|
/**
|
|
16788
16841
|
* Gets the field item as `PdfWidgetAnnotation` at the specified index.
|
|
16789
16842
|
*
|
|
@@ -17255,19 +17308,19 @@ var PdfField = /** @__PURE__ @class */ (function () {
|
|
|
17255
17308
|
switch (state) {
|
|
17256
17309
|
case _PdfCheckFieldState.unchecked:
|
|
17257
17310
|
case _PdfCheckFieldState.checked:
|
|
17258
|
-
if (parameter.borderPen) {
|
|
17311
|
+
if (parameter.borderPen || parameter.backBrush) {
|
|
17259
17312
|
graphics.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.backBrush);
|
|
17260
17313
|
}
|
|
17261
17314
|
break;
|
|
17262
17315
|
case _PdfCheckFieldState.pressedChecked:
|
|
17263
17316
|
case _PdfCheckFieldState.pressedUnchecked:
|
|
17264
|
-
if ((parameter.borderStyle === PdfBorderStyle.beveled) ||
|
|
17317
|
+
if ((parameter.borderStyle === PdfBorderStyle.beveled || parameter.backBrush) ||
|
|
17265
17318
|
(parameter.borderStyle === PdfBorderStyle.underline)) {
|
|
17266
|
-
if (parameter.borderPen) {
|
|
17319
|
+
if (parameter.borderPen || parameter.backBrush) {
|
|
17267
17320
|
graphics.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.backBrush);
|
|
17268
17321
|
}
|
|
17269
17322
|
}
|
|
17270
|
-
else if (parameter.borderPen) {
|
|
17323
|
+
else if (parameter.borderPen || parameter.shadowBrush) {
|
|
17271
17324
|
graphics.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.shadowBrush);
|
|
17272
17325
|
}
|
|
17273
17326
|
break;
|
|
@@ -18427,7 +18480,9 @@ var PdfTextBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
18427
18480
|
}
|
|
18428
18481
|
parameter.foreBrush = new PdfBrush(widget.color);
|
|
18429
18482
|
var border = widget.border;
|
|
18430
|
-
|
|
18483
|
+
if (widget.borderColor) {
|
|
18484
|
+
parameter.borderPen = new PdfPen(widget.borderColor, border.width);
|
|
18485
|
+
}
|
|
18431
18486
|
parameter.borderStyle = border.style;
|
|
18432
18487
|
parameter.borderWidth = border.width;
|
|
18433
18488
|
if (backcolor) {
|
|
@@ -18476,7 +18531,7 @@ var PdfTextBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
18476
18531
|
if (typeof maxLength !== 'undefined') {
|
|
18477
18532
|
if (parameter.insertSpaces) {
|
|
18478
18533
|
var width = 0;
|
|
18479
|
-
if (typeof maxLength !== 'undefined' && maxLength > 0) {
|
|
18534
|
+
if (typeof maxLength !== 'undefined' && maxLength > 0 && this.borderColor) {
|
|
18480
18535
|
width = parameter.bounds[2] / maxLength;
|
|
18481
18536
|
g.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.borderPen, parameter.backBrush);
|
|
18482
18537
|
var current = text;
|
|
@@ -19157,7 +19212,9 @@ var PdfButtonField = /** @__PURE__ @class */ (function (_super) {
|
|
|
19157
19212
|
}
|
|
19158
19213
|
parameter.foreBrush = new PdfBrush(widget.color);
|
|
19159
19214
|
var border = widget.border;
|
|
19160
|
-
|
|
19215
|
+
if (widget.borderColor) {
|
|
19216
|
+
parameter.borderPen = new PdfPen(widget.borderColor, border.width);
|
|
19217
|
+
}
|
|
19161
19218
|
parameter.borderStyle = border.style;
|
|
19162
19219
|
parameter.borderWidth = border.width;
|
|
19163
19220
|
if (backcolor) {
|
|
@@ -19627,6 +19684,53 @@ var PdfCheckBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
19627
19684
|
enumerable: true,
|
|
19628
19685
|
configurable: true
|
|
19629
19686
|
});
|
|
19687
|
+
Object.defineProperty(PdfCheckBoxField.prototype, "borderColor", {
|
|
19688
|
+
/**
|
|
19689
|
+
* Gets the border color of the field.
|
|
19690
|
+
*
|
|
19691
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
19692
|
+
* ```typescript
|
|
19693
|
+
* // Load an existing PDF document
|
|
19694
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
19695
|
+
* // Access the form field at index 0
|
|
19696
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
19697
|
+
* // Gets the border color of the field.
|
|
19698
|
+
* let borderColor: number[] = field.borderColor;
|
|
19699
|
+
* // Save the document
|
|
19700
|
+
* document.save('output.pdf');
|
|
19701
|
+
* // Destroy the document
|
|
19702
|
+
* document.destroy();
|
|
19703
|
+
* ```
|
|
19704
|
+
*/
|
|
19705
|
+
get: function () {
|
|
19706
|
+
return this._parseBorderColor(true);
|
|
19707
|
+
},
|
|
19708
|
+
/**
|
|
19709
|
+
* Sets the border color of the field.
|
|
19710
|
+
*
|
|
19711
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
19712
|
+
* ```typescript
|
|
19713
|
+
* // Load an existing PDF document
|
|
19714
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
19715
|
+
* // Access the form field at index 0
|
|
19716
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
19717
|
+
* // Sets the border color of the field.
|
|
19718
|
+
* field.borderColor = [255, 0, 0];
|
|
19719
|
+
* // Save the document
|
|
19720
|
+
* document.save('output.pdf');
|
|
19721
|
+
* // Destroy the document
|
|
19722
|
+
* document.destroy();
|
|
19723
|
+
* ```
|
|
19724
|
+
*/
|
|
19725
|
+
set: function (value) {
|
|
19726
|
+
this._updateBorderColor(value, true);
|
|
19727
|
+
if (this._isLoaded) {
|
|
19728
|
+
this._setAppearance = true;
|
|
19729
|
+
}
|
|
19730
|
+
},
|
|
19731
|
+
enumerable: true,
|
|
19732
|
+
configurable: true
|
|
19733
|
+
});
|
|
19630
19734
|
PdfCheckBoxField.prototype._initialize = function (page, name, bounds) {
|
|
19631
19735
|
this._crossReference = page._crossReference;
|
|
19632
19736
|
this._page = page;
|
|
@@ -19719,7 +19823,9 @@ var PdfCheckBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
19719
19823
|
}
|
|
19720
19824
|
parameter.foreBrush = new PdfBrush(widget.color);
|
|
19721
19825
|
var border = widget.border;
|
|
19722
|
-
|
|
19826
|
+
if (widget.borderColor) {
|
|
19827
|
+
parameter.borderPen = new PdfPen(widget.borderColor, border.width);
|
|
19828
|
+
}
|
|
19723
19829
|
parameter.borderStyle = border.style;
|
|
19724
19830
|
parameter.borderWidth = border.width;
|
|
19725
19831
|
if (backcolor) {
|
|
@@ -19955,6 +20061,50 @@ var PdfRadioButtonListField = /** @__PURE__ @class */ (function (_super) {
|
|
|
19955
20061
|
enumerable: true,
|
|
19956
20062
|
configurable: true
|
|
19957
20063
|
});
|
|
20064
|
+
Object.defineProperty(PdfRadioButtonListField.prototype, "borderColor", {
|
|
20065
|
+
/**
|
|
20066
|
+
* Gets the border color of the field.
|
|
20067
|
+
*
|
|
20068
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
20069
|
+
* ```typescript
|
|
20070
|
+
* // Load an existing PDF document
|
|
20071
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
20072
|
+
* // Access the form field at index 0
|
|
20073
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
20074
|
+
* // Gets the border color of the field.
|
|
20075
|
+
* let borderColor: number[] = field.borderColor;
|
|
20076
|
+
* // Save the document
|
|
20077
|
+
* document.save('output.pdf');
|
|
20078
|
+
* // Destroy the document
|
|
20079
|
+
* document.destroy();
|
|
20080
|
+
* ```
|
|
20081
|
+
*/
|
|
20082
|
+
get: function () {
|
|
20083
|
+
return this._parseBorderColor(!this._isLoaded);
|
|
20084
|
+
},
|
|
20085
|
+
/**
|
|
20086
|
+
* Sets the border color of the field.
|
|
20087
|
+
*
|
|
20088
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
20089
|
+
* ```typescript
|
|
20090
|
+
* // Load an existing PDF document
|
|
20091
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
20092
|
+
* // Access the form field at index 0
|
|
20093
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
20094
|
+
* // Sets the border color of the field.
|
|
20095
|
+
* field.borderColor = [255, 0, 0];
|
|
20096
|
+
* // Save the document
|
|
20097
|
+
* document.save('output.pdf');
|
|
20098
|
+
* // Destroy the document
|
|
20099
|
+
* document.destroy();
|
|
20100
|
+
* ```
|
|
20101
|
+
*/
|
|
20102
|
+
set: function (value) {
|
|
20103
|
+
this._updateBorderColor(value, true);
|
|
20104
|
+
},
|
|
20105
|
+
enumerable: true,
|
|
20106
|
+
configurable: true
|
|
20107
|
+
});
|
|
19958
20108
|
/**
|
|
19959
20109
|
* Gets the item at the specified index.
|
|
19960
20110
|
*
|
|
@@ -20210,7 +20360,9 @@ var PdfRadioButtonListField = /** @__PURE__ @class */ (function (_super) {
|
|
|
20210
20360
|
}
|
|
20211
20361
|
parameter.foreBrush = new PdfBrush(widget.color);
|
|
20212
20362
|
var border = widget.border;
|
|
20213
|
-
|
|
20363
|
+
if (widget.borderColor) {
|
|
20364
|
+
parameter.borderPen = new PdfPen(widget.borderColor, border.width);
|
|
20365
|
+
}
|
|
20214
20366
|
parameter.borderStyle = border.style;
|
|
20215
20367
|
parameter.borderWidth = border.width;
|
|
20216
20368
|
if (backcolor) {
|
|
@@ -21625,7 +21777,9 @@ var PdfComboBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
21625
21777
|
}
|
|
21626
21778
|
parameter.foreBrush = new PdfBrush(item.color);
|
|
21627
21779
|
var border = item.border;
|
|
21628
|
-
|
|
21780
|
+
if (item.borderColor) {
|
|
21781
|
+
parameter.borderPen = new PdfPen(item.borderColor, border.width);
|
|
21782
|
+
}
|
|
21629
21783
|
parameter.borderStyle = border.style;
|
|
21630
21784
|
parameter.borderWidth = border.width;
|
|
21631
21785
|
if (backcolor) {
|
|
@@ -21659,7 +21813,9 @@ var PdfComboBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
21659
21813
|
}
|
|
21660
21814
|
parameter.foreBrush = new PdfBrush(this.color);
|
|
21661
21815
|
var border = this.border;
|
|
21662
|
-
|
|
21816
|
+
if (this.borderColor) {
|
|
21817
|
+
parameter.borderPen = new PdfPen(this.borderColor, border.width);
|
|
21818
|
+
}
|
|
21663
21819
|
parameter.borderStyle = border.style;
|
|
21664
21820
|
parameter.borderWidth = border.width;
|
|
21665
21821
|
if (backcolor) {
|
|
@@ -22011,7 +22167,9 @@ var PdfListBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
22011
22167
|
}
|
|
22012
22168
|
parameter.foreBrush = new PdfBrush(item.color);
|
|
22013
22169
|
var border = item.border;
|
|
22014
|
-
|
|
22170
|
+
if (item.borderColor) {
|
|
22171
|
+
parameter.borderPen = new PdfPen(item.borderColor, border.width);
|
|
22172
|
+
}
|
|
22015
22173
|
parameter.borderStyle = border.style;
|
|
22016
22174
|
parameter.borderWidth = border.width;
|
|
22017
22175
|
if (backcolor) {
|
|
@@ -22043,7 +22201,9 @@ var PdfListBoxField = /** @__PURE__ @class */ (function (_super) {
|
|
|
22043
22201
|
}
|
|
22044
22202
|
parameter.foreBrush = new PdfBrush(this.color);
|
|
22045
22203
|
var border = this.border;
|
|
22046
|
-
|
|
22204
|
+
if (this.borderColor) {
|
|
22205
|
+
parameter.borderPen = new PdfPen(this.borderColor, border.width);
|
|
22206
|
+
}
|
|
22047
22207
|
parameter.borderStyle = border.style;
|
|
22048
22208
|
parameter.borderWidth = border.width;
|
|
22049
22209
|
if (backcolor) {
|
|
@@ -22353,7 +22513,7 @@ var PdfSignatureField = /** @__PURE__ @class */ (function (_super) {
|
|
|
22353
22513
|
PdfSignatureField.prototype._doPostProcess = function (isFlatten) {
|
|
22354
22514
|
if (isFlatten === void 0) { isFlatten = false; }
|
|
22355
22515
|
var needAppearance = this._setAppearance || this._form._setAppearance;
|
|
22356
|
-
if (
|
|
22516
|
+
if (isFlatten || needAppearance) {
|
|
22357
22517
|
var count = this._kidsCount;
|
|
22358
22518
|
if (count > 0) {
|
|
22359
22519
|
for (var i = 0; i < count; i++) {
|
|
@@ -22401,7 +22561,9 @@ var PdfSignatureField = /** @__PURE__ @class */ (function (_super) {
|
|
|
22401
22561
|
}
|
|
22402
22562
|
parameter.foreBrush = new PdfBrush(widget.color);
|
|
22403
22563
|
var border = widget.border;
|
|
22404
|
-
|
|
22564
|
+
if (widget.borderColor) {
|
|
22565
|
+
parameter.borderPen = new PdfPen(widget.borderColor, border.width);
|
|
22566
|
+
}
|
|
22405
22567
|
parameter.borderStyle = border.style;
|
|
22406
22568
|
parameter.borderWidth = border.width;
|
|
22407
22569
|
if (backcolor) {
|
|
@@ -34678,6 +34840,7 @@ var PdfWidgetAnnotation = /** @__PURE__ @class */ (function (_super) {
|
|
|
34678
34840
|
_this._visibility = PdfFormFieldVisibility.visible;
|
|
34679
34841
|
_this._isFont = false;
|
|
34680
34842
|
_this._isTransparentBackColor = false;
|
|
34843
|
+
_this._isTransparentBorderColor = false;
|
|
34681
34844
|
_this._isWidget = true;
|
|
34682
34845
|
_this._type = _PdfAnnotationType.widgetAnnotation;
|
|
34683
34846
|
return _this;
|
|
@@ -34841,6 +35004,19 @@ var PdfWidgetAnnotation = /** @__PURE__ @class */ (function (_super) {
|
|
|
34841
35004
|
enumerable: true,
|
|
34842
35005
|
configurable: true
|
|
34843
35006
|
});
|
|
35007
|
+
Object.defineProperty(PdfWidgetAnnotation.prototype, "_hasBorderColor", {
|
|
35008
|
+
get: function () {
|
|
35009
|
+
if (this._isLoaded) {
|
|
35010
|
+
var mkDictionary = this._mkDictionary;
|
|
35011
|
+
return (mkDictionary && mkDictionary.has('BC'));
|
|
35012
|
+
}
|
|
35013
|
+
else {
|
|
35014
|
+
return !this._isTransparentBorderColor;
|
|
35015
|
+
}
|
|
35016
|
+
},
|
|
35017
|
+
enumerable: true,
|
|
35018
|
+
configurable: true
|
|
35019
|
+
});
|
|
34844
35020
|
Object.defineProperty(PdfWidgetAnnotation.prototype, "borderColor", {
|
|
34845
35021
|
/**
|
|
34846
35022
|
* Gets the border color of the annotation.
|
|
@@ -34860,24 +35036,12 @@ var PdfWidgetAnnotation = /** @__PURE__ @class */ (function (_super) {
|
|
|
34860
35036
|
* ```
|
|
34861
35037
|
*/
|
|
34862
35038
|
get: function () {
|
|
34863
|
-
|
|
34864
|
-
var mkDict = this._mkDictionary;
|
|
34865
|
-
if (mkDict && mkDict.has('BC')) {
|
|
34866
|
-
var bcArray = mkDict.getArray('BC');
|
|
34867
|
-
if (bcArray) {
|
|
34868
|
-
this._borderColor = _parseColor(bcArray);
|
|
34869
|
-
}
|
|
34870
|
-
}
|
|
34871
|
-
}
|
|
34872
|
-
if (typeof this._borderColor === 'undefined' || this._borderColor === null) {
|
|
34873
|
-
this._borderColor = [0, 0, 0];
|
|
34874
|
-
}
|
|
34875
|
-
return this._borderColor;
|
|
35039
|
+
return this._parseBorderColor();
|
|
34876
35040
|
},
|
|
34877
35041
|
/**
|
|
34878
35042
|
* Sets the border color of the annotation.
|
|
34879
35043
|
*
|
|
34880
|
-
* @param {number[]} value
|
|
35044
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255.. For optional A (0-254), it signifies transparency.
|
|
34881
35045
|
* ```typescript
|
|
34882
35046
|
* // Load an existing PDF document
|
|
34883
35047
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
@@ -34894,15 +35058,7 @@ var PdfWidgetAnnotation = /** @__PURE__ @class */ (function (_super) {
|
|
|
34894
35058
|
* ```
|
|
34895
35059
|
*/
|
|
34896
35060
|
set: function (value) {
|
|
34897
|
-
|
|
34898
|
-
if (typeof this._mkDictionary === 'undefined') {
|
|
34899
|
-
this._dictionary.update('MK', new _PdfDictionary(this._crossReference));
|
|
34900
|
-
}
|
|
34901
|
-
this._mkDictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
34902
|
-
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
34903
|
-
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
34904
|
-
this._borderColor = value;
|
|
34905
|
-
}
|
|
35061
|
+
this._updateBorderColor(value, true);
|
|
34906
35062
|
},
|
|
34907
35063
|
enumerable: true,
|
|
34908
35064
|
configurable: true
|
|
@@ -35536,6 +35692,25 @@ var PdfWidgetAnnotation = /** @__PURE__ @class */ (function (_super) {
|
|
|
35536
35692
|
}
|
|
35537
35693
|
return value;
|
|
35538
35694
|
};
|
|
35695
|
+
PdfWidgetAnnotation.prototype._parseBorderColor = function () {
|
|
35696
|
+
var value;
|
|
35697
|
+
if ((this._isLoaded && this._hasBorderColor) || (!this._isLoaded && !this._isTransparentBorderColor)) {
|
|
35698
|
+
if (typeof this._borderColor === 'undefined') {
|
|
35699
|
+
var dictionary = this._mkDictionary;
|
|
35700
|
+
if (dictionary && dictionary.has('BC')) {
|
|
35701
|
+
var colorArray = dictionary.getArray('BC');
|
|
35702
|
+
if (colorArray) {
|
|
35703
|
+
this._borderColor = _parseColor(colorArray);
|
|
35704
|
+
}
|
|
35705
|
+
}
|
|
35706
|
+
}
|
|
35707
|
+
if (typeof this._borderColor === 'undefined' || this._borderColor === null) {
|
|
35708
|
+
this._borderColor = [0, 0, 0];
|
|
35709
|
+
}
|
|
35710
|
+
value = this._borderColor;
|
|
35711
|
+
}
|
|
35712
|
+
return value;
|
|
35713
|
+
};
|
|
35539
35714
|
PdfWidgetAnnotation.prototype._updateBackColor = function (value, setAppearance) {
|
|
35540
35715
|
if (setAppearance === void 0) { setAppearance = false; }
|
|
35541
35716
|
var isChanged = false;
|
|
@@ -35570,6 +35745,39 @@ var PdfWidgetAnnotation = /** @__PURE__ @class */ (function (_super) {
|
|
|
35570
35745
|
this._field._setAppearance = true;
|
|
35571
35746
|
}
|
|
35572
35747
|
};
|
|
35748
|
+
PdfWidgetAnnotation.prototype._updateBorderColor = function (value, setAppearance) {
|
|
35749
|
+
if (setAppearance === void 0) { setAppearance = false; }
|
|
35750
|
+
if (value.length === 4 && value[3] !== 255) {
|
|
35751
|
+
this._isTransparentBorderColor = true;
|
|
35752
|
+
if (this._dictionary.has('BC')) {
|
|
35753
|
+
delete this._dictionary._map.BC;
|
|
35754
|
+
}
|
|
35755
|
+
var mkDictionary = this._mkDictionary;
|
|
35756
|
+
if (mkDictionary && mkDictionary.has('BC')) {
|
|
35757
|
+
delete mkDictionary._map.BC;
|
|
35758
|
+
if (this._dictionary.has('BS')) {
|
|
35759
|
+
var bsDictionary = this._dictionary.get('BS');
|
|
35760
|
+
if (bsDictionary && bsDictionary.has('W')) {
|
|
35761
|
+
delete bsDictionary._map.W;
|
|
35762
|
+
}
|
|
35763
|
+
}
|
|
35764
|
+
this._dictionary._updated = true;
|
|
35765
|
+
}
|
|
35766
|
+
}
|
|
35767
|
+
else {
|
|
35768
|
+
this._isTransparentBorderColor = false;
|
|
35769
|
+
if (typeof this.borderColor === 'undefined' || this.borderColor !== value) {
|
|
35770
|
+
if (typeof this._mkDictionary === 'undefined') {
|
|
35771
|
+
this._dictionary.update('MK', new _PdfDictionary(this._crossReference));
|
|
35772
|
+
}
|
|
35773
|
+
this._mkDictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
35774
|
+
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
35775
|
+
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
35776
|
+
this._borderColor = [value[0], value[1], value[2]];
|
|
35777
|
+
this._dictionary._updated = true;
|
|
35778
|
+
}
|
|
35779
|
+
}
|
|
35780
|
+
};
|
|
35573
35781
|
return PdfWidgetAnnotation;
|
|
35574
35782
|
}(PdfAnnotation));
|
|
35575
35783
|
/**
|