dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (file) {
                var _this = this;
                return new Promise(function (resolve, reject) {
                    return __awaiter(_this, void 0, void 0, function () {
                        var imageSrc, err_3, img;
                        var _this = this;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    _a.trys.push([0, 2, , 3]);
                                    return [4 /*yield*/, readFile()];
                                case 1:
                                    imageSrc = _a.sent();
                                    return [3 /*break*/, 3];
                                case 2:
                                    err_3 = _a.sent();
                                    reject(err_3);
                                    return [3 /*break*/, 3];
                                case 3:
                                    img = new Image();
                                    img.onload = function () {
                                        return __awaiter(_this, void 0, void 0, function () {
                                            var ctx, width, _a;
                                            return __generator(this, function (_b) {
                                                switch (_b.label) {
                                                    case 0:
                                                        // set edited image canvas and dimensions
                                                        this.editedImage = ( /** @type {?} */(document.createElement('canvas')));
                                                        this.editedImage.width = img.width;
                                                        this.editedImage.height = img.height;
                                                        ctx = this.editedImage.getContext('2d');
                                                        ctx.drawImage(img, 0, 0);
                                                        // resize image if larger than max image size
                                                        width = img.width > img.height ? img.height : img.width;
                                                        if (!(width > this.options.maxImageDimensions.width))
                                                            return [3 /*break*/, 2];
                                                        _a = this;
                                                        return [4 /*yield*/, this.resize(this.editedImage)];
                                                    case 1:
                                                        _a.editedImage = _b.sent();
                                                        _b.label = 2;
                                                    case 2:
                                                        this.imageDimensions.width = this.editedImage.width;
                                                        this.imageDimensions.height = this.editedImage.height;
                                                        this.setPreviewPaneDimensions(this.editedImage);
                                                        resolve();
                                                        return [2 /*return*/];
                                                }
                                            });
                                        });
                                    };
                                    img.src = imageSrc;
                                    return [2 /*return*/];
                            }
                        });
                    });
                });
                /**
                 * read file from input field
                 * @return {?}
                 */
                function readFile() {
                    return new Promise(function (resolve, reject) {
                        /** @type {?} */
                        var reader = new FileReader();
                        reader.onload = function (event) {
                            resolve(reader.result);
                        };
                        reader.onerror = function (err) {
                            reject(err);
                        };
                        reader.readAsDataURL(file);
                    });
                }
            }
function (file) {
                var _this = this;
                return new Promise(function (resolve, reject) {
                    return __awaiter(_this, void 0, void 0, function () {
                        var imageSrc, err_3, img;
                        var _this = this;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    _a.trys.push([0, 2, , 3]);
                                    return [4 /*yield*/, readFile()];
                                case 1:
                                    imageSrc = _a.sent();
                                    return [3 /*break*/, 3];
                                case 2:
                                    err_3 = _a.sent();
                                    reject(err_3);
                                    return [3 /*break*/, 3];
                                case 3:
                                    img = new Image();
                                    img.onload = function () {
                                        return __awaiter(_this, void 0, void 0, function () {
                                            var ctx, width, _a;
                                            return __generator(this, function (_b) {
                                                switch (_b.label) {
                                                    case 0:
                                                        // set edited image canvas and dimensions
                                                        this.editedImage = ( /** @type {?} */(document.createElement('canvas')));
                                                        this.editedImage.width = img.width;
                                                        this.editedImage.height = img.height;
                                                        ctx = this.editedImage.getContext('2d');
                                                        ctx.drawImage(img, 0, 0);
                                                        // resize image if larger than max image size
                                                        width = img.width > img.height ? img.height : img.width;
                                                        if (!(width > this.options.maxImageDimensions.width))
                                                            return [3 /*break*/, 2];
                                                        _a = this;
                                                        return [4 /*yield*/, this.resize(this.editedImage)];
                                                    case 1:
                                                        _a.editedImage = _b.sent();
                                                        _b.label = 2;
                                                    case 2:
                                                        this.imageDimensions.width = this.editedImage.width;
                                                        this.imageDimensions.height = this.editedImage.height;
                                                        this.setPreviewPaneDimensions(this.editedImage);
                                                        resolve();
                                                        return [2 /*return*/];
                                                }
                                            });
                                        });
                                    };
                                    img.src = imageSrc;
                                    return [2 /*return*/];
                            }
                        });
                    });
                });
                /**
                 * read file from input field
                 * @return {?}
                 */
                function readFile() {
                    return new Promise(function (resolve, reject) {
                        /** @type {?} */
                        var reader = new FileReader();
                        reader.onload = function (event) {
                            resolve(reader.result);
                        };
                        reader.onerror = function (err) {
                            reject(err);
                        };
                        reader.readAsDataURL(file);
                    });
                }
            }
function ( file ) { var _this = this ; return new Promise ( function ( resolve , reject ) { return __awaiter ( _this , void 0 , void 0 , function ( ) { var imageSrc , err_3 , img ; var _this = this ; return __generator ( this , function ( _a ) { switch ( _a . label ) { case 0 : _a . trys . push ( [ 0 , 2 , , 3 ] ) ; return [ 4 /*yield*/ , readFile ( ) ] ; case 1 : imageSrc = _a . sent ( ) ; return [ 3 /*break*/ , 3 ] ; case 2 : err_3 = _a . sent ( ) ; reject ( err_3 ) ; return [ 3 /*break*/ , 3 ] ; case 3 : img = new Image ( ) ; img . onload = function ( ) { return __awaiter ( _this , void 0 , void 0 , function ( ) { var ctx , width , _a ; return __generator ( this , function ( _b ) { switch ( _b . label ) { case 0 : // set edited image canvas and dimensions this . editedImage = ( /** @type {?} */ ( document . createElement ( 'canvas' ) ) ) ; this . editedImage . width = img . width ; this . editedImage . height = img . height ; ctx = this . editedImage . getContext ( '2d' ) ; ctx . drawImage ( img , 0 , 0 ) ; // resize image if larger than max image size width = img . width > img . height ? img . height : img . width ; if ( ! ( width > this . options . maxImageDimensions . width ) ) return [ 3 /*break*/ , 2 ] ; _a = this ; return [ 4 /*yield*/ , this . resize ( this . editedImage ) ] ; case 1 : _a . editedImage = _b . sent ( ) ; _b . label = 2 ; case 2 : this . imageDimensions . width = this . editedImage . width ; this . imageDimensions . height = this . editedImage . height ; this . setPreviewPaneDimensions ( this . editedImage ) ; resolve ( ) ; return [ 2 /*return*/ ] ; } } ) ; } ) ; } ; img . src = imageSrc ; return [ 2 /*return*/ ] ; } } ) ; } ) ; } ) ; /**
                 * read file from input field
                 * @return {?}
                 */ function readFile ( ) { return new Promise ( function ( resolve , reject ) { /** @type {?} */ var reader = new FileReader ( ) ; reader . onload = function ( event ) { resolve ( reader . result ) ; } ; reader . onerror = function ( err ) { reject ( err ) ; } ; reader . readAsDataURL ( file ) ; } ) ; } }
read image from File object
@private
@param {?} file
@return {?}
read image from File object