| 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 | 1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
| define(["require", "exports", "./../drawing/pdf-drawing", "./../primitives/pdf-array", "./../pages/enum", "./../general/enum", "./../primitives/pdf-reference", "./../primitives/pdf-name", "./../primitives/pdf-number", "./../input-output/pdf-dictionary-properties"], function (require, exports, pdf_drawing_1, pdf_array_1, enum_1, enum_2, pdf_reference_1, pdf_name_1, pdf_number_1, pdf_dictionary_properties_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PdfDestination = (function () {
function PdfDestination(arg1, arg2) {
this.dictionaryProperties = new pdf_dictionary_properties_1.DictionaryProperties();
this.destinationMode = enum_2.PdfDestinationMode.Location;
this.zoomFactor = 0;
this.destinationLocation = new pdf_drawing_1.PointF(0, 0);
this.bounds = new pdf_drawing_1.RectangleF();
this.array = new pdf_array_1.PdfArray();
var angle = enum_1.PdfPageRotateAngle.RotateAngle0;
this.destinationLocation = new pdf_drawing_1.PointF(0, this.destinationLocation.y);
this.pdfPage = arg1;
if (arg2 instanceof pdf_drawing_1.PointF) {
this.destinationLocation = arg2;
}
else {
this.bounds = arg2;
}
}
Object.defineProperty(PdfDestination.prototype, "zoom", {
get: function () {
return this.zoomFactor;
},
set: function (value) {
this.zoomFactor = value;
this.initializePrimitive();
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfDestination.prototype, "page", {
get: function () {
return this.pdfPage;
},
set: function (value) {
this.pdfPage = value;
this.initializePrimitive();
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfDestination.prototype, "mode", {
get: function () {
return this.destinationMode;
},
set: function (value) {
this.destinationMode = value;
this.initializePrimitive();
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfDestination.prototype, "location", {
get: function () {
return this.destinationLocation;
},
set: function (value) {
this.destinationLocation = value;
this.initializePrimitive();
},
enumerable: true,
configurable: true
});
PdfDestination.prototype.pointToNativePdf = function (page, point) {
var section = page.section;
return section.pointToNativePdf(page, point);
};
PdfDestination.prototype.initializePrimitive = function () {
this.array.clear();
this.array.add(new pdf_reference_1.PdfReferenceHolder(this.pdfPage));
switch (this.destinationMode) {
case enum_2.PdfDestinationMode.Location:
var simplePage = this.pdfPage;
var point = new pdf_drawing_1.PointF();
point = this.pointToNativePdf(simplePage, this.destinationLocation);
this.array.add(new pdf_name_1.PdfName(this.dictionaryProperties.xyz));
this.array.add(new pdf_number_1.PdfNumber(point.x));
this.array.add(new pdf_number_1.PdfNumber(point.y));
this.array.add(new pdf_number_1.PdfNumber(this.zoomFactor));
break;
case enum_2.PdfDestinationMode.FitToPage:
this.array.add(new pdf_name_1.PdfName(this.dictionaryProperties.fit));
break;
}
};
Object.defineProperty(PdfDestination.prototype, "element", {
get: function () {
this.initializePrimitive();
return this.array;
},
enumerable: true,
configurable: true
});
return PdfDestination;
}());
exports.PdfDestination = PdfDestination;
});
|