| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 | 1×
1×
1×
1×
10×
10×
10×
10×
10×
10×
10×
10×
1×
70×
1×
30×
1×
30×
1×
30×
10×
10×
10×
10×
30×
1×
50×
10×
10×
50×
1×
10×
10×
1×
10×
10×
1×
10×
10×
1×
1×
10×
10×
10×
10×
1×
20×
1×
1×
| define(["require", "exports", "./../../primitives/pdf-stream", "./../../input-output/pdf-dictionary-properties", "./../../primitives/pdf-array", "./../pdf-graphics", "./../pdf-resources", "./../../primitives/pdf-name", "./../../drawing/pdf-drawing", "./../pdf-graphics"], function (require, exports, pdf_stream_1, pdf_dictionary_properties_1, pdf_array_1, pdf_graphics_1, pdf_resources_1, pdf_name_1, pdf_drawing_1, pdf_graphics_2) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PdfTemplate = (function () {
function PdfTemplate(arg1, arg2) {
this.dictionaryProperties = new pdf_dictionary_properties_1.DictionaryProperties();
this.writeTransformation = true;
Iif (typeof arg1 === 'undefined') {
}
else Eif (arg1 instanceof pdf_drawing_1.SizeF && typeof arg2 === 'undefined') {
this.content = new pdf_stream_1.PdfStream();
var tempSize = new pdf_drawing_1.SizeF(arg1.width, arg1.height);
this.setSize(tempSize);
this.initialize();
}
else {
this.content = new pdf_stream_1.PdfStream();
this.setSize(new pdf_drawing_1.SizeF(arg1, arg2));
this.initialize();
}
}
Object.defineProperty(PdfTemplate.prototype, "size", {
get: function () {
return this.templateSize;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfTemplate.prototype, "width", {
get: function () {
return this.size.width;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfTemplate.prototype, "height", {
get: function () {
return this.size.height;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfTemplate.prototype, "graphics", {
get: function () {
if (this.pdfGraphics == null || typeof this.pdfGraphics === 'undefined') {
var gr = new pdf_graphics_2.GetResourceEventHandler(this);
var g = new pdf_graphics_1.PdfGraphics(this.size, gr, this.content);
this.pdfGraphics = g;
this.pdfGraphics.initializeCoordinates();
}
return this.pdfGraphics;
},
enumerable: true,
configurable: true
});
PdfTemplate.prototype.getResources = function () {
if (this.resources == null) {
this.resources = new pdf_resources_1.PdfResources();
this.content.items.setValue(this.dictionaryProperties.resources, this.resources);
}
return this.resources;
};
PdfTemplate.prototype.initialize = function () {
this.addType();
this.addSubType();
};
PdfTemplate.prototype.addType = function () {
var value = new pdf_name_1.PdfName(this.dictionaryProperties.xObject);
this.content.items.setValue(this.dictionaryProperties.type, value);
};
PdfTemplate.prototype.addSubType = function () {
var value = new pdf_name_1.PdfName(this.dictionaryProperties.form);
this.content.items.setValue(this.dictionaryProperties.subtype, value);
};
PdfTemplate.prototype.reset = function (size) {
if (typeof size === 'undefined') {
if (this.resources != null) {
this.resources = null;
this.content.remove(this.dictionaryProperties.resources);
}
if (this.graphics != null) {
this.graphics.reset(this.size);
}
}
else {
this.setSize(size);
this.reset();
}
};
PdfTemplate.prototype.setSize = function (size) {
var rect = new pdf_drawing_1.RectangleF(new pdf_drawing_1.PointF(0, 0), size);
var val = pdf_array_1.PdfArray.fromRectangle(rect);
this.content.items.setValue(this.dictionaryProperties.bBox, val);
this.templateSize = size;
};
Object.defineProperty(PdfTemplate.prototype, "element", {
get: function () {
return this.content;
},
enumerable: true,
configurable: true
});
return PdfTemplate;
}());
exports.PdfTemplate = PdfTemplate;
});
|