all files / document/ pdf-catalog.js

85.71% Statements 30/35
76.47% Branches 13/17
83.33% Functions 10/12
84.38% Lines 27/32
11 statements, 6 functions, 9 branches Ignored     
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                                                     
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
define(["require", "exports", "./../primitives/pdf-dictionary", "./../input-output/pdf-dictionary-properties", "./../primitives/pdf-name", "./../primitives/pdf-reference", "./pdf-viewer-preferences"], function (require, exports, pdf_dictionary_1, pdf_dictionary_properties_1, pdf_name_1, pdf_reference_1, pdf_viewer_preferences_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfCatalog = (function (_super) {
        __extends(PdfCatalog, _super);
        function PdfCatalog() {
            var _this = _super.call(this) || this;
            _this.sections = null;
            _this.tempDictionaryProperties = new pdf_dictionary_properties_1.DictionaryProperties();
            _this.items.setValue(new pdf_dictionary_properties_1.DictionaryProperties().type, new pdf_name_1.PdfName('Catalog'));
            return _this;
        }
        Object.defineProperty(PdfCatalog.prototype, "pages", {
            get: function () {
                return this.sections;
            },
            set: function (value) {
                var dictionary = value.element;
                this.sections = value;
                this.items.setValue(this.tempDictionaryProperties.pages, new pdf_reference_1.PdfReferenceHolder(value));
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfCatalog.prototype, "viewerPreferences", {
            get: function () {
                if (this._viewerPreferences === null || typeof this._viewerPreferences === 'undefined') {
                    this._viewerPreferences = new pdf_viewer_preferences_1.PdfViewerPreferences(this);
                    this.items.setValue(this.tempDictionaryProperties.viewerPreferences, new pdf_reference_1.PdfReferenceHolder(this._viewerPreferences.element));
                }
                return this._viewerPreferences;
            },
            enumerable: true,
            configurable: true
        });
        return PdfCatalog;
    }(pdf_dictionary_1.PdfDictionary));
    exports.PdfCatalog = PdfCatalog;
});