all files / document/automatic-fields/ page-count-field.js

87.5% Statements 35/40
76.47% Branches 13/17
100% Functions 12/12
86.49% Lines 32/37
4 statements, 2 functions, 6 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 55 56 57 58    53× 53× 53×                             20×             20× 20× 20× 20× 20× 20×        
/* 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", "./single-value-field", "./../../pages/enum", "./../../graphics/brushes/pdf-brush", "./pdf-numbers-convertor"], function (require, exports, single_value_field_1, enum_1, pdf_brush_1, pdf_numbers_convertor_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfPageCountField = (function (_super) {
        __extends(PdfPageCountField, _super);
        function PdfPageCountField(font, arg2) {
            var _this = _super.call(this) || this;
            _this.internalNumberStyle = enum_1.PdfNumberStyle.Numeric;
            Eif (typeof arg2 === 'undefined') {
                _this.font = font;
            }
            else if (arg2 instanceof pdf_brush_1.PdfBrush) {
                _this.font = font;
                _this.brush = arg2;
            }
            else {
                _this.font = font;
                _this.bounds = arg2;
            }
            return _this;
        }
        Object.defineProperty(PdfPageCountField.prototype, "numberStyle", {
            get: function () {
                return this.internalNumberStyle;
            },
            set: function (value) {
                this.internalNumberStyle = value;
            },
            enumerable: true,
            configurable: true
        });
        PdfPageCountField.prototype.getValue = function (graphics) {
            var result = null;
            var page = this.getPageFromGraphics(graphics);
            var document = page.section.parent.document;
            var count = document.pages.count;
            result = pdf_numbers_convertor_1.PdfNumbersConvertor.convert(count, this.numberStyle);
            return result;
        };
        return PdfPageCountField;
    }(single_value_field_1.PdfSingleValueField));
    exports.PdfPageCountField = PdfPageCountField;
});