all files / document/ pdf-document-base.js

86.05% Statements 37/43
50% Branches 2/4
76.47% Functions 13/17
86.05% Lines 37/43
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           1310×           141×                 96×                                                                  
define(["require", "exports", "@syncfusion/ej2-file-utils", "./pdf-document"], function (require, exports, ej2_file_utils_1, pdf_document_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var PdfDocumentBase = (function () {
        function PdfDocumentBase(document) {
            this.isStreamCopied = false;
            Iif (document instanceof pdf_document_1.PdfDocument) {
                this.document = document;
            }
        }
        Object.defineProperty(PdfDocumentBase.prototype, "pdfObjects", {
            get: function () {
                return this.objects;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfDocumentBase.prototype, "crossTable", {
            get: function () {
                return this.pdfCrossTable;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfDocumentBase.prototype, "currentSavingObj", {
            get: function () {
                return this.currentSavingObject;
            },
            set: function (value) {
                this.currentSavingObject = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfDocumentBase.prototype, "catalog", {
            get: function () {
                return this.pdfCatalog;
            },
            set: function (value) {
                this.pdfCatalog = value;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(PdfDocumentBase.prototype, "viewerPreferences", {
            get: function () {
                return this.pdfCatalog.viewerPreferences;
            },
            enumerable: true,
            configurable: true
        });
        PdfDocumentBase.prototype.setMainObjectCollection = function (mainObjectCollection) {
            this.objects = mainObjectCollection;
        };
        PdfDocumentBase.prototype.setCrossTable = function (cTable) {
            this.pdfCrossTable = cTable;
        };
        PdfDocumentBase.prototype.setCatalog = function (catalog) {
            this.pdfCatalog = catalog;
        };
        PdfDocumentBase.prototype.save = function (filename) {
            var _this = this;
            var encoding = new ej2_file_utils_1.Encoding(true);
            var SW = new ej2_file_utils_1.StreamWriter(encoding);
            Eif (typeof filename === 'undefined') {
                var encoding_1 = new ej2_file_utils_1.Encoding(true);
                var SW_1 = new ej2_file_utils_1.StreamWriter(encoding_1);
                return new Promise(function (resolve, reject) {
                    var obj = {};
                    obj.blobData = new Blob([_this.document.docSave(SW_1, true)], { type: 'application/pdf' });
                    resolve(obj);
                });
            }
            else {
                this.document.docSave(SW, filename, true);
            }
        };
        PdfDocumentBase.prototype.clone = function () {
            return this.document;
        };
        PdfDocumentBase.prototype._save = function () {
            return this.document._docSave();
        };
        return PdfDocumentBase;
    }());
    exports.PdfDocumentBase = PdfDocumentBase;
});