@syncfusion/ej2-pdf 24.1.47 → 24.1.48

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.
@@ -1,12 +1,3 @@
1
- /*!
2
- * filename: index.d.ts
3
- * version : 24.1.47
4
- * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
- * Use of this code is subject to the terms of our license.
6
- * A copy of the current license can be obtained at any time by e-mailing
7
- * licensing@syncfusion.com. Any infringement will be prosecuted under
8
- * applicable laws.
9
- */
10
1
  import * as _pdf from '@syncfusion/ej2-pdf';
11
2
 
12
3
  export declare namespace ej {
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
1
  {
2
- "_from": "@syncfusion/ej2-pdf@*",
3
- "_id": "@syncfusion/ej2-pdf@24.1.44",
4
- "_inBundle": false,
5
- "_integrity": "sha512-aOz4V/vjx4W8nYjz7OdAG+U/8Av/j2vPWwrePYH3TijbDR5UNjmm4gJadtnGJTTk49UOFCgx+S7uiwfVBNwXiA==",
6
- "_location": "/@syncfusion/ej2-pdf",
7
- "_phantomChildren": {},
8
- "_requested": {
9
- "type": "range",
10
- "registry": true,
11
- "raw": "@syncfusion/ej2-pdf@*",
12
- "name": "@syncfusion/ej2-pdf",
13
- "escapedName": "@syncfusion%2fej2-pdf",
14
- "scope": "@syncfusion",
15
- "rawSpec": "*",
16
- "saveSpec": null,
17
- "fetchSpec": "*"
18
- },
19
- "_requiredBy": [
20
- "/",
21
- "/@syncfusion/ej2",
22
- "/@syncfusion/ej2-pdfviewer"
23
- ],
24
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-24.1.44.tgz",
25
- "_shasum": "ff127c776ad25203a3426bb532309f0f3ec03200",
26
- "_spec": "@syncfusion/ej2-pdf@*",
27
- "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
28
- "author": {
29
- "name": "Syncfusion Inc."
30
- },
31
- "bundleDependencies": false,
32
- "dependencies": {
33
- "@syncfusion/ej2-base": "~24.1.46",
34
- "@syncfusion/ej2-compression": "~24.1.41"
35
- },
36
- "deprecated": false,
37
- "description": "Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.",
38
- "devDependencies": {},
39
- "es2015": "./dist/es6/ej2-pdf.es5.js",
40
- "keywords": [
41
- "ej2",
42
- "syncfusion",
43
- "ej2-pdf",
44
- "web-components",
45
- "JavaScript",
46
- "TypeScript",
47
- "pdf"
48
- ],
49
- "license": "SEE LICENSE IN license",
50
- "main": "./dist/ej2-pdf.umd.min.js",
51
- "module": "./index.js",
52
- "name": "@syncfusion/ej2-pdf",
53
- "repository": {
54
- "type": "git",
55
- "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/pdf"
56
- },
57
- "typings": "index.d.ts",
58
- "version": "24.1.47",
59
- "sideEffects": false,
60
- "homepage": "https://www.syncfusion.com/javascript-ui-controls"
61
- }
2
+ "_from": "@syncfusion/ej2-pdf@*",
3
+ "_id": "@syncfusion/ej2-pdf@24.1.44",
4
+ "_inBundle": false,
5
+ "_integrity": "sha512-aOz4V/vjx4W8nYjz7OdAG+U/8Av/j2vPWwrePYH3TijbDR5UNjmm4gJadtnGJTTk49UOFCgx+S7uiwfVBNwXiA==",
6
+ "_location": "/@syncfusion/ej2-pdf",
7
+ "_phantomChildren": {},
8
+ "_requested": {
9
+ "type": "range",
10
+ "registry": true,
11
+ "raw": "@syncfusion/ej2-pdf@*",
12
+ "name": "@syncfusion/ej2-pdf",
13
+ "escapedName": "@syncfusion%2fej2-pdf",
14
+ "scope": "@syncfusion",
15
+ "rawSpec": "*",
16
+ "saveSpec": null,
17
+ "fetchSpec": "*"
18
+ },
19
+ "_requiredBy": [
20
+ "/",
21
+ "/@syncfusion/ej2",
22
+ "/@syncfusion/ej2-pdfviewer"
23
+ ],
24
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-pdf/-/ej2-pdf-24.1.44.tgz",
25
+ "_shasum": "ff127c776ad25203a3426bb532309f0f3ec03200",
26
+ "_spec": "@syncfusion/ej2-pdf@*",
27
+ "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
28
+ "author": {
29
+ "name": "Syncfusion Inc."
30
+ },
31
+ "bundleDependencies": false,
32
+ "dependencies": {
33
+ "@syncfusion/ej2-base": "~24.1.46",
34
+ "@syncfusion/ej2-compression": "~24.1.41"
35
+ },
36
+ "deprecated": false,
37
+ "description": "Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.",
38
+ "devDependencies": {},
39
+ "es2015": "./dist/es6/ej2-pdf.es5.js",
40
+ "keywords": [
41
+ "ej2",
42
+ "syncfusion",
43
+ "ej2-pdf",
44
+ "web-components",
45
+ "JavaScript",
46
+ "TypeScript",
47
+ "pdf"
48
+ ],
49
+ "license": "SEE LICENSE IN license",
50
+ "main": "./dist/ej2-pdf.umd.min.js",
51
+ "module": "./index.js",
52
+ "name": "@syncfusion/ej2-pdf",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/pdf"
56
+ },
57
+ "typings": "index.d.ts",
58
+ "version": "24.1.48",
59
+ "sideEffects": false,
60
+ "homepage": "https://www.syncfusion.com/javascript-ui-controls"
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 (50, 100, 100, 50);
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 (50, 100, 100, 50);
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
- * // Get the first page
4216
- * let page: PdfPage = document.getPage(0) as PdfPage;
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[] = annotation.backColor;
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 Color as R, G, B color array in between 0 to 255.
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
- * // Get the first page
4233
- * let page: PdfPage = document.getPage(0) as PdfPage;
4234
- * // Get the first annotation of the page
4235
- * let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
4236
- * // Sets the back color of the annotation.
4237
- * annotation.backColor = [255,255,255];
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 (50, 100, 100, 50);
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
- * // Get the first page
11996
- * let page: PdfPage = document.getPage(0) as PdfPage;
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[] = annotation.backColor;
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
- if (typeof this._backColor === 'undefined') {
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 Color as R, G, B color array in between 0 to 255.
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
- * // Get the first page
12028
- * let page: PdfPage = document.getPage(0) as PdfPage;
12029
- * // Get the first annotation of the page
12030
- * let annotation: PdfWidgetAnnotation = page.annotations.at(0) as PdfWidgetAnnotation;
12031
- * // Sets the back color of the annotation.
12032
- * annotation.backColor = [255,255,255];
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
- if (typeof this.backColor === 'undefined' || this.backColor !== value) {
12041
- if (typeof this._mkDictionary === 'undefined') {
12042
- this._dictionary.update('MK', new _PdfDictionary(this._crossReference));
12043
- }
12044
- this._mkDictionary.update('BG', [Number.parseFloat((value[0] / 255).toFixed(3)),
12045
- Number.parseFloat((value[1] / 255).toFixed(3)),
12046
- Number.parseFloat((value[2] / 255).toFixed(3))]);
12047
- this._backColor = value;
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;