@syncfusion/ej2-pdf-data-extract 30.1.42 → 30.2.5

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.
Files changed (54) hide show
  1. package/dist/ej2-pdf-data-extract.umd.min.js +1 -2
  2. package/dist/global/ej2-pdf-data-extract.min.js +1 -2
  3. package/dist/global/index.d.ts +1 -2
  4. package/package.json +14 -46
  5. package/dist/ts/index.d.ts +0 -20
  6. package/dist/ts/index.ts +0 -20
  7. package/dist/ts/pdf-data-extract/core/content-parser-helper.d.ts +0 -62
  8. package/dist/ts/pdf-data-extract/core/content-parser-helper.ts +0 -640
  9. package/dist/ts/pdf-data-extract/core/enum.d.ts +0 -6
  10. package/dist/ts/pdf-data-extract/core/enum.ts +0 -6
  11. package/dist/ts/pdf-data-extract/core/graphic-state.d.ts +0 -33
  12. package/dist/ts/pdf-data-extract/core/graphic-state.ts +0 -106
  13. package/dist/ts/pdf-data-extract/core/pdf-data-extractor.d.ts +0 -210
  14. package/dist/ts/pdf-data-extract/core/pdf-data-extractor.ts +0 -977
  15. package/dist/ts/pdf-data-extract/core/pdf-text-parser.d.ts +0 -67
  16. package/dist/ts/pdf-data-extract/core/pdf-text-parser.ts +0 -495
  17. package/dist/ts/pdf-data-extract/core/redaction/index.d.ts +0 -4
  18. package/dist/ts/pdf-data-extract/core/redaction/index.ts +0 -4
  19. package/dist/ts/pdf-data-extract/core/redaction/pdf-redaction-processor.d.ts +0 -55
  20. package/dist/ts/pdf-data-extract/core/redaction/pdf-redaction-processor.ts +0 -592
  21. package/dist/ts/pdf-data-extract/core/redaction/pdf-redaction-region.d.ts +0 -281
  22. package/dist/ts/pdf-data-extract/core/redaction/pdf-redaction-region.ts +0 -342
  23. package/dist/ts/pdf-data-extract/core/redaction/pdf-redactor.d.ts +0 -129
  24. package/dist/ts/pdf-data-extract/core/redaction/pdf-redactor.ts +0 -322
  25. package/dist/ts/pdf-data-extract/core/redaction/text-glyph-mapper.d.ts +0 -12
  26. package/dist/ts/pdf-data-extract/core/redaction/text-glyph-mapper.ts +0 -153
  27. package/dist/ts/pdf-data-extract/core/text-extraction/binary-cmap-reader.d.ts +0 -24
  28. package/dist/ts/pdf-data-extract/core/text-extraction/binary-cmap-reader.ts +0 -281
  29. package/dist/ts/pdf-data-extract/core/text-extraction/cmap.d.ts +0 -50
  30. package/dist/ts/pdf-data-extract/core/text-extraction/cmap.ts +0 -565
  31. package/dist/ts/pdf-data-extract/core/text-extraction/compact-font-parser.d.ts +0 -191
  32. package/dist/ts/pdf-data-extract/core/text-extraction/compact-font-parser.ts +0 -1928
  33. package/dist/ts/pdf-data-extract/core/text-extraction/encoding-utils.d.ts +0 -102
  34. package/dist/ts/pdf-data-extract/core/text-extraction/encoding-utils.ts +0 -5780
  35. package/dist/ts/pdf-data-extract/core/text-extraction/font-structure.d.ts +0 -167
  36. package/dist/ts/pdf-data-extract/core/text-extraction/font-structure.ts +0 -1842
  37. package/dist/ts/pdf-data-extract/core/text-extraction/font-tables.d.ts +0 -5
  38. package/dist/ts/pdf-data-extract/core/text-extraction/font-tables.ts +0 -16
  39. package/dist/ts/pdf-data-extract/core/text-extraction/font-utils.d.ts +0 -18
  40. package/dist/ts/pdf-data-extract/core/text-extraction/font-utils.ts +0 -630
  41. package/dist/ts/pdf-data-extract/core/text-extraction/glyph.d.ts +0 -93
  42. package/dist/ts/pdf-data-extract/core/text-extraction/glyph.ts +0 -622
  43. package/dist/ts/pdf-data-extract/core/text-extraction/index.d.ts +0 -10
  44. package/dist/ts/pdf-data-extract/core/text-extraction/index.ts +0 -10
  45. package/dist/ts/pdf-data-extract/core/text-extraction/matrix-helper.d.ts +0 -38
  46. package/dist/ts/pdf-data-extract/core/text-extraction/matrix-helper.ts +0 -150
  47. package/dist/ts/pdf-data-extract/core/text-extraction/metrics.d.ts +0 -16
  48. package/dist/ts/pdf-data-extract/core/text-extraction/metrics.ts +0 -2938
  49. package/dist/ts/pdf-data-extract/core/text-structure.d.ts +0 -628
  50. package/dist/ts/pdf-data-extract/core/text-structure.ts +0 -668
  51. package/dist/ts/pdf-data-extract/core/utils.d.ts +0 -99
  52. package/dist/ts/pdf-data-extract/core/utils.ts +0 -626
  53. package/dist/ts/pdf-data-extract/index.d.ts +0 -20
  54. package/dist/ts/pdf-data-extract/index.ts +0 -20
@@ -1,281 +0,0 @@
1
- import { PdfAppearance, Rectangle } from '@syncfusion/ej2-pdf';
2
- /**
3
- * Represents the redaction process in a PDF document
4
- *
5
- * ```typescript
6
- * // Load an existing PDF document
7
- * let document: PdfDocument = new PdfDocument(data, password);
8
- * // Add redactions to the collection
9
- * let redactions: PdfRedactionRegion[] = [];
10
- * // Initialize a new instance of the `PdfRedactor` class
11
- * let redactor: PdfRedactor = new PdfRedactor(document);
12
- * // Initialize a new instance of the `PdfRedactionRegion` class.
13
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
14
- * // Sets the fill color used to fill the redacted area.
15
- * redaction.fillColor = [255, 0, 0];
16
- * redactions.push(redaction);
17
- * // Add redactions with specified options.
18
- * redactor.add(redactions);
19
- * // Apply redactions on the PDF document
20
- * redactor.redact();
21
- * // Save the document
22
- * document.save('output.pdf');
23
- * // Destroy the document
24
- * document.destroy();
25
- * ```
26
- */
27
- export declare class PdfRedactionRegion {
28
- _pageIndex: number;
29
- _appearance: PdfAppearance;
30
- _bounds: Rectangle;
31
- _isTextOnly: boolean;
32
- _fillColor: number[];
33
- _appearanceEnabled: boolean;
34
- constructor(pageIndex: number, bounds: Rectangle, isTextOnly?: boolean, fillColor?: number[]);
35
- /**
36
- * Sets the page index of the PDF document where redaction is to be applied.
37
- *
38
- * @param {number} value The page index of the PDF document where redaction is to be applied.
39
- *
40
- * ```typescript
41
- * // Load an existing PDF document
42
- * let document: PdfDocument = new PdfDocument(data, password);
43
- * // Add redactions to the collection
44
- * let redactions: PdfRedactionRegion[] = [];
45
- * // Initialize a new instance of the `PdfRedactor` class
46
- * let redactor: PdfRedactor = new PdfRedactor(document);
47
- * // Initialize a new instance of the `PdfRedactionRegion` class.
48
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
49
- * // Sets the page index of the PDF document where redaction is to be applied.
50
- * redaction.pageIndex = 1;
51
- * redactions.push(redaction);
52
- * // Add redactions with specified options.
53
- * redactor.add(redactions);
54
- * // Apply redactions on the PDF document
55
- * redactor.redact();
56
- * // Save the document
57
- * document.save('output.pdf');
58
- * // Destroy the document
59
- * document.destroy();
60
- * ```
61
- */
62
- /**
63
- * Gets the page index of the PDF document where redaction is to be applied.
64
- *
65
- * @returns {number} page index
66
- *
67
- * ```typescript
68
- * // Load an existing PDF document
69
- * let document: PdfDocument = new PdfDocument(data, password);
70
- * // Add redactions to the collection
71
- * let redactions: PdfRedactionRegion[] = [];
72
- * let redactor: PdfRedactor = new PdfRedactor(document);
73
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
74
- * // Gets the page index of the PDF document where redaction is to be applied.
75
- * let index: number = redaction.pageIndex;
76
- * redactions.push(redaction);
77
- * redactor.add(redactions);
78
- * // Apply redactions on the PDF document
79
- * redactor.redact();
80
- * // Save the document
81
- * document.save('output.pdf');
82
- * // Destroy the document
83
- * document.destroy();
84
- * ```
85
- */
86
- pageIndex: number;
87
- /**
88
- * Sets the rectangular bounds that define areas to be redacted
89
- *
90
- * @param {number} value The rectangular bounds that define the areas to be redacted.
91
- *
92
- * ```typescript
93
- * // Load an existing PDF document
94
- * let document: PdfDocument = new PdfDocument(data, password);
95
- * // Add redactions to the collection
96
- * let redactions: PdfRedactionRegion[] = [];
97
- * // Initialize a new instance of the `PdfRedactor` class
98
- * let redactor: PdfRedactor = new PdfRedactor(document);
99
- * // Initialize a new instance of the `PdfRedactionRegion` class.
100
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
101
- * // Sets the rectangular bounds that define areas to be redacted
102
- * redaction.bounds = {x:40, y: 41.809, width: 80, height: 90};
103
- * redactions.push(redaction);
104
- * // Add redactions with specified options.
105
- * redactor.add(redactions);
106
- * // Apply redactions on the PDF document
107
- * redactor.redact();
108
- * // Save the document
109
- * document.save('output.pdf');
110
- * // Destroy the document
111
- * document.destroy();
112
- * ```
113
- */
114
- /**
115
- * Gets the bounds of the redaction area.
116
- *
117
- * @returns {Rectangle} A Rectangle object representing the boundaries of the redaction.
118
- *
119
- * // Load an existing PDF document
120
- * let document: PdfDocument = new PdfDocument(data, password);
121
- * // Add redactions to the collection
122
- * let redactions: PdfRedactionRegion[] = [];
123
- * // Initialize a new instance of the `PdfRedactor` class
124
- * let redactor: PdfRedactor = new PdfRedactor(document);
125
- * // Initialize a new instance of the `PdfRedactionRegion` class.
126
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
127
- * // Gets the bounds of the redaction area.
128
- * let bounds: Rectangle = redaction.bounds;
129
- * redactions.push(redaction);
130
- * // Add redactions with specified options.
131
- * redactor.add(redactions);
132
- * // Apply redactions on the PDF document
133
- * redactor.redact();
134
- * // Save the document
135
- * document.save('output.pdf');
136
- * // Destroy the document
137
- * document.destroy();
138
- * ```
139
- */
140
- bounds: Rectangle;
141
- /**
142
- * Sets a value indicating whether only the text within the bounds should be redacted.
143
- * The default value is `false`.
144
- *
145
- * @param {boolean} value A boolean flag indicating text only redaction.
146
- *
147
- * ```typescript
148
- * // Load an existing PDF document
149
- * let document: PdfDocument = new PdfDocument(data, password);
150
- * // Add redactions to the collection
151
- * let redactions: PdfRedactionRegion[] = [];
152
- * // Initialize a new instance of the `PdfRedactor` class
153
- * let redactor: PdfRedactor = new PdfRedactor(document);
154
- * // Initialize a new instance of the `PdfRedactionRegion` class.
155
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
156
- * // Sets the fill color used to fill the redacted area.
157
- * redaction.isTextOnly = true;
158
- * redactions.push(redaction);
159
- * // Add redactions with specified options.
160
- * redactor.add(redactions);
161
- * // Apply redactions on the PDF document
162
- * redactor.redact();
163
- * // Save the document
164
- * document.save('output.pdf');
165
- * // Destroy the document
166
- * document.destroy();
167
- * ```
168
- */
169
- /**
170
- * Gets a value indicating whether only the text should be redacted.
171
- *
172
- * @returns {boolean} value indicating if only text should be redacted.
173
- *
174
- * // Load an existing PDF document
175
- * let document: PdfDocument = new PdfDocument(data, password);
176
- * // Add redactions to the collection
177
- * let redactions: PdfRedactionRegion[] = [];
178
- * // Initialize a new instance of the `PdfRedactor` class
179
- * let redactor: PdfRedactor = new PdfRedactor(document);
180
- * // Initialize a new instance of the `PdfRedactionRegion` class.
181
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
182
- * // Gets a value indicating whether only the text should be redacted.
183
- * let textOnly: boolean = redaction.isTextOnly;
184
- * redactions.push(redaction);
185
- * // Add redactions with specified options.
186
- * redactor.add(redactions);
187
- * // Apply redactions on the PDF document
188
- * redactor.redact();
189
- * // Save the document
190
- * document.save('output.pdf');
191
- * // Destroy the document
192
- * document.destroy();
193
- * ```
194
- */
195
- isTextOnly: boolean;
196
- /**
197
- * Sets the fill color used to fill the redacted area.
198
- *
199
- * @param {number[]} value An array of numbers representing the RGB color used to fill the redacted area.
200
- *
201
- * ```typescript
202
- * // Load an existing PDF document
203
- * let document: PdfDocument = new PdfDocument(data, password);
204
- * // Add redactions to the collection
205
- * let redactions: PdfRedactionRegion[] = [];
206
- * // Initialize a new instance of the `PdfRedactor` class
207
- * let redactor: PdfRedactor = new PdfRedactor(document);
208
- * // Initialize a new instance of the `PdfRedactionRegion` class.
209
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
210
- * // Sets the fill color used to fill the redacted area.
211
- * redaction.fillColor = [255, 0, 0];
212
- * redactions.push(redaction);
213
- * // Add redactions with specified options.
214
- * redactor.add(redactions);
215
- * // Apply redactions on the PDF document
216
- * redactor.redact();
217
- * // Save the document
218
- * document.save('output.pdf');
219
- * // Destroy the document
220
- * document.destroy();
221
- * ```
222
- */
223
- /**
224
- * Gets the fill color used to fill the redacted area.
225
- *
226
- * @returns {number[]} value indicating array of numbers representing the RGB color values [R, G, B].
227
- *
228
- * // Load an existing PDF document
229
- * let document: PdfDocument = new PdfDocument(data, password);
230
- * // Add redactions to the collection
231
- * let redactions: PdfRedactionRegion[] = [];
232
- * // Initialize a new instance of the `PdfRedactor` class
233
- * let redactor: PdfRedactor = new PdfRedactor(document);
234
- * // Initialize a new instance of the `PdfRedactionRegion` class.
235
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
236
- * // Gets a value indicating whether only the text should be redacted.
237
- * let fillColor: number[] = redaction.fillColor;
238
- * redactions.push(redaction);
239
- * // Add redactions with specified options.
240
- * redactor.add(redactions);
241
- * // Apply redactions on the PDF document
242
- * redactor.redact();
243
- * // Save the document
244
- * document.save('output.pdf');
245
- * // Destroy the document
246
- * document.destroy();
247
- * ```
248
- */
249
- fillColor: number[];
250
- /**
251
- * Get the appearance of the pdf redaction
252
- *
253
- * @returns {PdfAppearance} Returns the appearance of the redaction.
254
- *
255
- * // Load an existing PDF document
256
- * let document: PdfDocument = new PdfDocument(data, password);
257
- * // Add redactions to the collection
258
- * let redactions: PdfRedactionRegion[] = [];
259
- * let region = { x: 40, y: 43.620000000000005, width: 80, height: 20};
260
- * // Initialize a new instance of the `PdfRedactionRegion` class.
261
- * let redaction = new PdfRedactionRegion(0, {x: 0, y: 0, width: 80, height: 20}, true);
262
- * let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.helvetica, 10);
263
- * redaction.appearance.normal.graphics.drawString('Redacted Text', font, [0, 0, 80, 20], undefined, new PdfBrush([255, 0, 0]));
264
- * redactions.push(redaction);
265
- * redaction = new PdfRedactionRegion(0, {x: 0, y: 0, width: 80, height: 20}, true);
266
- * region = { x: 40, y: 43.620000000000005, width: 80, height: 20};
267
- * redactions.push(redaction);
268
- * // Initialize a new instance of the `PdfRedactor` class
269
- * let redactor: PdfRedactor = new PdfRedactor(document);
270
- * // Add redactions with specified options.
271
- * redactor.add(redactions);
272
- * // Apply redactions on the PDF document
273
- * redactor.redact();
274
- * // Save the document
275
- * document.save('output.pdf');
276
- * // Destroy the document
277
- * document.destroy();
278
- * ```
279
- */
280
- readonly appearance: PdfAppearance;
281
- }
@@ -1,342 +0,0 @@
1
- import { PdfAppearance, PdfTemplate, Rectangle } from '@syncfusion/ej2-pdf';
2
- /**
3
- * Represents the redaction process in a PDF document
4
- *
5
- * ```typescript
6
- * // Load an existing PDF document
7
- * let document: PdfDocument = new PdfDocument(data, password);
8
- * // Add redactions to the collection
9
- * let redactions: PdfRedactionRegion[] = [];
10
- * // Initialize a new instance of the `PdfRedactor` class
11
- * let redactor: PdfRedactor = new PdfRedactor(document);
12
- * // Initialize a new instance of the `PdfRedactionRegion` class.
13
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
14
- * // Sets the fill color used to fill the redacted area.
15
- * redaction.fillColor = [255, 0, 0];
16
- * redactions.push(redaction);
17
- * // Add redactions with specified options.
18
- * redactor.add(redactions);
19
- * // Apply redactions on the PDF document
20
- * redactor.redact();
21
- * // Save the document
22
- * document.save('output.pdf');
23
- * // Destroy the document
24
- * document.destroy();
25
- * ```
26
- */
27
- export class PdfRedactionRegion {
28
- _pageIndex: number;
29
- _appearance: PdfAppearance;
30
- _bounds: Rectangle;
31
- _isTextOnly: boolean = false;
32
- _fillColor: number[];
33
- _appearanceEnabled: boolean = false;
34
- /*
35
- * Initialize a new instance of the `PdfRedactionRegion` class.
36
- *
37
- * @param {number} pageIndex The index of the page in the PDF document where redaction is to be applied.
38
- * @param {Rectangle} bounds The rectangular bounds that define areas to be redacted
39
- * @param {number[]} fillColor An array of numbers representing the RGB color used to fill the redacted area.
40
- * @param {Boolean} isTextOnly A boolean indicating whether only the text within the redaction bounds should be redacted.
41
- *
42
- * ```typescript
43
- * // Load an existing PDF document
44
- * let document: PdfDocument = new PdfDocument(data, password);
45
- * // Add redactions to the collection
46
- * let redactions: PdfRedactionRegion[] = [];
47
- * let redactor: PdfRedactor = new PdfRedactor(document);
48
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90}, true, [255, 0, 0]);
49
- * redactions.push(redaction);
50
- * redactor.add(redactions);
51
- * // Apply redactions on the PDF document
52
- * redactor.redact();
53
- * // Save the document
54
- * document.save('output.pdf');
55
- * // Destroy the document
56
- * document.destroy();
57
- * ```
58
- */
59
- constructor(pageIndex: number, bounds: Rectangle, isTextOnly?: boolean, fillColor?: number[]) {
60
- this._pageIndex = pageIndex;
61
- this._bounds = bounds;
62
- if (typeof(isTextOnly) !== 'undefined') {
63
- this._isTextOnly = isTextOnly;
64
- }
65
- if (typeof(fillColor) !== 'undefined') {
66
- this._fillColor = fillColor;
67
- }
68
- }
69
- /**
70
- * Sets the page index of the PDF document where redaction is to be applied.
71
- *
72
- * @param {number} value The page index of the PDF document where redaction is to be applied.
73
- *
74
- * ```typescript
75
- * // Load an existing PDF document
76
- * let document: PdfDocument = new PdfDocument(data, password);
77
- * // Add redactions to the collection
78
- * let redactions: PdfRedactionRegion[] = [];
79
- * // Initialize a new instance of the `PdfRedactor` class
80
- * let redactor: PdfRedactor = new PdfRedactor(document);
81
- * // Initialize a new instance of the `PdfRedactionRegion` class.
82
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
83
- * // Sets the page index of the PDF document where redaction is to be applied.
84
- * redaction.pageIndex = 1;
85
- * redactions.push(redaction);
86
- * // Add redactions with specified options.
87
- * redactor.add(redactions);
88
- * // Apply redactions on the PDF document
89
- * redactor.redact();
90
- * // Save the document
91
- * document.save('output.pdf');
92
- * // Destroy the document
93
- * document.destroy();
94
- * ```
95
- */
96
- set pageIndex(value: number) {
97
- this._pageIndex = value;
98
- }
99
- /**
100
- * Gets the page index of the PDF document where redaction is to be applied.
101
- *
102
- * @returns {number} page index
103
- *
104
- * ```typescript
105
- * // Load an existing PDF document
106
- * let document: PdfDocument = new PdfDocument(data, password);
107
- * // Add redactions to the collection
108
- * let redactions: PdfRedactionRegion[] = [];
109
- * let redactor: PdfRedactor = new PdfRedactor(document);
110
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
111
- * // Gets the page index of the PDF document where redaction is to be applied.
112
- * let index: number = redaction.pageIndex;
113
- * redactions.push(redaction);
114
- * redactor.add(redactions);
115
- * // Apply redactions on the PDF document
116
- * redactor.redact();
117
- * // Save the document
118
- * document.save('output.pdf');
119
- * // Destroy the document
120
- * document.destroy();
121
- * ```
122
- */
123
- get pageIndex(): number {
124
- return this._pageIndex;
125
- }
126
- /**
127
- * Sets the rectangular bounds that define areas to be redacted
128
- *
129
- * @param {number} value The rectangular bounds that define the areas to be redacted.
130
- *
131
- * ```typescript
132
- * // Load an existing PDF document
133
- * let document: PdfDocument = new PdfDocument(data, password);
134
- * // Add redactions to the collection
135
- * let redactions: PdfRedactionRegion[] = [];
136
- * // Initialize a new instance of the `PdfRedactor` class
137
- * let redactor: PdfRedactor = new PdfRedactor(document);
138
- * // Initialize a new instance of the `PdfRedactionRegion` class.
139
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
140
- * // Sets the rectangular bounds that define areas to be redacted
141
- * redaction.bounds = {x:40, y: 41.809, width: 80, height: 90};
142
- * redactions.push(redaction);
143
- * // Add redactions with specified options.
144
- * redactor.add(redactions);
145
- * // Apply redactions on the PDF document
146
- * redactor.redact();
147
- * // Save the document
148
- * document.save('output.pdf');
149
- * // Destroy the document
150
- * document.destroy();
151
- * ```
152
- */
153
- set bounds(value: Rectangle) {
154
- this._bounds = value;
155
- }
156
- /**
157
- * Gets the bounds of the redaction area.
158
- *
159
- * @returns {Rectangle} A Rectangle object representing the boundaries of the redaction.
160
- *
161
- * // Load an existing PDF document
162
- * let document: PdfDocument = new PdfDocument(data, password);
163
- * // Add redactions to the collection
164
- * let redactions: PdfRedactionRegion[] = [];
165
- * // Initialize a new instance of the `PdfRedactor` class
166
- * let redactor: PdfRedactor = new PdfRedactor(document);
167
- * // Initialize a new instance of the `PdfRedactionRegion` class.
168
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
169
- * // Gets the bounds of the redaction area.
170
- * let bounds: Rectangle = redaction.bounds;
171
- * redactions.push(redaction);
172
- * // Add redactions with specified options.
173
- * redactor.add(redactions);
174
- * // Apply redactions on the PDF document
175
- * redactor.redact();
176
- * // Save the document
177
- * document.save('output.pdf');
178
- * // Destroy the document
179
- * document.destroy();
180
- * ```
181
- */
182
- get bounds(): Rectangle{
183
- return this._bounds;
184
- }
185
- /**
186
- * Sets a value indicating whether only the text within the bounds should be redacted.
187
- * The default value is `false`.
188
- *
189
- * @param {boolean} value A boolean flag indicating text only redaction.
190
- *
191
- * ```typescript
192
- * // Load an existing PDF document
193
- * let document: PdfDocument = new PdfDocument(data, password);
194
- * // Add redactions to the collection
195
- * let redactions: PdfRedactionRegion[] = [];
196
- * // Initialize a new instance of the `PdfRedactor` class
197
- * let redactor: PdfRedactor = new PdfRedactor(document);
198
- * // Initialize a new instance of the `PdfRedactionRegion` class.
199
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
200
- * // Sets the fill color used to fill the redacted area.
201
- * redaction.isTextOnly = true;
202
- * redactions.push(redaction);
203
- * // Add redactions with specified options.
204
- * redactor.add(redactions);
205
- * // Apply redactions on the PDF document
206
- * redactor.redact();
207
- * // Save the document
208
- * document.save('output.pdf');
209
- * // Destroy the document
210
- * document.destroy();
211
- * ```
212
- */
213
- set isTextOnly(value: boolean) {
214
- this._isTextOnly = value;
215
- }
216
- /**
217
- * Gets a value indicating whether only the text should be redacted.
218
- *
219
- * @returns {boolean} value indicating if only text should be redacted.
220
- *
221
- * // Load an existing PDF document
222
- * let document: PdfDocument = new PdfDocument(data, password);
223
- * // Add redactions to the collection
224
- * let redactions: PdfRedactionRegion[] = [];
225
- * // Initialize a new instance of the `PdfRedactor` class
226
- * let redactor: PdfRedactor = new PdfRedactor(document);
227
- * // Initialize a new instance of the `PdfRedactionRegion` class.
228
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
229
- * // Gets a value indicating whether only the text should be redacted.
230
- * let textOnly: boolean = redaction.isTextOnly;
231
- * redactions.push(redaction);
232
- * // Add redactions with specified options.
233
- * redactor.add(redactions);
234
- * // Apply redactions on the PDF document
235
- * redactor.redact();
236
- * // Save the document
237
- * document.save('output.pdf');
238
- * // Destroy the document
239
- * document.destroy();
240
- * ```
241
- */
242
- get isTextOnly(): boolean {
243
- return this._isTextOnly;
244
- }
245
- /**
246
- * Sets the fill color used to fill the redacted area.
247
- *
248
- * @param {number[]} value An array of numbers representing the RGB color used to fill the redacted area.
249
- *
250
- * ```typescript
251
- * // Load an existing PDF document
252
- * let document: PdfDocument = new PdfDocument(data, password);
253
- * // Add redactions to the collection
254
- * let redactions: PdfRedactionRegion[] = [];
255
- * // Initialize a new instance of the `PdfRedactor` class
256
- * let redactor: PdfRedactor = new PdfRedactor(document);
257
- * // Initialize a new instance of the `PdfRedactionRegion` class.
258
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
259
- * // Sets the fill color used to fill the redacted area.
260
- * redaction.fillColor = [255, 0, 0];
261
- * redactions.push(redaction);
262
- * // Add redactions with specified options.
263
- * redactor.add(redactions);
264
- * // Apply redactions on the PDF document
265
- * redactor.redact();
266
- * // Save the document
267
- * document.save('output.pdf');
268
- * // Destroy the document
269
- * document.destroy();
270
- * ```
271
- */
272
- set fillColor(value: number[]) {
273
- this._fillColor = value;
274
- }
275
- /**
276
- * Gets the fill color used to fill the redacted area.
277
- *
278
- * @returns {number[]} value indicating array of numbers representing the RGB color values [R, G, B].
279
- *
280
- * // Load an existing PDF document
281
- * let document: PdfDocument = new PdfDocument(data, password);
282
- * // Add redactions to the collection
283
- * let redactions: PdfRedactionRegion[] = [];
284
- * // Initialize a new instance of the `PdfRedactor` class
285
- * let redactor: PdfRedactor = new PdfRedactor(document);
286
- * // Initialize a new instance of the `PdfRedactionRegion` class.
287
- * let redaction: PdfRedactionRegion = new PdfRedactionRegion(0, {x:40, y: 41.809, width: 80, height: 90});
288
- * // Gets a value indicating whether only the text should be redacted.
289
- * let fillColor: number[] = redaction.fillColor;
290
- * redactions.push(redaction);
291
- * // Add redactions with specified options.
292
- * redactor.add(redactions);
293
- * // Apply redactions on the PDF document
294
- * redactor.redact();
295
- * // Save the document
296
- * document.save('output.pdf');
297
- * // Destroy the document
298
- * document.destroy();
299
- * ```
300
- */
301
- get fillColor(): number[] {
302
- return this._fillColor;
303
- }
304
- /**
305
- * Get the appearance of the pdf redaction
306
- *
307
- * @returns {PdfAppearance} Returns the appearance of the redaction.
308
- *
309
- * // Load an existing PDF document
310
- * let document: PdfDocument = new PdfDocument(data, password);
311
- * // Add redactions to the collection
312
- * let redactions: PdfRedactionRegion[] = [];
313
- * let region = { x: 40, y: 43.620000000000005, width: 80, height: 20};
314
- * // Initialize a new instance of the `PdfRedactionRegion` class.
315
- * let redaction = new PdfRedactionRegion(0, {x: 0, y: 0, width: 80, height: 20}, true);
316
- * let font: PdfStandardFont = new PdfStandardFont(PdfFontFamily.helvetica, 10);
317
- * redaction.appearance.normal.graphics.drawString('Redacted Text', font, [0, 0, 80, 20], undefined, new PdfBrush([255, 0, 0]));
318
- * redactions.push(redaction);
319
- * redaction = new PdfRedactionRegion(0, {x: 0, y: 0, width: 80, height: 20}, true);
320
- * region = { x: 40, y: 43.620000000000005, width: 80, height: 20};
321
- * redactions.push(redaction);
322
- * // Initialize a new instance of the `PdfRedactor` class
323
- * let redactor: PdfRedactor = new PdfRedactor(document);
324
- * // Add redactions with specified options.
325
- * redactor.add(redactions);
326
- * // Apply redactions on the PDF document
327
- * redactor.redact();
328
- * // Save the document
329
- * document.save('output.pdf');
330
- * // Destroy the document
331
- * document.destroy();
332
- * ```
333
- */
334
- get appearance(): PdfAppearance {
335
- if (typeof(this._appearance) === 'undefined') {
336
- this._appearanceEnabled = true;
337
- this._appearance = new PdfAppearance(this.bounds);
338
- this._appearance.normal = new PdfTemplate({x: 0, y: 0, width: this._bounds.width, height: this._bounds.height});
339
- }
340
- return this._appearance;
341
- }
342
- }