@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.
@@ -14947,6 +14947,7 @@ class PdfField {
14947
14947
  constructor() {
14948
14948
  this._visible = true;
14949
14949
  this._isTransparentBackColor = false;
14950
+ this._isTransparentBorderColor = false;
14950
14951
  this._defaultFont = new PdfStandardFont(PdfFontFamily.helvetica, 8);
14951
14952
  this._appearanceFont = new PdfStandardFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
14952
14953
  this._defaultItemFont = new PdfStandardFont(PdfFontFamily.timesRoman, 12);
@@ -15521,29 +15522,12 @@ class PdfField {
15521
15522
  * ```
15522
15523
  */
15523
15524
  get borderColor() {
15524
- let value;
15525
- const widget = this.itemAt(this._defaultIndex);
15526
- if (widget && widget.borderColor) {
15527
- value = widget.borderColor;
15528
- }
15529
- else if (this._mkDictionary) {
15530
- const dictionary = this._mkDictionary;
15531
- if (dictionary && dictionary.has('BC')) {
15532
- const colorArray = dictionary.getArray('BC');
15533
- if (colorArray) {
15534
- value = _parseColor(colorArray);
15535
- }
15536
- }
15537
- }
15538
- if (typeof value === 'undefined' || value === null) {
15539
- value = [0, 0, 0];
15540
- }
15541
- return value;
15525
+ return this._parseBorderColor(true);
15542
15526
  }
15543
15527
  /**
15544
15528
  * Sets the border color of the field.
15545
15529
  *
15546
- * @param {number[]} value R, G, B color values in between 0 to 255.
15530
+ * @param {number[]} Value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
15547
15531
  * ```typescript
15548
15532
  * // Load an existing PDF document
15549
15533
  * let document: PdfDocument = new PdfDocument(data, password);
@@ -15558,26 +15542,7 @@ class PdfField {
15558
15542
  * ```
15559
15543
  */
15560
15544
  set borderColor(value) {
15561
- const widget = this.itemAt(this._defaultIndex);
15562
- if (widget && widget.borderColor !== value) {
15563
- widget.borderColor = value;
15564
- }
15565
- else {
15566
- const mkDict = this._mkDictionary;
15567
- if (typeof mkDict === 'undefined') {
15568
- const dictionary = new _PdfDictionary(this._crossReference);
15569
- dictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
15570
- Number.parseFloat((value[1] / 255).toFixed(3)),
15571
- Number.parseFloat((value[2] / 255).toFixed(3))]);
15572
- this._dictionary.update('MK', dictionary);
15573
- }
15574
- else if (!mkDict.has('BC') || _parseColor(mkDict.getArray('BC')) !== value) {
15575
- mkDict.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
15576
- Number.parseFloat((value[1] / 255).toFixed(3)),
15577
- Number.parseFloat((value[2] / 255).toFixed(3))]);
15578
- this._dictionary._updated = true;
15579
- }
15580
- }
15545
+ this._updateBorderColor(value, true);
15581
15546
  }
15582
15547
  /**
15583
15548
  * Gets a value indicating whether read only.
@@ -16110,6 +16075,21 @@ class PdfField {
16110
16075
  return !this._isTransparentBackColor;
16111
16076
  }
16112
16077
  }
16078
+ get _hasBorderColor() {
16079
+ if (this._isLoaded) {
16080
+ let mkDictionary = this._mkDictionary;
16081
+ if (!mkDictionary) {
16082
+ const item = this.itemAt(this._defaultIndex);
16083
+ if (item && item._dictionary.has('MK')) {
16084
+ mkDictionary = item._dictionary.get('MK');
16085
+ }
16086
+ }
16087
+ return (mkDictionary && mkDictionary.has('BC'));
16088
+ }
16089
+ else {
16090
+ return !this._isTransparentBorderColor;
16091
+ }
16092
+ }
16113
16093
  _parseBackColor(hasTransparency) {
16114
16094
  let value;
16115
16095
  if ((!hasTransparency) || ((this._isLoaded && this._hasBackColor) || (!this._isLoaded && !this._isTransparentBackColor))) {
@@ -16132,6 +16112,28 @@ class PdfField {
16132
16112
  }
16133
16113
  return value;
16134
16114
  }
16115
+ _parseBorderColor(hasTransparency) {
16116
+ let value;
16117
+ if ((!hasTransparency) || ((this._isLoaded && this._hasBorderColor) || (!this._isLoaded && !this._isTransparentBorderColor))) {
16118
+ const widget = this.itemAt(this._defaultIndex);
16119
+ if (widget && widget.borderColor) {
16120
+ value = widget.borderColor;
16121
+ }
16122
+ else if (this._mkDictionary) {
16123
+ const mkDict = this._mkDictionary;
16124
+ if (mkDict && mkDict.has('BC')) {
16125
+ const bgArray = mkDict.getArray('BC');
16126
+ if (bgArray) {
16127
+ value = _parseColor(bgArray);
16128
+ }
16129
+ }
16130
+ }
16131
+ if (typeof value === 'undefined' || value === null) {
16132
+ value = [0, 0, 0];
16133
+ }
16134
+ }
16135
+ return value;
16136
+ }
16135
16137
  _updateBackColor(value, hasTransparency = false) {
16136
16138
  if (hasTransparency && value.length === 4 && value[3] !== 255) {
16137
16139
  this._isTransparentBackColor = true;
@@ -16172,6 +16174,52 @@ class PdfField {
16172
16174
  }
16173
16175
  }
16174
16176
  }
16177
+ _updateBorderColor(value, hasTransparency = false) {
16178
+ if (hasTransparency && value.length === 4 && value[3] !== 255) {
16179
+ this._isTransparentBorderColor = true;
16180
+ if (this._dictionary.has('BC')) {
16181
+ delete this._dictionary._map.BC;
16182
+ }
16183
+ const mkDictionary = this._mkDictionary;
16184
+ if (mkDictionary && mkDictionary.has('BC')) {
16185
+ delete mkDictionary._map.BC;
16186
+ if (this._dictionary.has('BS')) {
16187
+ const bsDictionary = this._dictionary.get('BS');
16188
+ if (bsDictionary && bsDictionary.has('W')) {
16189
+ delete bsDictionary._map.W;
16190
+ }
16191
+ }
16192
+ this._dictionary._updated = true;
16193
+ }
16194
+ const item = this.itemAt(this._defaultIndex);
16195
+ if (item) {
16196
+ item.borderColor = value;
16197
+ }
16198
+ }
16199
+ else {
16200
+ this._isTransparentBorderColor = false;
16201
+ const widget = this.itemAt(this._defaultIndex);
16202
+ if (widget && widget.borderColor !== value) {
16203
+ widget.borderColor = value;
16204
+ }
16205
+ else {
16206
+ const mkDictionary = this._mkDictionary;
16207
+ if (typeof mkDictionary === 'undefined') {
16208
+ const dictionary = new _PdfDictionary(this._crossReference);
16209
+ dictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
16210
+ Number.parseFloat((value[1] / 255).toFixed(3)),
16211
+ Number.parseFloat((value[2] / 255).toFixed(3))]);
16212
+ this._dictionary.update('MK', dictionary);
16213
+ }
16214
+ else if (!mkDictionary.has('BC') || _parseColor(mkDictionary.getArray('BC')) !== value) {
16215
+ mkDictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
16216
+ Number.parseFloat((value[1] / 255).toFixed(3)),
16217
+ Number.parseFloat((value[2] / 255).toFixed(3))]);
16218
+ this._dictionary._updated = true;
16219
+ }
16220
+ }
16221
+ }
16222
+ }
16175
16223
  /**
16176
16224
  * Gets the field item as `PdfWidgetAnnotation` at the specified index.
16177
16225
  *
@@ -16631,19 +16679,19 @@ class PdfField {
16631
16679
  switch (state) {
16632
16680
  case _PdfCheckFieldState.unchecked:
16633
16681
  case _PdfCheckFieldState.checked:
16634
- if (parameter.borderPen) {
16682
+ if (parameter.borderPen || parameter.backBrush) {
16635
16683
  graphics.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.backBrush);
16636
16684
  }
16637
16685
  break;
16638
16686
  case _PdfCheckFieldState.pressedChecked:
16639
16687
  case _PdfCheckFieldState.pressedUnchecked:
16640
- if ((parameter.borderStyle === PdfBorderStyle.beveled) ||
16688
+ if ((parameter.borderStyle === PdfBorderStyle.beveled || parameter.backBrush) ||
16641
16689
  (parameter.borderStyle === PdfBorderStyle.underline)) {
16642
- if (parameter.borderPen) {
16690
+ if (parameter.borderPen || parameter.backBrush) {
16643
16691
  graphics.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.backBrush);
16644
16692
  }
16645
16693
  }
16646
- else if (parameter.borderPen) {
16694
+ else if (parameter.borderPen || parameter.shadowBrush) {
16647
16695
  graphics.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.shadowBrush);
16648
16696
  }
16649
16697
  break;
@@ -17747,7 +17795,9 @@ class PdfTextBoxField extends PdfField {
17747
17795
  }
17748
17796
  parameter.foreBrush = new PdfBrush(widget.color);
17749
17797
  const border = widget.border;
17750
- parameter.borderPen = new PdfPen(widget.borderColor, border.width);
17798
+ if (widget.borderColor) {
17799
+ parameter.borderPen = new PdfPen(widget.borderColor, border.width);
17800
+ }
17751
17801
  parameter.borderStyle = border.style;
17752
17802
  parameter.borderWidth = border.width;
17753
17803
  if (backcolor) {
@@ -17796,7 +17846,7 @@ class PdfTextBoxField extends PdfField {
17796
17846
  if (typeof maxLength !== 'undefined') {
17797
17847
  if (parameter.insertSpaces) {
17798
17848
  let width = 0;
17799
- if (typeof maxLength !== 'undefined' && maxLength > 0) {
17849
+ if (typeof maxLength !== 'undefined' && maxLength > 0 && this.borderColor) {
17800
17850
  width = parameter.bounds[2] / maxLength;
17801
17851
  g.drawRectangle(parameter.bounds[0], parameter.bounds[1], parameter.bounds[2], parameter.bounds[3], parameter.borderPen, parameter.backBrush);
17802
17852
  const current = text;
@@ -18448,7 +18498,9 @@ class PdfButtonField extends PdfField {
18448
18498
  }
18449
18499
  parameter.foreBrush = new PdfBrush(widget.color);
18450
18500
  const border = widget.border;
18451
- parameter.borderPen = new PdfPen(widget.borderColor, border.width);
18501
+ if (widget.borderColor) {
18502
+ parameter.borderPen = new PdfPen(widget.borderColor, border.width);
18503
+ }
18452
18504
  parameter.borderStyle = border.style;
18453
18505
  parameter.borderWidth = border.width;
18454
18506
  if (backcolor) {
@@ -18899,6 +18951,49 @@ class PdfCheckBoxField extends PdfField {
18899
18951
  set backColor(value) {
18900
18952
  this._updateBackColor(value, true);
18901
18953
  }
18954
+ /**
18955
+ * Gets the border color of the field.
18956
+ *
18957
+ * @returns {number[]} R, G, B color values in between 0 to 255.
18958
+ * ```typescript
18959
+ * // Load an existing PDF document
18960
+ * let document: PdfDocument = new PdfDocument(data, password);
18961
+ * // Access the form field at index 0
18962
+ * let field: PdfField = document.form.fieldAt(0);
18963
+ * // Gets the border color of the field.
18964
+ * let borderColor: number[] = field.borderColor;
18965
+ * // Save the document
18966
+ * document.save('output.pdf');
18967
+ * // Destroy the document
18968
+ * document.destroy();
18969
+ * ```
18970
+ */
18971
+ get borderColor() {
18972
+ return this._parseBorderColor(true);
18973
+ }
18974
+ /**
18975
+ * Sets the border color of the field.
18976
+ *
18977
+ * @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
18978
+ * ```typescript
18979
+ * // Load an existing PDF document
18980
+ * let document: PdfDocument = new PdfDocument(data, password);
18981
+ * // Access the form field at index 0
18982
+ * let field: PdfField = document.form.fieldAt(0);
18983
+ * // Sets the border color of the field.
18984
+ * field.borderColor = [255, 0, 0];
18985
+ * // Save the document
18986
+ * document.save('output.pdf');
18987
+ * // Destroy the document
18988
+ * document.destroy();
18989
+ * ```
18990
+ */
18991
+ set borderColor(value) {
18992
+ this._updateBorderColor(value, true);
18993
+ if (this._isLoaded) {
18994
+ this._setAppearance = true;
18995
+ }
18996
+ }
18902
18997
  _initialize(page, name, bounds) {
18903
18998
  this._crossReference = page._crossReference;
18904
18999
  this._page = page;
@@ -18990,7 +19085,9 @@ class PdfCheckBoxField extends PdfField {
18990
19085
  }
18991
19086
  parameter.foreBrush = new PdfBrush(widget.color);
18992
19087
  const border = widget.border;
18993
- parameter.borderPen = new PdfPen(widget.borderColor, border.width);
19088
+ if (widget.borderColor) {
19089
+ parameter.borderPen = new PdfPen(widget.borderColor, border.width);
19090
+ }
18994
19091
  parameter.borderStyle = border.style;
18995
19092
  parameter.borderWidth = border.width;
18996
19093
  if (backcolor) {
@@ -19215,6 +19312,46 @@ class PdfRadioButtonListField extends PdfField {
19215
19312
  }
19216
19313
  }
19217
19314
  }
19315
+ /**
19316
+ * Gets the border color of the field.
19317
+ *
19318
+ * @returns {number[]} R, G, B color values in between 0 to 255.
19319
+ * ```typescript
19320
+ * // Load an existing PDF document
19321
+ * let document: PdfDocument = new PdfDocument(data, password);
19322
+ * // Access the form field at index 0
19323
+ * let field: PdfField = document.form.fieldAt(0);
19324
+ * // Gets the border color of the field.
19325
+ * let borderColor: number[] = field.borderColor;
19326
+ * // Save the document
19327
+ * document.save('output.pdf');
19328
+ * // Destroy the document
19329
+ * document.destroy();
19330
+ * ```
19331
+ */
19332
+ get borderColor() {
19333
+ return this._parseBorderColor(!this._isLoaded);
19334
+ }
19335
+ /**
19336
+ * Sets the border color of the field.
19337
+ *
19338
+ * @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
19339
+ * ```typescript
19340
+ * // Load an existing PDF document
19341
+ * let document: PdfDocument = new PdfDocument(data, password);
19342
+ * // Access the form field at index 0
19343
+ * let field: PdfField = document.form.fieldAt(0);
19344
+ * // Sets the border color of the field.
19345
+ * field.borderColor = [255, 0, 0];
19346
+ * // Save the document
19347
+ * document.save('output.pdf');
19348
+ * // Destroy the document
19349
+ * document.destroy();
19350
+ * ```
19351
+ */
19352
+ set borderColor(value) {
19353
+ this._updateBorderColor(value, true);
19354
+ }
19218
19355
  /**
19219
19356
  * Gets the item at the specified index.
19220
19357
  *
@@ -19469,7 +19606,9 @@ class PdfRadioButtonListField extends PdfField {
19469
19606
  }
19470
19607
  parameter.foreBrush = new PdfBrush(widget.color);
19471
19608
  const border = widget.border;
19472
- parameter.borderPen = new PdfPen(widget.borderColor, border.width);
19609
+ if (widget.borderColor) {
19610
+ parameter.borderPen = new PdfPen(widget.borderColor, border.width);
19611
+ }
19473
19612
  parameter.borderStyle = border.style;
19474
19613
  parameter.borderWidth = border.width;
19475
19614
  if (backcolor) {
@@ -20827,7 +20966,9 @@ class PdfComboBoxField extends PdfListField {
20827
20966
  }
20828
20967
  parameter.foreBrush = new PdfBrush(item.color);
20829
20968
  const border = item.border;
20830
- parameter.borderPen = new PdfPen(item.borderColor, border.width);
20969
+ if (item.borderColor) {
20970
+ parameter.borderPen = new PdfPen(item.borderColor, border.width);
20971
+ }
20831
20972
  parameter.borderStyle = border.style;
20832
20973
  parameter.borderWidth = border.width;
20833
20974
  if (backcolor) {
@@ -20861,7 +21002,9 @@ class PdfComboBoxField extends PdfListField {
20861
21002
  }
20862
21003
  parameter.foreBrush = new PdfBrush(this.color);
20863
21004
  const border = this.border;
20864
- parameter.borderPen = new PdfPen(this.borderColor, border.width);
21005
+ if (this.borderColor) {
21006
+ parameter.borderPen = new PdfPen(this.borderColor, border.width);
21007
+ }
20865
21008
  parameter.borderStyle = border.style;
20866
21009
  parameter.borderWidth = border.width;
20867
21010
  if (backcolor) {
@@ -21210,7 +21353,9 @@ class PdfListBoxField extends PdfListField {
21210
21353
  }
21211
21354
  parameter.foreBrush = new PdfBrush(item.color);
21212
21355
  const border = item.border;
21213
- parameter.borderPen = new PdfPen(item.borderColor, border.width);
21356
+ if (item.borderColor) {
21357
+ parameter.borderPen = new PdfPen(item.borderColor, border.width);
21358
+ }
21214
21359
  parameter.borderStyle = border.style;
21215
21360
  parameter.borderWidth = border.width;
21216
21361
  if (backcolor) {
@@ -21242,7 +21387,9 @@ class PdfListBoxField extends PdfListField {
21242
21387
  }
21243
21388
  parameter.foreBrush = new PdfBrush(this.color);
21244
21389
  const border = this.border;
21245
- parameter.borderPen = new PdfPen(this.borderColor, border.width);
21390
+ if (this.borderColor) {
21391
+ parameter.borderPen = new PdfPen(this.borderColor, border.width);
21392
+ }
21246
21393
  parameter.borderStyle = border.style;
21247
21394
  parameter.borderWidth = border.width;
21248
21395
  if (backcolor) {
@@ -21536,7 +21683,7 @@ class PdfSignatureField extends PdfField {
21536
21683
  }
21537
21684
  _doPostProcess(isFlatten = false) {
21538
21685
  const needAppearance = this._setAppearance || this._form._setAppearance;
21539
- if (!this._isLoaded && (isFlatten || needAppearance)) {
21686
+ if (isFlatten || needAppearance) {
21540
21687
  const count = this._kidsCount;
21541
21688
  if (count > 0) {
21542
21689
  for (let i = 0; i < count; i++) {
@@ -21584,7 +21731,9 @@ class PdfSignatureField extends PdfField {
21584
21731
  }
21585
21732
  parameter.foreBrush = new PdfBrush(widget.color);
21586
21733
  const border = widget.border;
21587
- parameter.borderPen = new PdfPen(widget.borderColor, border.width);
21734
+ if (widget.borderColor) {
21735
+ parameter.borderPen = new PdfPen(widget.borderColor, border.width);
21736
+ }
21588
21737
  parameter.borderStyle = border.style;
21589
21738
  parameter.borderWidth = border.width;
21590
21739
  if (backcolor) {
@@ -33448,6 +33597,7 @@ class PdfWidgetAnnotation extends PdfAnnotation {
33448
33597
  this._visibility = PdfFormFieldVisibility.visible;
33449
33598
  this._isFont = false;
33450
33599
  this._isTransparentBackColor = false;
33600
+ this._isTransparentBorderColor = false;
33451
33601
  this._isWidget = true;
33452
33602
  this._type = _PdfAnnotationType.widgetAnnotation;
33453
33603
  }
@@ -33594,6 +33744,15 @@ class PdfWidgetAnnotation extends PdfAnnotation {
33594
33744
  return !this._isTransparentBackColor;
33595
33745
  }
33596
33746
  }
33747
+ get _hasBorderColor() {
33748
+ if (this._isLoaded) {
33749
+ const mkDictionary = this._mkDictionary;
33750
+ return (mkDictionary && mkDictionary.has('BC'));
33751
+ }
33752
+ else {
33753
+ return !this._isTransparentBorderColor;
33754
+ }
33755
+ }
33597
33756
  /**
33598
33757
  * Gets the border color of the annotation.
33599
33758
  *
@@ -33612,24 +33771,12 @@ class PdfWidgetAnnotation extends PdfAnnotation {
33612
33771
  * ```
33613
33772
  */
33614
33773
  get borderColor() {
33615
- if (typeof this._borderColor === 'undefined') {
33616
- const mkDict = this._mkDictionary;
33617
- if (mkDict && mkDict.has('BC')) {
33618
- const bcArray = mkDict.getArray('BC');
33619
- if (bcArray) {
33620
- this._borderColor = _parseColor(bcArray);
33621
- }
33622
- }
33623
- }
33624
- if (typeof this._borderColor === 'undefined' || this._borderColor === null) {
33625
- this._borderColor = [0, 0, 0];
33626
- }
33627
- return this._borderColor;
33774
+ return this._parseBorderColor();
33628
33775
  }
33629
33776
  /**
33630
33777
  * Sets the border color of the annotation.
33631
33778
  *
33632
- * @param {number[]} value Color as R, G, B color array in between 0 to 255.
33779
+ * @param {number[]} value Array with R, G, B, A color values in between 0 to 255.. For optional A (0-254), it signifies transparency.
33633
33780
  * ```typescript
33634
33781
  * // Load an existing PDF document
33635
33782
  * let document: PdfDocument = new PdfDocument(data, password);
@@ -33646,15 +33793,7 @@ class PdfWidgetAnnotation extends PdfAnnotation {
33646
33793
  * ```
33647
33794
  */
33648
33795
  set borderColor(value) {
33649
- if (typeof this.borderColor === 'undefined' || this.borderColor !== value) {
33650
- if (typeof this._mkDictionary === 'undefined') {
33651
- this._dictionary.update('MK', new _PdfDictionary(this._crossReference));
33652
- }
33653
- this._mkDictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
33654
- Number.parseFloat((value[1] / 255).toFixed(3)),
33655
- Number.parseFloat((value[2] / 255).toFixed(3))]);
33656
- this._borderColor = value;
33657
- }
33796
+ this._updateBorderColor(value, true);
33658
33797
  }
33659
33798
  /**
33660
33799
  * Gets the rotation angle of the annotation.
@@ -34251,6 +34390,25 @@ class PdfWidgetAnnotation extends PdfAnnotation {
34251
34390
  }
34252
34391
  return value;
34253
34392
  }
34393
+ _parseBorderColor() {
34394
+ let value;
34395
+ if ((this._isLoaded && this._hasBorderColor) || (!this._isLoaded && !this._isTransparentBorderColor)) {
34396
+ if (typeof this._borderColor === 'undefined') {
34397
+ const dictionary = this._mkDictionary;
34398
+ if (dictionary && dictionary.has('BC')) {
34399
+ const colorArray = dictionary.getArray('BC');
34400
+ if (colorArray) {
34401
+ this._borderColor = _parseColor(colorArray);
34402
+ }
34403
+ }
34404
+ }
34405
+ if (typeof this._borderColor === 'undefined' || this._borderColor === null) {
34406
+ this._borderColor = [0, 0, 0];
34407
+ }
34408
+ value = this._borderColor;
34409
+ }
34410
+ return value;
34411
+ }
34254
34412
  _updateBackColor(value, setAppearance = false) {
34255
34413
  let isChanged = false;
34256
34414
  if (value.length === 4 && value[3] !== 255) {
@@ -34284,6 +34442,38 @@ class PdfWidgetAnnotation extends PdfAnnotation {
34284
34442
  this._field._setAppearance = true;
34285
34443
  }
34286
34444
  }
34445
+ _updateBorderColor(value, setAppearance = false) {
34446
+ if (value.length === 4 && value[3] !== 255) {
34447
+ this._isTransparentBorderColor = true;
34448
+ if (this._dictionary.has('BC')) {
34449
+ delete this._dictionary._map.BC;
34450
+ }
34451
+ const mkDictionary = this._mkDictionary;
34452
+ if (mkDictionary && mkDictionary.has('BC')) {
34453
+ delete mkDictionary._map.BC;
34454
+ if (this._dictionary.has('BS')) {
34455
+ const bsDictionary = this._dictionary.get('BS');
34456
+ if (bsDictionary && bsDictionary.has('W')) {
34457
+ delete bsDictionary._map.W;
34458
+ }
34459
+ }
34460
+ this._dictionary._updated = true;
34461
+ }
34462
+ }
34463
+ else {
34464
+ this._isTransparentBorderColor = false;
34465
+ if (typeof this.borderColor === 'undefined' || this.borderColor !== value) {
34466
+ if (typeof this._mkDictionary === 'undefined') {
34467
+ this._dictionary.update('MK', new _PdfDictionary(this._crossReference));
34468
+ }
34469
+ this._mkDictionary.update('BC', [Number.parseFloat((value[0] / 255).toFixed(3)),
34470
+ Number.parseFloat((value[1] / 255).toFixed(3)),
34471
+ Number.parseFloat((value[2] / 255).toFixed(3))]);
34472
+ this._borderColor = [value[0], value[1], value[2]];
34473
+ this._dictionary._updated = true;
34474
+ }
34475
+ }
34476
+ }
34287
34477
  }
34288
34478
  /**
34289
34479
  * `PdfStateItem` class represents the check box field item objects.