@syncfusion/ej2-pdf 24.1.47 → 24.2.3
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 +8 -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 +548 -167
- package/dist/es6/ej2-pdf.es2015.js.map +1 -1
- package/dist/es6/ej2-pdf.es5.js +582 -167
- 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 +7 -7
- package/src/pdf/core/annotations/annotation.d.ts +57 -14
- package/src/pdf/core/annotations/annotation.js +129 -34
- package/src/pdf/core/form/field.d.ts +203 -5
- package/src/pdf/core/form/field.js +453 -133
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 24.
|
|
3
|
+
* version : 24.2.3
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-pdf@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-pdf@24.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-pdf@24.1.47",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-QTgs7ywpkjEhzHxKJbKiVNVzwG98Yghd17lY1jdvFwMY3F2pqGjSlT+eyZvD3YXRaKxw1qJEbpaAuzHC7QHX1Q==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-pdf",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"/@syncfusion/ej2",
|
|
22
22
|
"/@syncfusion/ej2-pdfviewer"
|
|
23
23
|
],
|
|
24
|
-
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-24.1.
|
|
25
|
-
"_shasum": "
|
|
24
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-24.1.47.tgz",
|
|
25
|
+
"_shasum": "7c23a2f46e7f68cf7a8e566f60e2d07f779984a5",
|
|
26
26
|
"_spec": "@syncfusion/ej2-pdf@*",
|
|
27
27
|
"_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
|
|
28
28
|
"author": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
},
|
|
31
31
|
"bundleDependencies": false,
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@syncfusion/ej2-base": "~24.
|
|
34
|
-
"@syncfusion/ej2-compression": "~24.
|
|
33
|
+
"@syncfusion/ej2-base": "~24.2.3",
|
|
34
|
+
"@syncfusion/ej2-compression": "~24.2.3"
|
|
35
35
|
},
|
|
36
36
|
"deprecated": false,
|
|
37
37
|
"description": "Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/pdf"
|
|
56
56
|
},
|
|
57
57
|
"typings": "index.d.ts",
|
|
58
|
-
"version": "24.
|
|
58
|
+
"version": "24.2.3",
|
|
59
59
|
"sideEffects": false,
|
|
60
60
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
61
61
|
}
|
|
@@ -3453,7 +3453,7 @@ export declare class PdfSoundAnnotation extends PdfComment {
|
|
|
3453
3453
|
* // Get the first page
|
|
3454
3454
|
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
3455
3455
|
* // Create a new free text annotation
|
|
3456
|
-
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation
|
|
3456
|
+
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation(50, 100, 100, 50);
|
|
3457
3457
|
* // Add annotation to the page
|
|
3458
3458
|
* page.annotations.add(annotation);
|
|
3459
3459
|
* // Destroy the document
|
|
@@ -3495,7 +3495,7 @@ export declare class PdfFreeTextAnnotation extends PdfComment {
|
|
|
3495
3495
|
* // Get the first page
|
|
3496
3496
|
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
3497
3497
|
* // Create a new free text annotation
|
|
3498
|
-
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation
|
|
3498
|
+
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation(50, 100, 100, 50);
|
|
3499
3499
|
* // Add annotation to the page
|
|
3500
3500
|
* page.annotations.add(annotation);
|
|
3501
3501
|
* // Destroy the document
|
|
@@ -4132,6 +4132,7 @@ export declare class PdfWidgetAnnotation extends PdfAnnotation {
|
|
|
4132
4132
|
_visibility: PdfFormFieldVisibility;
|
|
4133
4133
|
_fontName: string;
|
|
4134
4134
|
_isFont: boolean;
|
|
4135
|
+
_isTransparentBackColor: boolean;
|
|
4135
4136
|
/**
|
|
4136
4137
|
* Initializes a new instance of the `PdfWidgetAnnotation` class.
|
|
4137
4138
|
*
|
|
@@ -4212,12 +4213,10 @@ export declare class PdfWidgetAnnotation extends PdfAnnotation {
|
|
|
4212
4213
|
* ```typescript
|
|
4213
4214
|
* // Load an existing PDF document
|
|
4214
4215
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
4215
|
-
* //
|
|
4216
|
-
* let
|
|
4217
|
-
* // Get the first annotation of the page
|
|
4218
|
-
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
|
|
4216
|
+
* // Access the text box field at index 0
|
|
4217
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
4219
4218
|
* // Gets the back color of the annotation
|
|
4220
|
-
* let backColor: number[] =
|
|
4219
|
+
* let backColor: number[] = field.itemAt(0).backColor;
|
|
4221
4220
|
* // Destroy the document
|
|
4222
4221
|
* document.destroy();
|
|
4223
4222
|
* ```
|
|
@@ -4225,16 +4224,16 @@ export declare class PdfWidgetAnnotation extends PdfAnnotation {
|
|
|
4225
4224
|
/**
|
|
4226
4225
|
* Sets the back color of the annotation.
|
|
4227
4226
|
*
|
|
4228
|
-
* @param {number[]} value
|
|
4227
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
4229
4228
|
* ```typescript
|
|
4230
4229
|
* // Load an existing PDF document
|
|
4231
4230
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
4232
|
-
* //
|
|
4233
|
-
* let
|
|
4234
|
-
* //
|
|
4235
|
-
*
|
|
4236
|
-
* // Sets the
|
|
4237
|
-
*
|
|
4231
|
+
* // Access the text box field at index 0
|
|
4232
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
4233
|
+
* // Sets the background color of the field item
|
|
4234
|
+
* field.itemAt(0).backColor = [255, 0, 0];
|
|
4235
|
+
* // Sets the background color of the field item to transparent
|
|
4236
|
+
* field.itemAt(1).backColor = [0, 0, 0, 0];
|
|
4238
4237
|
* // Save the document
|
|
4239
4238
|
* document.save('output.pdf');
|
|
4240
4239
|
* // Destroy the document
|
|
@@ -4242,6 +4241,7 @@ export declare class PdfWidgetAnnotation extends PdfAnnotation {
|
|
|
4242
4241
|
* ```
|
|
4243
4242
|
*/
|
|
4244
4243
|
backColor: number[];
|
|
4244
|
+
readonly _hasBackColor: boolean;
|
|
4245
4245
|
/**
|
|
4246
4246
|
* Gets the border color of the annotation.
|
|
4247
4247
|
*
|
|
@@ -4522,6 +4522,8 @@ export declare class PdfWidgetAnnotation extends PdfAnnotation {
|
|
|
4522
4522
|
_initializeFont(font: PdfFont): void;
|
|
4523
4523
|
_getPage(): PdfPage;
|
|
4524
4524
|
_beginSave(): void;
|
|
4525
|
+
_parseBackColor(): number[];
|
|
4526
|
+
_updateBackColor(value: number[], setAppearance?: boolean): void;
|
|
4525
4527
|
}
|
|
4526
4528
|
/**
|
|
4527
4529
|
* `PdfStateItem` class represents the check box field item objects.
|
|
@@ -4836,6 +4838,47 @@ export declare class PdfRadioButtonListItem extends PdfStateItem {
|
|
|
4836
4838
|
* ```
|
|
4837
4839
|
*/
|
|
4838
4840
|
value: string;
|
|
4841
|
+
/**
|
|
4842
|
+
* Gets the back color of the annotation.
|
|
4843
|
+
*
|
|
4844
|
+
* @returns {number[]} Color as R, G, B color array in between 0 to 255.
|
|
4845
|
+
* ```typescript
|
|
4846
|
+
* // Load an existing PDF document
|
|
4847
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
4848
|
+
* // Get the first page
|
|
4849
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
4850
|
+
* // Get the first annotation of the page
|
|
4851
|
+
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
|
|
4852
|
+
* // Gets the back color of the annotation
|
|
4853
|
+
* let backColor: number[] = annotation.backColor;
|
|
4854
|
+
* // Destroy the document
|
|
4855
|
+
* document.destroy();
|
|
4856
|
+
* ```
|
|
4857
|
+
*/
|
|
4858
|
+
/**
|
|
4859
|
+
* Sets the back color of the annotation.
|
|
4860
|
+
*
|
|
4861
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
4862
|
+
* ```typescript
|
|
4863
|
+
* // Load an existing PDF document
|
|
4864
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
4865
|
+
* // Gets the first page of the document
|
|
4866
|
+
* let page: PdfPage = document.getPage(0);
|
|
4867
|
+
* // Access the PDF form
|
|
4868
|
+
* let form: PdfForm = document.form;
|
|
4869
|
+
* // Access the radio button list field
|
|
4870
|
+
* let field: PdfRadioButtonListField = form.fieldAt(0) as PdfRadioButtonListField;
|
|
4871
|
+
* // Sets the back color of the radio button list item
|
|
4872
|
+
* field.itemAt(0).backColor = [255, 255, 255];
|
|
4873
|
+
* // Sets the background color of the field item to transparent
|
|
4874
|
+
* field.itemAt(1).backColor = [0, 0, 0, 0];
|
|
4875
|
+
* // Save the document
|
|
4876
|
+
* document.save('output.pdf');
|
|
4877
|
+
* // Destroy the document
|
|
4878
|
+
* document.destroy();
|
|
4879
|
+
* ```
|
|
4880
|
+
*/
|
|
4881
|
+
backColor: number[];
|
|
4839
4882
|
_initializeItem(value: string, bounds: {
|
|
4840
4883
|
x: number;
|
|
4841
4884
|
y: number;
|
|
@@ -10060,7 +10060,7 @@ export { PdfSoundAnnotation };
|
|
|
10060
10060
|
* // Get the first page
|
|
10061
10061
|
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
10062
10062
|
* // Create a new free text annotation
|
|
10063
|
-
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation
|
|
10063
|
+
* const annotation: PdfFreeTextAnnotation = new PdfFreeTextAnnotation(50, 100, 100, 50);
|
|
10064
10064
|
* // Add annotation to the page
|
|
10065
10065
|
* page.annotations.add(annotation);
|
|
10066
10066
|
* // Destroy the document
|
|
@@ -11878,6 +11878,7 @@ var PdfWidgetAnnotation = /** @class */ (function (_super) {
|
|
|
11878
11878
|
_this._isAutoResize = false;
|
|
11879
11879
|
_this._visibility = PdfFormFieldVisibility.visible;
|
|
11880
11880
|
_this._isFont = false;
|
|
11881
|
+
_this._isTransparentBackColor = false;
|
|
11881
11882
|
_this._isWidget = true;
|
|
11882
11883
|
_this._type = _PdfAnnotationType.widgetAnnotation;
|
|
11883
11884
|
return _this;
|
|
@@ -11992,44 +11993,30 @@ var PdfWidgetAnnotation = /** @class */ (function (_super) {
|
|
|
11992
11993
|
* ```typescript
|
|
11993
11994
|
* // Load an existing PDF document
|
|
11994
11995
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
11995
|
-
* //
|
|
11996
|
-
* let
|
|
11997
|
-
* // Get the first annotation of the page
|
|
11998
|
-
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
|
|
11996
|
+
* // Access the text box field at index 0
|
|
11997
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
11999
11998
|
* // Gets the back color of the annotation
|
|
12000
|
-
* let backColor: number[] =
|
|
11999
|
+
* let backColor: number[] = field.itemAt(0).backColor;
|
|
12001
12000
|
* // Destroy the document
|
|
12002
12001
|
* document.destroy();
|
|
12003
12002
|
* ```
|
|
12004
12003
|
*/
|
|
12005
12004
|
get: function () {
|
|
12006
|
-
|
|
12007
|
-
var dictionary = this._mkDictionary;
|
|
12008
|
-
if (dictionary && dictionary.has('BG')) {
|
|
12009
|
-
var colorArray = dictionary.getArray('BG');
|
|
12010
|
-
if (colorArray) {
|
|
12011
|
-
this._backColor = _parseColor(colorArray);
|
|
12012
|
-
}
|
|
12013
|
-
}
|
|
12014
|
-
}
|
|
12015
|
-
if (typeof this._backColor === 'undefined' || this._backColor === null) {
|
|
12016
|
-
this._backColor = [255, 255, 255];
|
|
12017
|
-
}
|
|
12018
|
-
return this._backColor;
|
|
12005
|
+
return this._parseBackColor();
|
|
12019
12006
|
},
|
|
12020
12007
|
/**
|
|
12021
12008
|
* Sets the back color of the annotation.
|
|
12022
12009
|
*
|
|
12023
|
-
* @param {number[]} value
|
|
12010
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
12024
12011
|
* ```typescript
|
|
12025
12012
|
* // Load an existing PDF document
|
|
12026
12013
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
12027
|
-
* //
|
|
12028
|
-
* let
|
|
12029
|
-
* //
|
|
12030
|
-
*
|
|
12031
|
-
* // Sets the
|
|
12032
|
-
*
|
|
12014
|
+
* // Access the text box field at index 0
|
|
12015
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
12016
|
+
* // Sets the background color of the field item
|
|
12017
|
+
* field.itemAt(0).backColor = [255, 0, 0];
|
|
12018
|
+
* // Sets the background color of the field item to transparent
|
|
12019
|
+
* field.itemAt(1).backColor = [0, 0, 0, 0];
|
|
12033
12020
|
* // Save the document
|
|
12034
12021
|
* document.save('output.pdf');
|
|
12035
12022
|
* // Destroy the document
|
|
@@ -12037,14 +12024,19 @@ var PdfWidgetAnnotation = /** @class */ (function (_super) {
|
|
|
12037
12024
|
* ```
|
|
12038
12025
|
*/
|
|
12039
12026
|
set: function (value) {
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12027
|
+
this._updateBackColor(value);
|
|
12028
|
+
},
|
|
12029
|
+
enumerable: true,
|
|
12030
|
+
configurable: true
|
|
12031
|
+
});
|
|
12032
|
+
Object.defineProperty(PdfWidgetAnnotation.prototype, "_hasBackColor", {
|
|
12033
|
+
get: function () {
|
|
12034
|
+
if (this._isLoaded) {
|
|
12035
|
+
var mkDictionary = this._mkDictionary;
|
|
12036
|
+
return (mkDictionary && mkDictionary.has('BG'));
|
|
12037
|
+
}
|
|
12038
|
+
else {
|
|
12039
|
+
return !this._isTransparentBackColor;
|
|
12048
12040
|
}
|
|
12049
12041
|
},
|
|
12050
12042
|
enumerable: true,
|
|
@@ -12721,6 +12713,59 @@ var PdfWidgetAnnotation = /** @class */ (function (_super) {
|
|
|
12721
12713
|
this._dictionary.update('Rect', _getUpdatedBounds([value.x, value.y, value.width, value.height], this._page));
|
|
12722
12714
|
}
|
|
12723
12715
|
};
|
|
12716
|
+
PdfWidgetAnnotation.prototype._parseBackColor = function () {
|
|
12717
|
+
var value;
|
|
12718
|
+
if ((this._isLoaded && this._hasBackColor) || (!this._isLoaded && !this._isTransparentBackColor)) {
|
|
12719
|
+
if (typeof this._backColor === 'undefined') {
|
|
12720
|
+
var dictionary = this._mkDictionary;
|
|
12721
|
+
if (dictionary && dictionary.has('BG')) {
|
|
12722
|
+
var colorArray = dictionary.getArray('BG');
|
|
12723
|
+
if (colorArray) {
|
|
12724
|
+
this._backColor = _parseColor(colorArray);
|
|
12725
|
+
}
|
|
12726
|
+
}
|
|
12727
|
+
}
|
|
12728
|
+
if (typeof this._backColor === 'undefined' || this._backColor === null) {
|
|
12729
|
+
this._backColor = [255, 255, 255];
|
|
12730
|
+
}
|
|
12731
|
+
value = this._backColor;
|
|
12732
|
+
}
|
|
12733
|
+
return value;
|
|
12734
|
+
};
|
|
12735
|
+
PdfWidgetAnnotation.prototype._updateBackColor = function (value, setAppearance) {
|
|
12736
|
+
if (setAppearance === void 0) { setAppearance = false; }
|
|
12737
|
+
var isChanged = false;
|
|
12738
|
+
if (value.length === 4 && value[3] !== 255) {
|
|
12739
|
+
this._isTransparentBackColor = true;
|
|
12740
|
+
if (this._dictionary.has('BG')) {
|
|
12741
|
+
delete this._dictionary._map.BG;
|
|
12742
|
+
isChanged = true;
|
|
12743
|
+
}
|
|
12744
|
+
var mkDictionary = this._mkDictionary;
|
|
12745
|
+
if (mkDictionary && mkDictionary.has('BG')) {
|
|
12746
|
+
delete mkDictionary._map.BG;
|
|
12747
|
+
this._dictionary._updated = true;
|
|
12748
|
+
isChanged = true;
|
|
12749
|
+
}
|
|
12750
|
+
}
|
|
12751
|
+
else {
|
|
12752
|
+
this._isTransparentBackColor = false;
|
|
12753
|
+
if (typeof this.backColor === 'undefined' || this._backColor !== value) {
|
|
12754
|
+
if (typeof this._mkDictionary === 'undefined') {
|
|
12755
|
+
this._dictionary.update('MK', new _PdfDictionary(this._crossReference));
|
|
12756
|
+
}
|
|
12757
|
+
this._mkDictionary.update('BG', [Number.parseFloat((value[0] / 255).toFixed(3)),
|
|
12758
|
+
Number.parseFloat((value[1] / 255).toFixed(3)),
|
|
12759
|
+
Number.parseFloat((value[2] / 255).toFixed(3))]);
|
|
12760
|
+
this._backColor = [value[0], value[1], value[2]];
|
|
12761
|
+
this._dictionary._updated = true;
|
|
12762
|
+
isChanged = true;
|
|
12763
|
+
}
|
|
12764
|
+
}
|
|
12765
|
+
if (setAppearance && isChanged && this._field) {
|
|
12766
|
+
this._field._setAppearance = true;
|
|
12767
|
+
}
|
|
12768
|
+
};
|
|
12724
12769
|
return PdfWidgetAnnotation;
|
|
12725
12770
|
}(PdfAnnotation));
|
|
12726
12771
|
export { PdfWidgetAnnotation };
|
|
@@ -13074,6 +13119,56 @@ var PdfRadioButtonListItem = /** @class */ (function (_super) {
|
|
|
13074
13119
|
enumerable: true,
|
|
13075
13120
|
configurable: true
|
|
13076
13121
|
});
|
|
13122
|
+
Object.defineProperty(PdfRadioButtonListItem.prototype, "backColor", {
|
|
13123
|
+
/**
|
|
13124
|
+
* Gets the back color of the annotation.
|
|
13125
|
+
*
|
|
13126
|
+
* @returns {number[]} Color as R, G, B color array in between 0 to 255.
|
|
13127
|
+
* ```typescript
|
|
13128
|
+
* // Load an existing PDF document
|
|
13129
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
13130
|
+
* // Get the first page
|
|
13131
|
+
* let page: PdfPage = document.getPage(0) as PdfPage;
|
|
13132
|
+
* // Get the first annotation of the page
|
|
13133
|
+
* let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
|
|
13134
|
+
* // Gets the back color of the annotation
|
|
13135
|
+
* let backColor: number[] = annotation.backColor;
|
|
13136
|
+
* // Destroy the document
|
|
13137
|
+
* document.destroy();
|
|
13138
|
+
* ```
|
|
13139
|
+
*/
|
|
13140
|
+
get: function () {
|
|
13141
|
+
return this._parseBackColor();
|
|
13142
|
+
},
|
|
13143
|
+
/**
|
|
13144
|
+
* Sets the back color of the annotation.
|
|
13145
|
+
*
|
|
13146
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
13147
|
+
* ```typescript
|
|
13148
|
+
* // Load an existing PDF document
|
|
13149
|
+
* let document: PdfDocument = new PdfDocument(data);
|
|
13150
|
+
* // Gets the first page of the document
|
|
13151
|
+
* let page: PdfPage = document.getPage(0);
|
|
13152
|
+
* // Access the PDF form
|
|
13153
|
+
* let form: PdfForm = document.form;
|
|
13154
|
+
* // Access the radio button list field
|
|
13155
|
+
* let field: PdfRadioButtonListField = form.fieldAt(0) as PdfRadioButtonListField;
|
|
13156
|
+
* // Sets the back color of the radio button list item
|
|
13157
|
+
* field.itemAt(0).backColor = [255, 255, 255];
|
|
13158
|
+
* // Sets the background color of the field item to transparent
|
|
13159
|
+
* field.itemAt(1).backColor = [0, 0, 0, 0];
|
|
13160
|
+
* // Save the document
|
|
13161
|
+
* document.save('output.pdf');
|
|
13162
|
+
* // Destroy the document
|
|
13163
|
+
* document.destroy();
|
|
13164
|
+
* ```
|
|
13165
|
+
*/
|
|
13166
|
+
set: function (value) {
|
|
13167
|
+
this._updateBackColor(value, true);
|
|
13168
|
+
},
|
|
13169
|
+
enumerable: true,
|
|
13170
|
+
configurable: true
|
|
13171
|
+
});
|
|
13077
13172
|
PdfRadioButtonListItem.prototype._initializeItem = function (value, bounds, page, field) {
|
|
13078
13173
|
this._optionValue = value;
|
|
13079
13174
|
this._page = page;
|
|
@@ -51,7 +51,7 @@ export declare abstract class PdfField {
|
|
|
51
51
|
_silver: PdfBrush;
|
|
52
52
|
_white: PdfBrush;
|
|
53
53
|
_black: PdfBrush;
|
|
54
|
-
|
|
54
|
+
_isTransparentBackColor: boolean;
|
|
55
55
|
_tabIndex: number;
|
|
56
56
|
_annotationIndex: number;
|
|
57
57
|
_defaultFont: PdfStandardFont;
|
|
@@ -350,7 +350,7 @@ export declare abstract class PdfField {
|
|
|
350
350
|
*/
|
|
351
351
|
color: number[];
|
|
352
352
|
/**
|
|
353
|
-
* Gets the
|
|
353
|
+
* Gets the background color of the field.
|
|
354
354
|
*
|
|
355
355
|
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
356
356
|
* ```typescript
|
|
@@ -358,7 +358,7 @@ export declare abstract class PdfField {
|
|
|
358
358
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
359
359
|
* // Access the form field at index 0
|
|
360
360
|
* let field: PdfField = document.form.fieldAt(0);
|
|
361
|
-
* // Gets the
|
|
361
|
+
* // Gets the background color of the field.
|
|
362
362
|
* let backColor: number[] = field.backColor;
|
|
363
363
|
* // Save the document
|
|
364
364
|
* document.save('output.pdf');
|
|
@@ -367,7 +367,7 @@ export declare abstract class PdfField {
|
|
|
367
367
|
* ```
|
|
368
368
|
*/
|
|
369
369
|
/**
|
|
370
|
-
* Sets the
|
|
370
|
+
* Sets the background color of the field.
|
|
371
371
|
*
|
|
372
372
|
* @param {number[]} value R, G, B color values in between 0 to 255.
|
|
373
373
|
* ```typescript
|
|
@@ -375,7 +375,7 @@ export declare abstract class PdfField {
|
|
|
375
375
|
* let document: PdfDocument = new PdfDocument(data, password);
|
|
376
376
|
* // Access the form field at index 0
|
|
377
377
|
* let field: PdfField = document.form.fieldAt(0);
|
|
378
|
-
* // Sets the
|
|
378
|
+
* // Sets the background color of the field.
|
|
379
379
|
* field.backColor = [255, 0, 0];
|
|
380
380
|
* // Save the document
|
|
381
381
|
* document.save('output.pdf');
|
|
@@ -704,6 +704,9 @@ export declare abstract class PdfField {
|
|
|
704
704
|
readonly _whiteBrush: PdfBrush;
|
|
705
705
|
readonly _blackBrush: PdfBrush;
|
|
706
706
|
readonly _kidsCount: number;
|
|
707
|
+
readonly _hasBackColor: boolean;
|
|
708
|
+
_parseBackColor(hasTransparency: boolean): number[];
|
|
709
|
+
_updateBackColor(value: number[], hasTransparency?: boolean): void;
|
|
707
710
|
/**
|
|
708
711
|
* Gets the field item as `PdfWidgetAnnotation` at the specified index.
|
|
709
712
|
*
|
|
@@ -1349,6 +1352,45 @@ export declare class PdfTextBoxField extends PdfField {
|
|
|
1349
1352
|
* ```
|
|
1350
1353
|
*/
|
|
1351
1354
|
font: PdfFont;
|
|
1355
|
+
/**
|
|
1356
|
+
* Gets the background color of the field.
|
|
1357
|
+
*
|
|
1358
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
1359
|
+
* ```typescript
|
|
1360
|
+
* // Load an existing PDF document
|
|
1361
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1362
|
+
* // Access the form field at index 0
|
|
1363
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
1364
|
+
* // Gets the background color of the field.
|
|
1365
|
+
* let backColor: number[] = field.backColor;
|
|
1366
|
+
* // Save the document
|
|
1367
|
+
* document.save('output.pdf');
|
|
1368
|
+
* // Destroy the document
|
|
1369
|
+
* document.destroy();
|
|
1370
|
+
* ```
|
|
1371
|
+
*/
|
|
1372
|
+
/**
|
|
1373
|
+
* Sets the background color of the field.
|
|
1374
|
+
*
|
|
1375
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
1376
|
+
* ```typescript
|
|
1377
|
+
* // Load an existing PDF document
|
|
1378
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1379
|
+
* // Access the text box field at index 0
|
|
1380
|
+
* let firstName: PdfField = document.form.fieldAt(0);
|
|
1381
|
+
* // Sets the background color of the field.
|
|
1382
|
+
* firstName.backColor = [255, 0, 0];
|
|
1383
|
+
* // Access the text box field at index 1
|
|
1384
|
+
* let secondName: PdfField = document.form.fieldAt(1);
|
|
1385
|
+
* // Sets the background color of the field to transparent.
|
|
1386
|
+
* secondName.backColor = [0, 0, 0, 0];
|
|
1387
|
+
* // Save the document
|
|
1388
|
+
* document.save('output.pdf');
|
|
1389
|
+
* // Destroy the document
|
|
1390
|
+
* document.destroy();
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
backColor: number[];
|
|
1352
1394
|
_initialize(page: PdfPage, name: string, bounds: {
|
|
1353
1395
|
x: number;
|
|
1354
1396
|
y: number;
|
|
@@ -1565,6 +1607,45 @@ export declare class PdfButtonField extends PdfField {
|
|
|
1565
1607
|
* ```
|
|
1566
1608
|
*/
|
|
1567
1609
|
font: PdfFont;
|
|
1610
|
+
/**
|
|
1611
|
+
* Gets the background color of the field.
|
|
1612
|
+
*
|
|
1613
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
1614
|
+
* ```typescript
|
|
1615
|
+
* // Load an existing PDF document
|
|
1616
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1617
|
+
* // Access the form field at index 0
|
|
1618
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
1619
|
+
* // Gets the background color of the field.
|
|
1620
|
+
* let backColor: number[] = field.backColor;
|
|
1621
|
+
* // Save the document
|
|
1622
|
+
* document.save('output.pdf');
|
|
1623
|
+
* // Destroy the document
|
|
1624
|
+
* document.destroy();
|
|
1625
|
+
* ```
|
|
1626
|
+
*/
|
|
1627
|
+
/**
|
|
1628
|
+
* Sets the background color of the field.
|
|
1629
|
+
*
|
|
1630
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
1631
|
+
* ```typescript
|
|
1632
|
+
* // Load an existing PDF document
|
|
1633
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1634
|
+
* // Access the button field at index 0
|
|
1635
|
+
* let submitButton: PdfField = document.form.fieldAt(0);
|
|
1636
|
+
* // Sets the background color of the field.
|
|
1637
|
+
* submitButton.backColor = [255, 0, 0];
|
|
1638
|
+
* // Access the button field at index 1
|
|
1639
|
+
* let cancelButton: PdfField = document.form.fieldAt(1);
|
|
1640
|
+
* // Sets the background color of the field to transparent.
|
|
1641
|
+
* cancelButton.backColor = [0, 0, 0, 0];
|
|
1642
|
+
* // Save the document
|
|
1643
|
+
* document.save('output.pdf');
|
|
1644
|
+
* // Destroy the document
|
|
1645
|
+
* document.destroy();
|
|
1646
|
+
* ```
|
|
1647
|
+
*/
|
|
1648
|
+
backColor: number[];
|
|
1568
1649
|
_assignText(fieldDictionary: _PdfDictionary, value: string): void;
|
|
1569
1650
|
/**
|
|
1570
1651
|
* Parse an existing button field.
|
|
@@ -1810,6 +1891,45 @@ export declare class PdfCheckBoxField extends PdfField {
|
|
|
1810
1891
|
* ```
|
|
1811
1892
|
*/
|
|
1812
1893
|
textAlignment: PdfTextAlignment;
|
|
1894
|
+
/**
|
|
1895
|
+
* Gets the background color of the field.
|
|
1896
|
+
*
|
|
1897
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
1898
|
+
* ```typescript
|
|
1899
|
+
* // Load an existing PDF document
|
|
1900
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1901
|
+
* // Access the form field at index 0
|
|
1902
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
1903
|
+
* // Gets the background color of the field.
|
|
1904
|
+
* let backColor: number[] = field.backColor;
|
|
1905
|
+
* // Save the document
|
|
1906
|
+
* document.save('output.pdf');
|
|
1907
|
+
* // Destroy the document
|
|
1908
|
+
* document.destroy();
|
|
1909
|
+
* ```
|
|
1910
|
+
*/
|
|
1911
|
+
/**
|
|
1912
|
+
* Sets the background color of the field.
|
|
1913
|
+
*
|
|
1914
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
1915
|
+
* ```typescript
|
|
1916
|
+
* // Load an existing PDF document
|
|
1917
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
1918
|
+
* // Access the check box field at index 0
|
|
1919
|
+
* let checkBox1: PdfField = document.form.fieldAt(0);
|
|
1920
|
+
* // Sets the background color of the field.
|
|
1921
|
+
* checkBox1.backColor = [255, 0, 0];
|
|
1922
|
+
* // Access the check box field at index 1
|
|
1923
|
+
* let checkBox2: PdfField = document.form.fieldAt(1);
|
|
1924
|
+
* // Sets the background color of the field to transparent.
|
|
1925
|
+
* checkBox2.backColor = [0, 0, 0, 0];
|
|
1926
|
+
* // Save the document
|
|
1927
|
+
* document.save('output.pdf');
|
|
1928
|
+
* // Destroy the document
|
|
1929
|
+
* document.destroy();
|
|
1930
|
+
* ```
|
|
1931
|
+
*/
|
|
1932
|
+
backColor: number[];
|
|
1813
1933
|
_initialize(page: PdfPage, name: string, bounds: {
|
|
1814
1934
|
x: number;
|
|
1815
1935
|
y: number;
|
|
@@ -2572,6 +2692,45 @@ export declare abstract class PdfListField extends PdfField {
|
|
|
2572
2692
|
* ```
|
|
2573
2693
|
*/
|
|
2574
2694
|
textAlignment: PdfTextAlignment;
|
|
2695
|
+
/**
|
|
2696
|
+
* Gets the background color of the field.
|
|
2697
|
+
*
|
|
2698
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
2699
|
+
* ```typescript
|
|
2700
|
+
* // Load an existing PDF document
|
|
2701
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2702
|
+
* // Access the form field at index 0
|
|
2703
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
2704
|
+
* // Gets the background color of the field.
|
|
2705
|
+
* let backColor: number[] = field.backColor;
|
|
2706
|
+
* // Save the document
|
|
2707
|
+
* document.save('output.pdf');
|
|
2708
|
+
* // Destroy the document
|
|
2709
|
+
* document.destroy();
|
|
2710
|
+
* ```
|
|
2711
|
+
*/
|
|
2712
|
+
/**
|
|
2713
|
+
* Sets the background color of the field.
|
|
2714
|
+
*
|
|
2715
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
2716
|
+
* ```typescript
|
|
2717
|
+
* // Load an existing PDF document
|
|
2718
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
2719
|
+
* // Access the list field at index 0
|
|
2720
|
+
* let list1: PdfField = document.form.fieldAt(0);
|
|
2721
|
+
* // Sets the background color of the field.
|
|
2722
|
+
* list1.backColor = [255, 0, 0];
|
|
2723
|
+
* // Access the list field at index 1
|
|
2724
|
+
* let list2: PdfField = document.form.fieldAt(1);
|
|
2725
|
+
* // Sets the background color of the field to transparent.
|
|
2726
|
+
* list2.backColor = [0, 0, 0, 0];
|
|
2727
|
+
* // Save the document
|
|
2728
|
+
* document.save('output.pdf');
|
|
2729
|
+
* // Destroy the document
|
|
2730
|
+
* document.destroy();
|
|
2731
|
+
* ```
|
|
2732
|
+
*/
|
|
2733
|
+
backColor: number[];
|
|
2575
2734
|
readonly _options: Array<string[]>;
|
|
2576
2735
|
/**
|
|
2577
2736
|
* Gets the item at the specified index.
|
|
@@ -2966,6 +3125,45 @@ export declare class PdfSignatureField extends PdfField {
|
|
|
2966
3125
|
* ```
|
|
2967
3126
|
*/
|
|
2968
3127
|
readonly isSigned: boolean;
|
|
3128
|
+
/**
|
|
3129
|
+
* Gets the background color of the field.
|
|
3130
|
+
*
|
|
3131
|
+
* @returns {number[]} R, G, B color values in between 0 to 255.
|
|
3132
|
+
* ```typescript
|
|
3133
|
+
* // Load an existing PDF document
|
|
3134
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
3135
|
+
* // Access the form field at index 0
|
|
3136
|
+
* let field: PdfField = document.form.fieldAt(0);
|
|
3137
|
+
* // Gets the background color of the field.
|
|
3138
|
+
* let backColor: number[] = field.backColor;
|
|
3139
|
+
* // Save the document
|
|
3140
|
+
* document.save('output.pdf');
|
|
3141
|
+
* // Destroy the document
|
|
3142
|
+
* document.destroy();
|
|
3143
|
+
* ```
|
|
3144
|
+
*/
|
|
3145
|
+
/**
|
|
3146
|
+
* Sets the background color of the field.
|
|
3147
|
+
*
|
|
3148
|
+
* @param {number[]} value Array with R, G, B, A color values in between 0 to 255. For optional A (0-254), it signifies transparency.
|
|
3149
|
+
* ```typescript
|
|
3150
|
+
* // Load an existing PDF document
|
|
3151
|
+
* let document: PdfDocument = new PdfDocument(data, password);
|
|
3152
|
+
* // Access the signature field at index 0
|
|
3153
|
+
* let field1: PdfField = document.form.fieldAt(0);
|
|
3154
|
+
* // Sets the background color of the field.
|
|
3155
|
+
* field1.backColor = [255, 0, 0];
|
|
3156
|
+
* // Access the signature field at index 1
|
|
3157
|
+
* let field2: PdfField = document.form.fieldAt(1);
|
|
3158
|
+
* // Sets the background color of the field to transparent.
|
|
3159
|
+
* field2.backColor = [0, 0, 0, 0];
|
|
3160
|
+
* // Save the document
|
|
3161
|
+
* document.save('output.pdf');
|
|
3162
|
+
* // Destroy the document
|
|
3163
|
+
* document.destroy();
|
|
3164
|
+
* ```
|
|
3165
|
+
*/
|
|
3166
|
+
backColor: number[];
|
|
2969
3167
|
static _load(form: PdfForm, dictionary: _PdfDictionary, crossReference: _PdfCrossReference, reference: _PdfReference): PdfSignatureField;
|
|
2970
3168
|
_initialize(page: PdfPage, name: string, bounds: {
|
|
2971
3169
|
x: number;
|