| 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 | 1×
1×
1×
1×
4×
4×
4×
4×
1×
196×
1×
2377×
1×
930×
1×
12×
1×
4×
4×
4×
4×
4×
4×
4×
4×
4×
1×
460×
460×
1×
4×
4×
1×
8×
4×
4×
4×
4×
4×
4×
4×
4×
1×
4×
4×
4×
1×
4×
4×
4×
1×
4×
1×
1×
1×
| define(["require", "exports", "./../primitives/pdf-number", "./../primitives/pdf-name", "./../primitives/pdf-array", "./../primitives/pdf-dictionary", "./../primitives/pdf-reference", "./../drawing/pdf-drawing", "./pdf-section", "./../input-output/pdf-dictionary-properties"], function (require, exports, pdf_number_1, pdf_name_1, pdf_array_1, pdf_dictionary_1, pdf_reference_1, pdf_drawing_1, pdf_section_1, pdf_dictionary_properties_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PdfSectionCollection = (function () {
function PdfSectionCollection(document) {
this.sections = [];
this.dictionaryProperties = new pdf_dictionary_properties_1.DictionaryProperties();
this.pdfDocument = document.clone();
this.initialize();
}
Object.defineProperty(PdfSectionCollection.prototype, "section", {
get: function () {
return this.sections;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfSectionCollection.prototype, "document", {
get: function () {
return this.pdfDocument;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfSectionCollection.prototype, "count", {
get: function () {
return this.sections.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PdfSectionCollection.prototype, "element", {
get: function () {
return this.pages;
},
enumerable: true,
configurable: true
});
PdfSectionCollection.prototype.initialize = function () {
this.sectionCount = new pdf_number_1.PdfNumber(0);
this.sectionCollection = new pdf_array_1.PdfArray();
this.pages = new pdf_dictionary_1.PdfDictionary();
this.pages.beginSave = new pdf_dictionary_1.SaveSectionCollectionEventHandler(this);
this.pages.items.setValue(this.dictionaryProperties.type, new pdf_name_1.PdfName('Pages'));
this.pages.items.setValue(this.dictionaryProperties.kids, this.sectionCollection);
this.pages.items.setValue(this.dictionaryProperties.count, this.sectionCount);
this.pages.items.setValue(this.dictionaryProperties.resources, new pdf_dictionary_1.PdfDictionary());
this.setPageSettings(this.pages, this.pdfDocument.pageSettings);
};
PdfSectionCollection.prototype.pdfSectionCollection = function (index) {
Iif (index < 0 || index >= this.count) {
throw new Error('IndexOutOfRangeException()');
}
return this.sections[index];
};
PdfSectionCollection.prototype.setPageSettings = function (container, pageSettings) {
var bounds = new pdf_drawing_1.RectangleF(new pdf_drawing_1.PointF(), pageSettings.size);
container.items.setValue(this.dictionaryProperties.mediaBox, pdf_array_1.PdfArray.fromRectangle(bounds));
};
PdfSectionCollection.prototype.add = function (section) {
if (typeof section === 'undefined') {
var section_1 = new pdf_section_1.PdfSection(this.pdfDocument);
this.add(section_1);
return section_1;
}
else {
var r = this.checkSection(section);
this.sections.push(section);
section.parent = this;
this.sectionCollection.add(r);
return this.sections.indexOf(section);
}
};
PdfSectionCollection.prototype.checkSection = function (section) {
var r = new pdf_reference_1.PdfReferenceHolder(section);
var contains = this.sectionCollection.contains(r);
return r;
};
PdfSectionCollection.prototype.countPages = function () {
var count = 0;
this.sections.forEach(function (n) { return (count += n.count); });
return count;
};
PdfSectionCollection.prototype.beginSave = function () {
this.sectionCount.intValue = this.countPages();
};
PdfSectionCollection.rotateFactor = 90;
return PdfSectionCollection;
}());
exports.PdfSectionCollection = PdfSectionCollection;
});
|