@syncfusion/ej2-pdf-export 19.4.52 → 20.2.36
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.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 +6 -6
- package/CHANGELOG.md +0 -81
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PdfUnitConverter.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
import { PdfGraphicsUnit } from './../graphics/enum';
|
|
5
|
+
/**
|
|
6
|
+
* Used to perform `convertion between pixels and points`.
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export class PdfUnitConverter {
|
|
10
|
+
//Fields
|
|
11
|
+
/**
|
|
12
|
+
* Indicates default `horizontal resolution`.
|
|
13
|
+
* @default 96
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
public static readonly horizontalResolution : number = 96;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates default `vertical resolution`.
|
|
19
|
+
* @default 96
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
public static readonly verticalResolution: number = 96;
|
|
23
|
+
/**
|
|
24
|
+
* `Width, in millimeters`, of the physical screen.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
public static readonly horizontalSize: number;
|
|
28
|
+
/**
|
|
29
|
+
* `Height, in millimeters`, of the physical screen.
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
public static readonly verticalSize: number;
|
|
33
|
+
/**
|
|
34
|
+
* `Width, in pixels`, of the screen.
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
public static readonly pxHorizontalResolution: number;
|
|
38
|
+
/**
|
|
39
|
+
* `Height, in pixels`, of the screen.
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
public static readonly pxVerticalResolution: number;
|
|
43
|
+
/**
|
|
44
|
+
* `Matrix` for conversations between different numeric systems.
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
private proportions : number[];
|
|
48
|
+
//constructors
|
|
49
|
+
/**
|
|
50
|
+
* Initializes a new instance of the `UnitConvertor` class with DPI value.
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
public constructor( dpi : number) {
|
|
54
|
+
this.updateProportionsHelper(dpi);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `Converts` the value, from one graphics unit to another graphics unit.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
public convertUnits(value : number, from : PdfGraphicsUnit, to : PdfGraphicsUnit) : number {
|
|
61
|
+
return this.convertFromPixels(this.convertToPixels(value, from), to);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts the value `to pixel` from specified graphics unit.
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
public convertToPixels(value : number, from : PdfGraphicsUnit) : number {
|
|
68
|
+
let index : number = (from as number);
|
|
69
|
+
let result : number = (value * this.proportions[index]) as number;
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Converts value, to specified graphics unit `from Pixel`.
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
public convertFromPixels(value : number, to : PdfGraphicsUnit) : number {
|
|
77
|
+
let index : number = to as number;
|
|
78
|
+
let result : number = (value / this.proportions[index]) as number;
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* `Update proportions` matrix according to Graphics settings.
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
private updateProportionsHelper(pixelPerInch : number) : void {
|
|
86
|
+
this.proportions = [
|
|
87
|
+
pixelPerInch / 2.54, // Centimeter
|
|
88
|
+
pixelPerInch / 6.0, // Pica
|
|
89
|
+
1, // Pixel
|
|
90
|
+
pixelPerInch / 72.0, // Point
|
|
91
|
+
pixelPerInch, // Inch
|
|
92
|
+
pixelPerInch / 300.0, // Document
|
|
93
|
+
pixelPerInch / 25.4 // Millimeter
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes data in BigEndian order.
|
|
3
|
+
*/
|
|
4
|
+
export class BigEndianWriter {
|
|
5
|
+
//Constants
|
|
6
|
+
/**
|
|
7
|
+
* Size of Int32 type.
|
|
8
|
+
*/
|
|
9
|
+
public readonly int32Size : number = 4;
|
|
10
|
+
/**
|
|
11
|
+
* Size of Int16 type.
|
|
12
|
+
*/
|
|
13
|
+
public readonly int16Size : number = 2;
|
|
14
|
+
/**
|
|
15
|
+
* Size of long type.
|
|
16
|
+
*/
|
|
17
|
+
public readonly int64Size : number = 8;
|
|
18
|
+
//Fields
|
|
19
|
+
/**
|
|
20
|
+
* Internal buffer.
|
|
21
|
+
*/
|
|
22
|
+
private buffer : number[];
|
|
23
|
+
/**
|
|
24
|
+
* Internal buffer capacity.
|
|
25
|
+
*/
|
|
26
|
+
private bufferLength : number;
|
|
27
|
+
/**
|
|
28
|
+
* Current position.
|
|
29
|
+
*/
|
|
30
|
+
private internalPosition : number;
|
|
31
|
+
//Properties
|
|
32
|
+
/**
|
|
33
|
+
* Gets data written to the writer.
|
|
34
|
+
*/
|
|
35
|
+
public get data() : number[] {
|
|
36
|
+
if (this.buffer.length < this.bufferLength) {
|
|
37
|
+
let length : number = this.bufferLength - this.buffer.length;
|
|
38
|
+
for (let i : number = 0; i < length; i++) {
|
|
39
|
+
this.buffer.push(0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return this.buffer;
|
|
43
|
+
}
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// Gets position of the internal buffer.
|
|
46
|
+
/// </summary>
|
|
47
|
+
public get position() : number {
|
|
48
|
+
if (this.internalPosition === undefined || this.internalPosition === null) {
|
|
49
|
+
this.internalPosition = 0;
|
|
50
|
+
}
|
|
51
|
+
return this.internalPosition;
|
|
52
|
+
}
|
|
53
|
+
//Constructors
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new writer.
|
|
56
|
+
*/
|
|
57
|
+
public constructor(capacity : number) {
|
|
58
|
+
this.bufferLength = capacity;
|
|
59
|
+
this.buffer = [];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Writes short value.
|
|
63
|
+
*/
|
|
64
|
+
public writeShort(value : number) : void {
|
|
65
|
+
let bytes : number[] = [((value & 0x0000ff00) >> 8), value & 0x000000ff];
|
|
66
|
+
this.flush(bytes);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Writes int value.
|
|
70
|
+
*/
|
|
71
|
+
public writeInt(value : number) : void {
|
|
72
|
+
let i1 : number = (value & 0xff000000) >> 24;
|
|
73
|
+
i1 = i1 < 0 ? 256 + i1 : i1;
|
|
74
|
+
let i2 : number = (value & 0x00ff0000) >> 16;
|
|
75
|
+
i2 = i2 < 0 ? 256 + i2 : i2;
|
|
76
|
+
let i3 : number = (value & 0x0000ff00) >> 8;
|
|
77
|
+
i3 = i3 < 0 ? 256 + i3 : i3;
|
|
78
|
+
let i4 : number = value & 0x000000ff;
|
|
79
|
+
i4 = i4 < 0 ? 256 + i4 : i4;
|
|
80
|
+
let bytes : number[] = [(value & 0xff000000) >> 24, (value & 0x00ff0000) >> 16, (value & 0x0000ff00) >> 8, value & 0x000000ff ];
|
|
81
|
+
this.flush(bytes);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Writes u int value.
|
|
85
|
+
*/
|
|
86
|
+
public writeUInt(value : number) : void {
|
|
87
|
+
let buff : number[] = [(value & 0xff000000) >> 24, (value & 0x00ff0000) >> 16, (value & 0x0000ff00) >> 8, value & 0x000000ff ];
|
|
88
|
+
this.flush(buff);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Writes string value.
|
|
92
|
+
*/
|
|
93
|
+
public writeString(value : string) : void {
|
|
94
|
+
if (value == null) {
|
|
95
|
+
throw new Error('Argument Null Exception : value');
|
|
96
|
+
}
|
|
97
|
+
let bytes : number[] = [];
|
|
98
|
+
for (let i : number = 0; i < value.length; i++) {
|
|
99
|
+
bytes.push(value.charCodeAt(i));
|
|
100
|
+
}
|
|
101
|
+
this.flush(bytes);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Writes byte[] value.
|
|
105
|
+
*/
|
|
106
|
+
public writeBytes(value : number[]) : void {
|
|
107
|
+
this.flush(value);
|
|
108
|
+
}
|
|
109
|
+
// //Implementation
|
|
110
|
+
private flush(buff : number[]) : void {
|
|
111
|
+
if (buff === null) {
|
|
112
|
+
throw new Error('Argument Null Exception : buff');
|
|
113
|
+
}
|
|
114
|
+
let position : number = this.position;
|
|
115
|
+
for (let i : number = 0; i < buff.length; i++) {
|
|
116
|
+
this.buffer[position] = buff[i];
|
|
117
|
+
position++;
|
|
118
|
+
}
|
|
119
|
+
this.internalPosition += buff.length;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* public Enum for `ObjectType`.
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
export enum ObjectType {
|
|
6
|
+
/**
|
|
7
|
+
* Specifies the type of `Free`.
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
Free = 0,
|
|
11
|
+
/**
|
|
12
|
+
* Specifies the type of `Normal`.
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
Normal = 1,
|
|
16
|
+
/**
|
|
17
|
+
* Specifies the type of `Packed`.
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
Packed = 2
|
|
21
|
+
}
|