all files / primitives/ pdf-name.js

67.92% Statements 36/53
0% Branches 0/4
42.11% Functions 8/19
67.92% Lines 36/53
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 101 102 103 104 105 106 107   2002× 2002× 2002× 2002× 2002×                                                                                         4496×                             611×   667×           667× 667× 667× 5913× 5913× 5913×   667×   2002× 2002×        
define(["require", "exports"], function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfName = (function () {
        function PdfName(value) {
            this.stringStartMark = '/';
            this.internalValue = '';
            this.isSaving6 = false;
            this.position6 = -1;
            this.internalValue = this.normalizeValue(value);
        }
        Object.defineProperty(PdfName.prototype, "status", {
            get: function () {
                return this.status6;
            },
            set: function (value) {
                this.status6 = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfName.prototype, "isSaving", {
            get: function () {
                return this.isSaving6;
            },
            set: function (value) {
                this.isSaving6 = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfName.prototype, "objectCollectionIndex", {
            get: function () {
                return this.index6;
            },
            set: function (value) {
                this.index6 = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfName.prototype, "position", {
            get: function () {
                return this.position6;
            },
            set: function (value) {
                this.position6 = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfName.prototype, "clonedObject", {
            get: function () {
                return null;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfName.prototype, "value", {
            get: function () {
                return this.internalValue;
            },
            set: function (value) {
                var val = value;
                if (value !== null && value.length > 0) {
                    val = value;
                    this.internalValue = this.normalizeValue(val);
                }
                else {
                    this.internalValue = val;
                }
            },
            enumerable: true,
            configurable: true
        });
        PdfName.prototype.save = function (writer) {
            writer.write(this.toString());
        };
        PdfName.prototype.toString = function () {
            return (this.stringStartMark + this.escapeString(this.value));
        };
        PdfName.prototype.clone = function (crossTable) {
            var newName = new PdfName();
            newName.value = this.internalValue;
            return newName;
        };
        PdfName.prototype.escapeString = function (stringValue) {
            var result = '';
            var len = 0;
            for (var i = 0, len_1 = stringValue.length; i < len_1; i++) {
                var ch = stringValue[i];
                var index = PdfName.delimiters.indexOf(ch);
                result = result + ch;
            }
            return result;
        };
        PdfName.prototype.normalizeValue = function (value, c) {
            var strFormat = '#{0:X}';
            return value;
        };
        PdfName.delimiters = '()<>[]{}/%}';
        PdfName.replacements = [' ', '\t', '\n', '\r'];
        return PdfName;
    }());
    exports.PdfName = PdfName;
});