@syncfusion/ej2-pdf-export 20.2.43 → 20.3.47
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/dist/ej2-pdf-export.min.js +10 -0
- package/dist/ej2-pdf-export.umd.min.js +1 -1
- package/dist/global/ej2-pdf-export.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/implementation/actions/action.ts +76 -0
- package/dist/ts/implementation/actions/uri-action.ts +52 -0
- package/dist/ts/implementation/annotations/action-link-annotation.ts +43 -0
- package/dist/ts/implementation/annotations/annotation-collection.ts +159 -0
- package/dist/ts/implementation/annotations/annotation.ts +241 -0
- package/dist/ts/implementation/annotations/document-link-annotation.ts +118 -0
- package/dist/ts/implementation/annotations/link-annotation.ts +32 -0
- package/dist/ts/implementation/annotations/pdf-text-web-link.ts +265 -0
- package/dist/ts/implementation/annotations/uri-annotation.ts +86 -0
- package/dist/ts/implementation/collections/dictionary.ts +150 -0
- package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +125 -0
- package/dist/ts/implementation/collections/utils.ts +38 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +39 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +108 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +127 -0
- package/dist/ts/implementation/document/automatic-fields/composite-field.ts +76 -0
- package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +37 -0
- package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +75 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +157 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +82 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +60 -0
- package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +48 -0
- package/dist/ts/implementation/document/pdf-catalog.ts +52 -0
- package/dist/ts/implementation/document/pdf-document-base.ts +166 -0
- package/dist/ts/implementation/document/pdf-document-template.ts +310 -0
- package/dist/ts/implementation/document/pdf-document.ts +342 -0
- package/dist/ts/implementation/drawing/pdf-drawing.ts +218 -0
- package/dist/ts/implementation/general/enum.ts +21 -0
- package/dist/ts/implementation/general/functions/pdf-function.ts +66 -0
- package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +62 -0
- package/dist/ts/implementation/general/pdf-cache-collection.ts +97 -0
- package/dist/ts/implementation/general/pdf-collection.ts +41 -0
- package/dist/ts/implementation/general/pdf-destination.ts +170 -0
- package/dist/ts/implementation/graphics/brushes/enum.ts +237 -0
- package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +294 -0
- package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +68 -0
- package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +2438 -0
- package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +295 -0
- package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +311 -0
- package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +406 -0
- package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +290 -0
- package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +107 -0
- package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +304 -0
- package/dist/ts/implementation/graphics/constants.ts +31 -0
- package/dist/ts/implementation/graphics/enum.ts +413 -0
- package/dist/ts/implementation/graphics/figures/arc.ts +133 -0
- package/dist/ts/implementation/graphics/figures/base/draw-element.ts +59 -0
- package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +260 -0
- package/dist/ts/implementation/graphics/figures/base/fill-element.ts +72 -0
- package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +34 -0
- package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +69 -0
- package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +276 -0
- package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +205 -0
- package/dist/ts/implementation/graphics/figures/ellipse-part.ts +76 -0
- package/dist/ts/implementation/graphics/figures/enum.ts +80 -0
- package/dist/ts/implementation/graphics/figures/layout-element.ts +132 -0
- package/dist/ts/implementation/graphics/figures/path.ts +646 -0
- package/dist/ts/implementation/graphics/figures/pdf-template.ts +205 -0
- package/dist/ts/implementation/graphics/figures/rectangle-area.ts +108 -0
- package/dist/ts/implementation/graphics/figures/text-element.ts +445 -0
- package/dist/ts/implementation/graphics/fonts/enum.ts +385 -0
- package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +248 -0
- package/dist/ts/implementation/graphics/fonts/pdf-font.ts +316 -0
- package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +606 -0
- package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +243 -0
- package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +474 -0
- package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +165 -0
- package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +958 -0
- package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +374 -0
- package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +255 -0
- package/dist/ts/implementation/graphics/fonts/string-layouter.ts +617 -0
- package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +275 -0
- package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +206 -0
- package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +18 -0
- package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +18 -0
- package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +14 -0
- package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +35 -0
- package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +94 -0
- package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +56 -0
- package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +10 -0
- package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +14 -0
- package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +106 -0
- package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +58 -0
- package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +33 -0
- package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +22 -0
- package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +42 -0
- package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +1254 -0
- package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +577 -0
- package/dist/ts/implementation/graphics/images/byte-array.ts +137 -0
- package/dist/ts/implementation/graphics/images/image-decoder.ts +437 -0
- package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +110 -0
- package/dist/ts/implementation/graphics/images/pdf-image.ts +132 -0
- package/dist/ts/implementation/graphics/pdf-color.ts +478 -0
- package/dist/ts/implementation/graphics/pdf-graphics.ts +2424 -0
- package/dist/ts/implementation/graphics/pdf-margins.ts +124 -0
- package/dist/ts/implementation/graphics/pdf-pen.ts +370 -0
- package/dist/ts/implementation/graphics/pdf-resources.ts +300 -0
- package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +246 -0
- package/dist/ts/implementation/graphics/pdf-transparency.ts +93 -0
- package/dist/ts/implementation/graphics/unit-convertor.ts +96 -0
- package/dist/ts/implementation/input-output/big-endian-writer.ts +121 -0
- package/dist/ts/implementation/input-output/cross-table.ts +21 -0
- package/dist/ts/implementation/input-output/enum.ts +16 -0
- package/dist/ts/implementation/input-output/pdf-cross-table.ts +524 -0
- package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +515 -0
- package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +194 -0
- package/dist/ts/implementation/input-output/pdf-operators.ts +363 -0
- package/dist/ts/implementation/input-output/pdf-stream-writer.ts +681 -0
- package/dist/ts/implementation/input-output/pdf-writer.ts +88 -0
- package/dist/ts/implementation/pages/enum.ts +201 -0
- package/dist/ts/implementation/pages/page-added-event-arguments.ts +39 -0
- package/dist/ts/implementation/pages/pdf-document-page-collection.ts +180 -0
- package/dist/ts/implementation/pages/pdf-page-base.ts +181 -0
- package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +348 -0
- package/dist/ts/implementation/pages/pdf-page-layer.ts +271 -0
- package/dist/ts/implementation/pages/pdf-page-settings.ts +192 -0
- package/dist/ts/implementation/pages/pdf-page-size.ts +162 -0
- package/dist/ts/implementation/pages/pdf-page-template-element.ts +659 -0
- package/dist/ts/implementation/pages/pdf-page.ts +235 -0
- package/dist/ts/implementation/pages/pdf-section-collection.ts +187 -0
- package/dist/ts/implementation/pages/pdf-section-page-collection.ts +61 -0
- package/dist/ts/implementation/pages/pdf-section-templates.ts +96 -0
- package/dist/ts/implementation/pages/pdf-section.ts +644 -0
- package/dist/ts/implementation/primitives/pdf-array.ts +386 -0
- package/dist/ts/implementation/primitives/pdf-boolean.ts +119 -0
- package/dist/ts/implementation/primitives/pdf-dictionary.ts +513 -0
- package/dist/ts/implementation/primitives/pdf-name.ts +218 -0
- package/dist/ts/implementation/primitives/pdf-number.ts +165 -0
- package/dist/ts/implementation/primitives/pdf-reference.ts +430 -0
- package/dist/ts/implementation/primitives/pdf-stream.ts +336 -0
- package/dist/ts/implementation/primitives/pdf-string.ts +397 -0
- package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +2027 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +1189 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +206 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +470 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +853 -0
- package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +240 -0
- package/dist/ts/implementation/structured-elements/grid/styles/style.ts +424 -0
- package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +16 -0
- package/dist/ts/interfaces/i-pdf-cache.ts +23 -0
- package/dist/ts/interfaces/i-pdf-changable.ts +17 -0
- package/dist/ts/interfaces/i-pdf-clonable.ts +12 -0
- package/dist/ts/interfaces/i-pdf-primitives.ts +45 -0
- package/dist/ts/interfaces/i-pdf-true-type-font.ts +48 -0
- package/dist/ts/interfaces/i-pdf-wrapper.ts +13 -0
- package/dist/ts/interfaces/i-pdf-writer.ts +29 -0
- package/package.json +8 -7
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PdfArray.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
import { IPdfPrimitive } from './../../interfaces/i-pdf-primitives';
|
|
5
|
+
import { IPdfWriter } from './../../interfaces/i-pdf-writer';
|
|
6
|
+
import { ObjectStatus } from './../input-output/enum';
|
|
7
|
+
import { PdfCrossTable } from './../input-output/pdf-cross-table';
|
|
8
|
+
import { PdfNumber } from './pdf-number';
|
|
9
|
+
import { RectangleF } from './../drawing/pdf-drawing';
|
|
10
|
+
import { Operators } from './../input-output/pdf-operators';
|
|
11
|
+
import { PdfName } from './pdf-name';
|
|
12
|
+
/**
|
|
13
|
+
* `PdfArray` class is used to perform array related primitive operations.
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export class PdfArray implements IPdfPrimitive {
|
|
17
|
+
//Fields
|
|
18
|
+
/**
|
|
19
|
+
* `startMark` - '['
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
public startMark : string = '[';
|
|
23
|
+
/**
|
|
24
|
+
* `endMark` - ']'.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
public endMark : string = ']';
|
|
28
|
+
/**
|
|
29
|
+
* The `elements` of the PDF array.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
private internalElements : IPdfPrimitive[];
|
|
33
|
+
/**
|
|
34
|
+
* Indicates if the array `was changed`.
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
private bChanged : boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Shows the type of object `status` whether it is object registered or other status;
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
private status9 : ObjectStatus;
|
|
43
|
+
/**
|
|
44
|
+
* Indicates if the object is currently in `saving state` or not.
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
private isSaving9 : boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Holds the `index` number of the object.
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
private index9 : number;
|
|
53
|
+
/**
|
|
54
|
+
* Internal variable to store the `position`.
|
|
55
|
+
* @default -1
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
private position9 : number = -1;
|
|
59
|
+
/**
|
|
60
|
+
* Internal variable to hold `PdfCrossTable` reference.
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private pdfCrossTable : PdfCrossTable;
|
|
64
|
+
/**
|
|
65
|
+
* Internal variable to hold `cloned object`.
|
|
66
|
+
* @default null
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
private clonedObject9 : PdfArray = null;
|
|
70
|
+
/**
|
|
71
|
+
* Represents the Font dictionary.
|
|
72
|
+
* @hidden
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
public isFont : boolean = false;
|
|
76
|
+
//property
|
|
77
|
+
/**
|
|
78
|
+
* Gets the `IPdfSavable` at the specified index.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
public items(index : number) : IPdfPrimitive {
|
|
82
|
+
// if (index < 0 || index >= this.Count) {
|
|
83
|
+
// throw new Error('ArgumentOutOfRangeException : index, The index can"t be less then zero or greater then Count.');
|
|
84
|
+
// }
|
|
85
|
+
return this.internalElements[index] as IPdfPrimitive;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the `count`.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
public get count() : number {
|
|
92
|
+
return this.internalElements.length;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets or sets the `Status` of the specified object.
|
|
96
|
+
* @private
|
|
97
|
+
*/
|
|
98
|
+
public get status() : ObjectStatus {
|
|
99
|
+
return this.status9;
|
|
100
|
+
}
|
|
101
|
+
public set status(value : ObjectStatus) {
|
|
102
|
+
this.status9 = value;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Gets or sets a value indicating whether this document `is saving` or not.
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
public get isSaving() : boolean {
|
|
109
|
+
return this.isSaving9;
|
|
110
|
+
}
|
|
111
|
+
public set isSaving(value : boolean) {
|
|
112
|
+
this.isSaving9 = value;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns `cloned object`.
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
public get clonedObject() : IPdfPrimitive {
|
|
119
|
+
return this.clonedObject9;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Gets or sets the `position` of the object.
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
public get position() : number {
|
|
126
|
+
return this.position9;
|
|
127
|
+
}
|
|
128
|
+
public set position(value : number) {
|
|
129
|
+
this.position9 = value;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets or sets the `index` value of the specified object.
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
public get objectCollectionIndex() : number {
|
|
136
|
+
return this.index9;
|
|
137
|
+
}
|
|
138
|
+
public set objectCollectionIndex(value : number) {
|
|
139
|
+
this.index9 = value;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns `PdfCrossTable` associated with the object.
|
|
143
|
+
* @private
|
|
144
|
+
*/
|
|
145
|
+
public get CrossTable() : PdfCrossTable {
|
|
146
|
+
return this.pdfCrossTable;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Gets the `elements` of the Pdf Array.
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
public get elements() : IPdfPrimitive[] {
|
|
153
|
+
return this.internalElements;
|
|
154
|
+
}
|
|
155
|
+
//constructor
|
|
156
|
+
/**
|
|
157
|
+
* Initializes a new instance of the `PdfArray` class.
|
|
158
|
+
* @private
|
|
159
|
+
*/
|
|
160
|
+
constructor()
|
|
161
|
+
/**
|
|
162
|
+
* Initializes a new instance of the `PdfArray` class.
|
|
163
|
+
* @private
|
|
164
|
+
*/
|
|
165
|
+
constructor(array : PdfArray|number[])
|
|
166
|
+
constructor(array? : PdfArray|number[]) {
|
|
167
|
+
if (typeof array === 'undefined') {
|
|
168
|
+
this.internalElements = [];
|
|
169
|
+
} else {
|
|
170
|
+
if (typeof array !== 'undefined' && !(array instanceof PdfArray)) {
|
|
171
|
+
let tempNumberArray : number[] = array;
|
|
172
|
+
for (let index : number = 0; index < tempNumberArray.length; index++) {
|
|
173
|
+
let pdfNumber : PdfNumber = new PdfNumber(tempNumberArray[index]);
|
|
174
|
+
this.add(pdfNumber);
|
|
175
|
+
}
|
|
176
|
+
// } else if (typeof array !== 'undefined' && (array instanceof PdfArray)) {
|
|
177
|
+
} else {
|
|
178
|
+
let tempArray : PdfArray = array as PdfArray;
|
|
179
|
+
// if (tempArray.Elements.length > 0) {
|
|
180
|
+
this.internalElements = [];
|
|
181
|
+
for (let index : number = 0; index < tempArray.elements.length; index++) {
|
|
182
|
+
this.internalElements.push(tempArray.elements[index]);
|
|
183
|
+
}
|
|
184
|
+
// }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* `Adds` the specified element to the PDF array.
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
192
|
+
public add(element : IPdfPrimitive) : void {
|
|
193
|
+
// if (element === null) {
|
|
194
|
+
// throw new Error('ArgumentNullException : obj');
|
|
195
|
+
// }
|
|
196
|
+
if (typeof this.internalElements === 'undefined') {
|
|
197
|
+
this.internalElements = [];
|
|
198
|
+
}
|
|
199
|
+
this.internalElements.push(element);
|
|
200
|
+
this.markedChange();
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* `Marks` the object changed.
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
private markedChange() : void {
|
|
207
|
+
this.bChanged = true;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* `Determines` whether the specified element is within the array.
|
|
211
|
+
* @private
|
|
212
|
+
*/
|
|
213
|
+
public contains(element : IPdfPrimitive) : boolean {
|
|
214
|
+
let returnValue : boolean = false;
|
|
215
|
+
for (let index : number = 0; index < this.internalElements.length; index++) {
|
|
216
|
+
let tempElement : PdfName = this.internalElements[index] as PdfName;
|
|
217
|
+
let inputElement : PdfName = element as PdfName;
|
|
218
|
+
if (tempElement != null && typeof tempElement !== 'undefined' && inputElement != null && typeof inputElement !== 'undefined') {
|
|
219
|
+
if (tempElement.value === inputElement.value) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// if (this.internalElements[index] === element) {
|
|
224
|
+
// returnValue = true;
|
|
225
|
+
// }
|
|
226
|
+
}
|
|
227
|
+
return returnValue;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Returns the `primitive object` of input index.
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
public getItems(index : number) : IPdfPrimitive {
|
|
234
|
+
// if (index < 0 || index >= this.Count) {
|
|
235
|
+
// throw new Error('ArgumentOutOfRangeException : index , The index can"t be less then zero or greater then Count.');
|
|
236
|
+
// }
|
|
237
|
+
return this.internalElements[index] as IPdfPrimitive;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* `Saves` the object using the specified writer.
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
public save(writer : IPdfWriter) : void {
|
|
244
|
+
// if (writer === null) {
|
|
245
|
+
// throw new Error('ArgumentNullException : writer');
|
|
246
|
+
// }
|
|
247
|
+
writer.write(this.startMark);
|
|
248
|
+
for (let i : number = 0, len : number = this.count; i < len; i++) {
|
|
249
|
+
this.getItems(i).save(writer);
|
|
250
|
+
if (i + 1 !== len) {
|
|
251
|
+
writer.write(Operators.whiteSpace);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
writer.write(this.endMark);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Creates a `copy of PdfArray`.
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
public clone(crossTable : PdfCrossTable) : IPdfPrimitive {
|
|
261
|
+
// if (this.clonedObject9 !== null && this.clonedObject9.CrossTable === crossTable) {
|
|
262
|
+
// return this.clonedObject9;
|
|
263
|
+
// } else {
|
|
264
|
+
this.clonedObject9 = null;
|
|
265
|
+
// Else clone the object.
|
|
266
|
+
let newArray : PdfArray = new PdfArray();
|
|
267
|
+
for (let index : number = 0; index < this.internalElements.length; index++) {
|
|
268
|
+
let obj : IPdfPrimitive = this.internalElements[index];
|
|
269
|
+
newArray.add(obj.clone(crossTable));
|
|
270
|
+
}
|
|
271
|
+
newArray.pdfCrossTable = crossTable;
|
|
272
|
+
this.clonedObject9 = newArray;
|
|
273
|
+
return newArray;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Creates filled PDF array `from the rectangle`.
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
public static fromRectangle(bounds : RectangleF) : PdfArray {
|
|
280
|
+
let values : number[] = [bounds.x, bounds.y, bounds.width, bounds.height];
|
|
281
|
+
let array : PdfArray = new PdfArray(values);
|
|
282
|
+
return array;
|
|
283
|
+
}
|
|
284
|
+
// /**
|
|
285
|
+
// * Creates the rectangle from filled PDF array.
|
|
286
|
+
// * @private
|
|
287
|
+
// */
|
|
288
|
+
// public ToRectangle() : RectangleF {
|
|
289
|
+
// if (this.Count < 4) {
|
|
290
|
+
// throw Error('InvalidOperationException-Can not convert to rectangle.');
|
|
291
|
+
// }
|
|
292
|
+
// let x1 : number;
|
|
293
|
+
// let x2 : number;
|
|
294
|
+
// let y1 : number;
|
|
295
|
+
// let y2 : number;
|
|
296
|
+
// let num : PdfNumber = this.getItems(0) as PdfNumber;
|
|
297
|
+
// x1 = num.IntValue;
|
|
298
|
+
// num = this.getItems(1) as PdfNumber;
|
|
299
|
+
// y1 = num.IntValue;
|
|
300
|
+
// num = this.getItems(2) as PdfNumber;
|
|
301
|
+
// x2 = num.IntValue;
|
|
302
|
+
// num = this.getItems(3) as PdfNumber;
|
|
303
|
+
// y2 = num.IntValue;
|
|
304
|
+
|
|
305
|
+
// let x : number = Math.min(x1, x2);
|
|
306
|
+
// let y : number = Math.min(y1, y2);
|
|
307
|
+
// let width : number = Math.abs(x1 - x2);
|
|
308
|
+
// let height : number = Math.abs(y1 - y2);
|
|
309
|
+
// let rect : RectangleF = new RectangleF(new PointF(x, y), new SizeF(width, height));
|
|
310
|
+
// return rect;
|
|
311
|
+
// }
|
|
312
|
+
/**
|
|
313
|
+
* `Inserts` the element into the array.
|
|
314
|
+
* @private
|
|
315
|
+
*/
|
|
316
|
+
public insert(index : number, element : IPdfPrimitive) : void {
|
|
317
|
+
if (index < this.internalElements.length && index > 0) {
|
|
318
|
+
let tempElements : IPdfPrimitive[] = [];
|
|
319
|
+
for (let i : number = 0; i < index ; i++) {
|
|
320
|
+
tempElements.push(this.internalElements[i]);
|
|
321
|
+
}
|
|
322
|
+
tempElements.push(element);
|
|
323
|
+
for (let i : number = index; i < this.internalElements.length ; i++) {
|
|
324
|
+
tempElements.push(this.internalElements[i]);
|
|
325
|
+
}
|
|
326
|
+
this.internalElements = tempElements;
|
|
327
|
+
} else {
|
|
328
|
+
this.internalElements.push(element);
|
|
329
|
+
}
|
|
330
|
+
this.markChanged();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* `Checks whether array contains the element`.
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
public indexOf(element : IPdfPrimitive) : number {
|
|
337
|
+
return this.internalElements.indexOf(element);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* `Removes` element from the array.
|
|
341
|
+
* @private
|
|
342
|
+
*/
|
|
343
|
+
public remove(element : IPdfPrimitive) : void {
|
|
344
|
+
// if (element === null) {
|
|
345
|
+
// throw new Error('ArgumentNullException : element');
|
|
346
|
+
// }
|
|
347
|
+
let index : number = this.internalElements.indexOf(element);
|
|
348
|
+
// if (index >= 0 && index < this.internalElements.length) {
|
|
349
|
+
this.internalElements[index] = null;
|
|
350
|
+
// }
|
|
351
|
+
this.markChanged();
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* `Remove` the element from the array by its index.
|
|
355
|
+
* @private
|
|
356
|
+
*/
|
|
357
|
+
public removeAt(index : number) : void {
|
|
358
|
+
// this.internalElements.RemoveAt(index);
|
|
359
|
+
if (this.internalElements.length > index) {
|
|
360
|
+
let tempArray : IPdfPrimitive[] = [];
|
|
361
|
+
for (let i : number = 0; i < index; i++) {
|
|
362
|
+
tempArray.push(this.internalElements[i]);
|
|
363
|
+
}
|
|
364
|
+
for (let i : number = index + 1; i < this.internalElements.length; i++) {
|
|
365
|
+
tempArray.push(this.internalElements[i]);
|
|
366
|
+
}
|
|
367
|
+
this.internalElements = tempArray;
|
|
368
|
+
}
|
|
369
|
+
this.markChanged();
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* `Clear` the array.
|
|
373
|
+
* @private
|
|
374
|
+
*/
|
|
375
|
+
public clear() : void {
|
|
376
|
+
this.internalElements = [];
|
|
377
|
+
this.markChanged();
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* `Marks` the object changed.
|
|
381
|
+
* @private
|
|
382
|
+
*/
|
|
383
|
+
public markChanged() : void {
|
|
384
|
+
this.bChanged = true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PdfBoolean.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
import { IPdfPrimitive } from './../../interfaces/i-pdf-primitives';
|
|
5
|
+
import { IPdfWriter } from './../../interfaces/i-pdf-writer';
|
|
6
|
+
import { ObjectStatus } from './../input-output/enum';
|
|
7
|
+
import { PdfCrossTable } from './../input-output/pdf-cross-table';
|
|
8
|
+
/**
|
|
9
|
+
* `PdfBoolean` class is used to perform boolean related primitive operations.
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export class PdfBoolean implements IPdfPrimitive {
|
|
13
|
+
/**
|
|
14
|
+
* Shows the type of object `status` whether it is object registered or other status;
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
private objectStatus : ObjectStatus;
|
|
18
|
+
/**
|
|
19
|
+
* Indicates if the object `is currently in saving state` or not.
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
private saving : boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Holds the `index` number of the object.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private index : number;
|
|
28
|
+
/**
|
|
29
|
+
* The `value` of the PDF boolean.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
public value : boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Internal variable to store the `position`.
|
|
35
|
+
* @default -1
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private currentPosition : number = -1;
|
|
39
|
+
//constructor
|
|
40
|
+
/**
|
|
41
|
+
* Initializes a new instance of the `PdfBoolean` class.
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
constructor(value : boolean) {
|
|
45
|
+
this.value = value;
|
|
46
|
+
}
|
|
47
|
+
//Properties
|
|
48
|
+
/**
|
|
49
|
+
* Gets or sets the `Status` of the specified object.
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
public get status() : ObjectStatus {
|
|
53
|
+
return this.objectStatus;
|
|
54
|
+
}
|
|
55
|
+
public set status(value : ObjectStatus) {
|
|
56
|
+
this.objectStatus = value;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Gets or sets a value indicating whether this document `is saving` or not.
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
public get isSaving() : boolean {
|
|
63
|
+
return this.saving;
|
|
64
|
+
}
|
|
65
|
+
public set isSaving(value : boolean) {
|
|
66
|
+
this.saving = value;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Gets or sets the `index` value of the specified object.
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
public get objectCollectionIndex() : number {
|
|
73
|
+
return this.index;
|
|
74
|
+
}
|
|
75
|
+
public set objectCollectionIndex(value : number) {
|
|
76
|
+
this.index = value;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets or sets the `position` of the object.
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
public get position() : number {
|
|
83
|
+
return this.currentPosition;
|
|
84
|
+
}
|
|
85
|
+
public set position(value : number) {
|
|
86
|
+
this.currentPosition = value;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns `cloned object`.
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
public get clonedObject() : IPdfPrimitive {
|
|
93
|
+
let rValue : IPdfPrimitive = null;
|
|
94
|
+
return rValue;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `Saves` the object using the specified writer.
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
public save(writer : IPdfWriter) : void {
|
|
101
|
+
writer.write(this.boolToStr(this.value));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Creates a `copy of PdfBoolean`.
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
public clone(crossTable : PdfCrossTable) : IPdfPrimitive {
|
|
108
|
+
let newNumber : PdfBoolean = new PdfBoolean(this.value);
|
|
109
|
+
return newNumber;
|
|
110
|
+
}
|
|
111
|
+
// Implementation
|
|
112
|
+
/**
|
|
113
|
+
* Converts `boolean to string` - 0/1 'true'/'false'.
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
private boolToStr(value : boolean) : string {
|
|
117
|
+
return value ? 'true' : 'false';
|
|
118
|
+
}
|
|
119
|
+
}
|