all files / core/annotations/ pdf-appearance.js

88.46% Statements 23/26
46.15% Branches 6/13
100% Functions 6/6
88.46% Lines 23/26
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                                                  
define(["require", "exports", "./../pdf-primitives", "./../graphics/pdf-template", "./annotation", "../utils"], function (require, exports, pdf_primitives_1, pdf_template_1, annotation_1, utils_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfAppearance = (function () {
        function PdfAppearance(bounds, annot) {
            this._isNormalKey = true;
            this._dictionary = new pdf_primitives_1._PdfDictionary();
            Eif (utils_1._isNullOrUndefined(bounds)) {
                this._bounds = bounds;
            }
            else {
                this._bounds = { x: 0, y: 0, width: 0, height: 0 };
            }
            Eif (annot instanceof annotation_1.PdfAnnotation) {
                this._annotations = annot;
                this._crossReference = annot._crossReference;
            }
            else {
                this._isNormalKey = false;
            }
            this._initialize();
        }
        Object.defineProperty(PdfAppearance.prototype, "normal", {
            get: function () {
                Iif (!this._templateNormal && this._dictionary && this._dictionary.has('AP')) {
                    this._templateNormal = this._dictionary.get('N');
                }
                return this._templateNormal;
            },
            set: function (value) {
                Eif (value) {
                    this._templateNormal = value;
                    Eif (this._isNormalKey) {
                        this._dictionary.set('N', this._templateNormal);
                    }
                }
            },
            enumerable: true,
            configurable: true
        });
        PdfAppearance.prototype._initialize = function () {
            this.normal = new pdf_template_1.PdfTemplate(this._bounds, this._crossReference);
        };
        return PdfAppearance;
    }());
    exports.PdfAppearance = PdfAppearance;
});