diff --git a/CHANGELOG.md b/CHANGELOG.md
index b56724a..4ee3269 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+
+## 1.6.3 (2017-05-22)
+
+
+
+
## 1.6.2 (2017-05-22)
diff --git a/bower.json b/bower.json
index c4fa98e..a8a571d 100644
--- a/bower.json
+++ b/bower.json
@@ -2,7 +2,7 @@
"name": "angular-pdf",
"description": "An Angularjs directive to display PDF in the browser with PDFJS.",
"homepage": "http://github.com/sayanee/angularjs-pdf",
- "version": "1.6.2",
+ "version": "1.6.3",
"main": "./dist/angular-pdf.js",
"dependencies": {
"angular": "^1.6.2",
diff --git a/dist/angular-pdf.js b/dist/angular-pdf.js
index e74b9ad..833882a 100644
--- a/dist/angular-pdf.js
+++ b/dist/angular-pdf.js
@@ -1,6 +1,6 @@
/*!
* Angular-PDF: An Angularjs directive to display PDF in the browser with PDFJS.
- * @version 1.6.2
+ * @version 1.6.3
* @link https://github.com/sayanee/angular-pdf#readme
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
diff --git a/dist/angular-pdf.min.js b/dist/angular-pdf.min.js
index ccca39e..027dfce 100644
--- a/dist/angular-pdf.min.js
+++ b/dist/angular-pdf.min.js
@@ -1,6 +1,6 @@
/*!
* Angular-PDF: An Angularjs directive to display PDF in the browser with PDFJS.
- * @version 1.6.2
+ * @version 1.6.3
* @link https://github.com/sayanee/angular-pdf#readme
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
diff --git a/dist/angular-pdf.min.js.map b/dist/angular-pdf.min.js.map
index 30d8cbe..d48c950 100644
--- a/dist/angular-pdf.min.js.map
+++ b/dist/angular-pdf.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///angular-pdf.min.js","webpack:///webpack/bootstrap a4257fd975d7127336b8","webpack:///./src/angular-pdf.directive.js","webpack:///./src/angular-pdf.module.js","webpack:///external \"angular\""],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_0__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","./src/angular-pdf.directive.js","NgPdf","$window","$document","$log","backingScale","canvas","ctx","getContext","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","setCanvasDimensions","w","h","ratio","width","Math","floor","height","style","setTransform","restrict","templateUrl","element","attr","link","scope","attrs","clearCanvas","clearRect","renderPDF","params","url","withCredentials","creds","httpHeaders","length","pdfLoaderTask","PDFJS","getDocument","onProgress","onPassword","then","_pdfDoc","angular","isFunction","onLoad","pdfDoc","renderPage","pageToDisplay","$apply","pageCount","numPages","error","onError","renderTask","debug","pdfUrl","isFinite","page","parseInt","pageFit","scale","canvasid","getElementById","usecredentials","windowEl","css","on","scroll","scrollY","disableWorker","pageNum","num","_internalRenderTask","cancel","getPage","viewport","pageWidthScale","renderContext","getViewport","getBoundingClientRect","canvasContext","render","promise","onPageRender","catch","reason","log","goPrevious","goNext","zoomIn","parseFloat","zoomOut","fit","changePage","rotate","getAttribute","setAttribute","$watch","newVal","destroy","./src/angular-pdf.module.js","Pdf","undefined","_angular","_angular2","obj","default","_angularPdf","directive","0"],"mappings":";;;;;;CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,YACA,kBAAAC,gBAAAC,IACAD,OAAA,kBAAAJ,GACA,gBAAAC,SACAA,QAAA,IAAAD,EAAAG,QAAA,YAEAJ,EAAA,IAAAC,EAAAD,EAAA,UACCO,KAAA,SAAAC,GACD,MCMgB,UAAUC,GCZ1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAZ,WAUA,OANAO,GA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AMsB,WAAWtB,EAAMuB,gBAGzBvB,EAAMsE,OAAS,WACwB,YAAjC9F,EAAO+F,aAAa,SACtB/F,EAAOgG,aAAa,QAAS,YACa,aAAjChG,EAAO+F,aAAa,SAC7B/F,EAAOgG,aAAa,QAAS,aACa,cAAjChG,EAAO+F,aAAa,SAC7B/F,EAAOgG,aAAa,QAAS,aAE7BhG,EAAOgG,aAAa,QAAS,YAiDjCxE,EAAMyE,OAAO,UAAW,SAAAC,GACtB1E,EAAMuB,cAAgBW,SAASwC,GAChB,OAAXrD,GACFrB,EAAMsB,WAAWtB,EAAMuB,iBAI3BvB,EAAMyE,OAAO,SAAU,SAAAC,GACN,KAAXA,IACE5C,GACFxD,EAAKwF,IAAI,iCAAkC9D,EAAM+B,QAEnDzB,EAAMoE,EACN1E,EAAM8C,QAAU9C,EAAMuB,cAAgBA,EAClCZ,EACFA,EAAcgE,UAAU3D,KAAK,WAC3BZ,MAGFA,YFmGNwE,8BACA,SAAU3I,EAAQD,EAASQ,GAEjC,YAGAa,QAAOC,eAAetB,EAAS,cAC7BgB,OAAO,IAEThB,EAAQ6I,QAAMC,EG9Td,IAAAC,GAAAvI,EAAA,GHkUIwI,EAIJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAItH,WAAasH,GAAQC,QAASD,IAJhDF,GGjUvCI,EAAA3I,EAAA,iCAEaqI,OAAMG,EAAAE,QAChBjJ,OAAO,UACPmJ,UAAU,QAFMD,EAAAhH,OAGhBjB,MHsUGmI,EACA,SAAUpJ,EAAQD,GI7UxBC,EAAAD,QAAAM","file":"angular-pdf.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdf\", [\"angular\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdf\"] = factory(require(\"angular\"));\n\telse\n\t\troot[\"pdf\"] = factory(root[\"angular\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*!\n * Angular-PDF: An Angularjs directive to display PDF in the browser with PDFJS.\n * @version 1.6.2\n * @link https://github.com/sayanee/angular-pdf#readme\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdf\", [\"angular\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdf\"] = factory(require(\"angular\"));\n\telse\n\t\troot[\"pdf\"] = factory(root[\"angular\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./src/angular-pdf.module.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./src/angular-pdf.directive.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar NgPdf = exports.NgPdf = [\"$window\", \"$document\", \"$log\", function NgPdf($window, $document, $log) {\n 'ngInject';\n\n var backingScale = function backingScale(canvas) {\n var ctx = canvas.getContext('2d');\n var dpr = $window.devicePixelRatio || 1;\n var bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;\n\n return dpr / bsr;\n };\n\n var setCanvasDimensions = function setCanvasDimensions(canvas, w, h) {\n var ratio = backingScale(canvas);\n canvas.width = Math.floor(w * ratio);\n canvas.height = Math.floor(h * ratio);\n canvas.style.width = Math.floor(w) + 'px';\n canvas.style.height = Math.floor(h) + 'px';\n canvas.getContext('2d').setTransform(ratio, 0, 0, ratio, 0, 0);\n return canvas;\n };\n\n return {\n restrict: 'E',\n templateUrl: function templateUrl(element, attr) {\n return attr.templateUrl ? attr.templateUrl : 'partials/viewer.html';\n },\n link: function link(scope, element, attrs) {\n var renderTask = null;\n var pdfLoaderTask = null;\n var debug = false;\n var url = scope.pdfUrl;\n var httpHeaders = scope.httpHeaders;\n var pdfDoc = null;\n var pageToDisplay = isFinite(attrs.page) ? parseInt(attrs.page) : 1;\n var pageFit = attrs.scale === 'page-fit';\n var scale = attrs.scale > 0 ? attrs.scale : 1;\n var canvasid = attrs.canvasid || 'pdf-canvas';\n var canvas = $document[0].getElementById(canvasid);\n var creds = attrs.usecredentials;\n debug = attrs.hasOwnProperty('debug') ? attrs.debug : false;\n\n var ctx = canvas.getContext('2d');\n var windowEl = angular.element($window);\n\n element.css('display', 'block');\n\n windowEl.on('scroll', function () {\n scope.$apply(function () {\n scope.scroll = windowEl[0].scrollY;\n });\n });\n\n PDFJS.disableWorker = true;\n scope.pageNum = pageToDisplay;\n\n scope.renderPage = function (num) {\n if (renderTask) {\n renderTask._internalRenderTask.cancel();\n }\n\n pdfDoc.getPage(num).then(function (page) {\n var viewport = void 0;\n var pageWidthScale = void 0;\n var renderContext = void 0;\n\n if (pageFit) {\n viewport = page.getViewport(1);\n var clientRect = element[0].getBoundingClientRect();\n pageWidthScale = clientRect.width / viewport.width;\n scale = pageWidthScale;\n }\n viewport = page.getViewport(scale);\n\n setCanvasDimensions(canvas, viewport.width, viewport.height);\n\n renderContext = {\n canvasContext: ctx,\n viewport: viewport\n };\n\n renderTask = page.render(renderContext);\n renderTask.promise.then(function () {\n if (angular.isFunction(scope.onPageRender)) {\n scope.onPageRender();\n }\n }).catch(function (reason) {\n $log.log(reason);\n });\n });\n };\n\n scope.goPrevious = function () {\n if (scope.pageToDisplay <= 1) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) - 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.goNext = function () {\n if (scope.pageToDisplay >= pdfDoc.numPages) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) + 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.zoomIn = function () {\n pageFit = false;\n scale = parseFloat(scale) + 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.zoomOut = function () {\n pageFit = false;\n scale = parseFloat(scale) - 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.fit = function () {\n pageFit = true;\n scope.renderPage(scope.pageToDisplay);\n };\n\n scope.changePage = function () {\n scope.renderPage(scope.pageToDisplay);\n };\n\n scope.rotate = function () {\n if (canvas.getAttribute('class') === 'rotate0') {\n canvas.setAttribute('class', 'rotate90');\n } else if (canvas.getAttribute('class') === 'rotate90') {\n canvas.setAttribute('class', 'rotate180');\n } else if (canvas.getAttribute('class') === 'rotate180') {\n canvas.setAttribute('class', 'rotate270');\n } else {\n canvas.setAttribute('class', 'rotate0');\n }\n };\n\n function clearCanvas() {\n if (ctx) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n }\n }\n\n function renderPDF() {\n clearCanvas();\n\n var params = {\n 'url': url,\n 'withCredentials': creds\n };\n\n if (httpHeaders) {\n params.httpHeaders = httpHeaders;\n }\n\n if (url && url.length) {\n pdfLoaderTask = PDFJS.getDocument(params);\n pdfLoaderTask.onProgress = scope.onProgress;\n pdfLoaderTask.onPassword = scope.onPassword;\n pdfLoaderTask.then(function (_pdfDoc) {\n if (angular.isFunction(scope.onLoad)) {\n scope.onLoad();\n }\n\n pdfDoc = _pdfDoc;\n scope.renderPage(scope.pageToDisplay);\n\n scope.$apply(function () {\n scope.pageCount = _pdfDoc.numPages;\n });\n }, function (error) {\n if (error) {\n if (angular.isFunction(scope.onError)) {\n scope.onError(error);\n }\n }\n });\n }\n }\n\n scope.$watch('pageNum', function (newVal) {\n scope.pageToDisplay = parseInt(newVal);\n if (pdfDoc !== null) {\n scope.renderPage(scope.pageToDisplay);\n }\n });\n\n scope.$watch('pdfUrl', function (newVal) {\n if (newVal !== '') {\n if (debug) {\n $log.log('pdfUrl value change detected: ', scope.pdfUrl);\n }\n url = newVal;\n scope.pageNum = scope.pageToDisplay = pageToDisplay;\n if (pdfLoaderTask) {\n pdfLoaderTask.destroy().then(function () {\n renderPDF();\n });\n } else {\n renderPDF();\n }\n }\n });\n }\n };\n}];\n\n/***/ }),\n\n/***/ \"./src/angular-pdf.module.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Pdf = undefined;\n\nvar _angular = __webpack_require__(0);\n\nvar _angular2 = _interopRequireDefault(_angular);\n\nvar _angularPdf = __webpack_require__(\"./src/angular-pdf.directive.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Pdf = exports.Pdf = _angular2.default.module('pdf', []).directive('ngPdf', _angularPdf.NgPdf).name;\n\n/***/ }),\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n/***/ })\n\n/******/ });\n});\n\n\n// WEBPACK FOOTER //\n// angular-pdf.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/angular-pdf.module.js\");\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a4257fd975d7127336b8","export const NgPdf = ($window, $document, $log) => {\n 'ngInject';\n\n const backingScale = canvas => {\n const ctx = canvas.getContext('2d');\n const dpr = $window.devicePixelRatio || 1;\n const bsr = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n\n return dpr / bsr;\n };\n\n const setCanvasDimensions = (canvas, w, h) => {\n const ratio = backingScale(canvas);\n canvas.width = Math.floor(w * ratio);\n canvas.height = Math.floor(h * ratio);\n canvas.style.width = `${Math.floor(w)}px`;\n canvas.style.height = `${Math.floor(h)}px`;\n canvas.getContext('2d').setTransform(ratio, 0, 0, ratio, 0, 0);\n return canvas;\n };\n\n return {\n restrict: 'E',\n templateUrl(element, attr) {\n return attr.templateUrl ? attr.templateUrl : 'partials/viewer.html';\n },\n link(scope, element, attrs) {\n let renderTask = null;\n let pdfLoaderTask = null;\n let debug = false;\n let url = scope.pdfUrl;\n let httpHeaders = scope.httpHeaders;\n let pdfDoc = null;\n let pageToDisplay = isFinite(attrs.page) ? parseInt(attrs.page) : 1;\n let pageFit = attrs.scale === 'page-fit';\n let scale = attrs.scale > 0 ? attrs.scale : 1;\n let canvasid = attrs.canvasid || 'pdf-canvas';\n let canvas = $document[0].getElementById(canvasid);\n let creds = attrs.usecredentials;\n debug = attrs.hasOwnProperty('debug') ? attrs.debug : false;\n\n let ctx = canvas.getContext('2d');\n let windowEl = angular.element($window);\n\n element.css('display', 'block');\n\n windowEl.on('scroll', () => {\n scope.$apply(() => {\n scope.scroll = windowEl[0].scrollY;\n });\n });\n\n PDFJS.disableWorker = true;\n scope.pageNum = pageToDisplay;\n\n scope.renderPage = num => {\n if (renderTask) {\n renderTask._internalRenderTask.cancel();\n }\n\n pdfDoc.getPage(num).then(page => {\n let viewport;\n let pageWidthScale;\n let renderContext;\n\n if (pageFit) {\n viewport = page.getViewport(1);\n const clientRect = element[0].getBoundingClientRect();\n pageWidthScale = clientRect.width / viewport.width;\n scale = pageWidthScale;\n }\n viewport = page.getViewport(scale);\n\n setCanvasDimensions(canvas, viewport.width, viewport.height);\n\n renderContext = {\n canvasContext: ctx,\n viewport\n };\n\n renderTask = page.render(renderContext);\n renderTask.promise.then(() => {\n if (angular.isFunction(scope.onPageRender)) {\n scope.onPageRender();\n }\n }).catch(reason => {\n $log.log(reason);\n });\n });\n };\n\n scope.goPrevious = () => {\n if (scope.pageToDisplay <= 1) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) - 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.goNext = () => {\n if (scope.pageToDisplay >= pdfDoc.numPages) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) + 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.zoomIn = () => {\n pageFit = false;\n scale = parseFloat(scale) + 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.zoomOut = () => {\n pageFit = false;\n scale = parseFloat(scale) - 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.fit = () => {\n pageFit = true;\n scope.renderPage(scope.pageToDisplay);\n }\n\n scope.changePage = () => {\n scope.renderPage(scope.pageToDisplay);\n };\n\n scope.rotate = () => {\n if (canvas.getAttribute('class') === 'rotate0') {\n canvas.setAttribute('class', 'rotate90');\n } else if (canvas.getAttribute('class') === 'rotate90') {\n canvas.setAttribute('class', 'rotate180');\n } else if (canvas.getAttribute('class') === 'rotate180') {\n canvas.setAttribute('class', 'rotate270');\n } else {\n canvas.setAttribute('class', 'rotate0');\n }\n };\n\n function clearCanvas() {\n if (ctx) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n }\n }\n\n function renderPDF() {\n clearCanvas();\n\n let params = {\n 'url': url,\n 'withCredentials': creds\n };\n\n if (httpHeaders) {\n params.httpHeaders = httpHeaders;\n }\n\n if (url && url.length) {\n pdfLoaderTask = PDFJS.getDocument(params);\n pdfLoaderTask.onProgress = scope.onProgress;\n pdfLoaderTask.onPassword = scope.onPassword;\n pdfLoaderTask.then(\n _pdfDoc => {\n if (angular.isFunction(scope.onLoad)) {\n scope.onLoad();\n }\n\n pdfDoc = _pdfDoc;\n scope.renderPage(scope.pageToDisplay);\n\n scope.$apply(() => {\n scope.pageCount = _pdfDoc.numPages;\n });\n }, error => {\n if (error) {\n if (angular.isFunction(scope.onError)) {\n scope.onError(error);\n }\n }\n }\n );\n }\n }\n\n scope.$watch('pageNum', newVal => {\n scope.pageToDisplay = parseInt(newVal);\n if (pdfDoc !== null) {\n scope.renderPage(scope.pageToDisplay);\n }\n });\n\n scope.$watch('pdfUrl', newVal => {\n if (newVal !== '') {\n if (debug) {\n $log.log('pdfUrl value change detected: ', scope.pdfUrl);\n }\n url = newVal;\n scope.pageNum = scope.pageToDisplay = pageToDisplay;\n if (pdfLoaderTask) {\n pdfLoaderTask.destroy().then(() => {\n renderPDF();\n });\n } else {\n renderPDF();\n }\n }\n });\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/angular-pdf.directive.js","import angular from 'angular';\nimport { NgPdf } from './angular-pdf.directive'\n\nexport const Pdf = angular\n .module('pdf', [])\n .directive('ngPdf', NgPdf)\n .name;\n\n\n\n// WEBPACK FOOTER //\n// ./src/angular-pdf.module.js","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"angular\"\n// module id = 0\n// module chunks = 0"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///angular-pdf.min.js","webpack:///webpack/bootstrap a4257fd975d7127336b8","webpack:///./src/angular-pdf.directive.js","webpack:///./src/angular-pdf.module.js","webpack:///external \"angular\""],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_0__","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","value","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","./src/angular-pdf.directive.js","NgPdf","$window","$document","$log","backingScale","canvas","ctx","getContext","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","setCanvasDimensions","w","h","ratio","width","Math","floor","height","style","setTransform","restrict","templateUrl","element","attr","link","scope","attrs","clearCanvas","clearRect","renderPDF","params","url","withCredentials","creds","httpHeaders","length","pdfLoaderTask","PDFJS","getDocument","onProgress","onPassword","then","_pdfDoc","angular","isFunction","onLoad","pdfDoc","renderPage","pageToDisplay","$apply","pageCount","numPages","error","onError","renderTask","debug","pdfUrl","isFinite","page","parseInt","pageFit","scale","canvasid","getElementById","usecredentials","windowEl","css","on","scroll","scrollY","disableWorker","pageNum","num","_internalRenderTask","cancel","getPage","viewport","pageWidthScale","renderContext","getViewport","getBoundingClientRect","canvasContext","render","promise","onPageRender","catch","reason","log","goPrevious","goNext","zoomIn","parseFloat","zoomOut","fit","changePage","rotate","getAttribute","setAttribute","$watch","newVal","destroy","./src/angular-pdf.module.js","Pdf","undefined","_angular","_angular2","obj","default","_angularPdf","directive","0"],"mappings":";;;;;;CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,YACA,kBAAAC,gBAAAC,IACAD,OAAA,kBAAAJ,GACA,gBAAAC,SACAA,QAAA,IAAAD,EAAAG,QAAA,YAEAJ,EAAA,IAAAC,EAAAD,EAAA,UACCO,KAAA,SAAAC,GACD,MCMgB,UAAUC,GCZ1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAT,OAGA,IAAAC,GAAAS,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAZ,WAUA,OANAO,GAAAE,GAAAI,KAAAZ,EAAAD,QAAAC,IAAAD,QAAAQ,GAGAP,EAAAW,GAAA,EAGAX,EAAAD,QAvBA,GAAAU,KA+DA,OAnCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAG,EAAA,SAAAK,GAA2C,MAAAA,IAG3CR,EAAAS,EAAA,SAAAjB,EAAAkB,EAAAC,GACAX,EAAAY,EAAApB,EAAAkB,IACAG,OAAAC,eAAAtB,EAAAkB,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAX,EAAAkB,EAAA,SAAAzB,GACA,GAAAkB,GAAAlB,KAAA0B,WACA,WAA2B,MAAA1B,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAO,GAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAQ,EAAAC,GAAs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CZ,EACFA,EAAcgE,UAAU3D,KAAK,WAC3BZ,MAGFA,YFmGNwE,8BACA,SAAU3I,EAAQD,EAASQ,GAEjC,YAGAa,QAAOC,eAAetB,EAAS,cAC7BgB,OAAO,IAEThB,EAAQ6I,QAAMC,EG9Td,IAAAC,GAAAvI,EAAA,GHkUIwI,EAIJ,SAAgCC,GAAO,MAAOA,IAAOA,EAAItH,WAAasH,GAAQC,QAASD,IAJhDF,GGjUvCI,EAAA3I,EAAA,iCAEaqI,OAAMG,EAAAE,QAChBjJ,OAAO,UACPmJ,UAAU,QAFMD,EAAAhH,OAGhBjB,MHsUGmI,EACA,SAAUpJ,EAAQD,GI7UxBC,EAAAD,QAAAM","file":"angular-pdf.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdf\", [\"angular\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdf\"] = factory(require(\"angular\"));\n\telse\n\t\troot[\"pdf\"] = factory(root[\"angular\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","/*!\n * Angular-PDF: An Angularjs directive to display PDF in the browser with PDFJS.\n * @version 1.6.3\n * @link https://github.com/sayanee/angular-pdf#readme\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"angular\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdf\", [\"angular\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdf\"] = factory(require(\"angular\"));\n\telse\n\t\troot[\"pdf\"] = factory(root[\"angular\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"/\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./src/angular-pdf.module.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./src/angular-pdf.directive.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar NgPdf = exports.NgPdf = [\"$window\", \"$document\", \"$log\", function NgPdf($window, $document, $log) {\n 'ngInject';\n\n var backingScale = function backingScale(canvas) {\n var ctx = canvas.getContext('2d');\n var dpr = $window.devicePixelRatio || 1;\n var bsr = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;\n\n return dpr / bsr;\n };\n\n var setCanvasDimensions = function setCanvasDimensions(canvas, w, h) {\n var ratio = backingScale(canvas);\n canvas.width = Math.floor(w * ratio);\n canvas.height = Math.floor(h * ratio);\n canvas.style.width = Math.floor(w) + 'px';\n canvas.style.height = Math.floor(h) + 'px';\n canvas.getContext('2d').setTransform(ratio, 0, 0, ratio, 0, 0);\n return canvas;\n };\n\n return {\n restrict: 'E',\n templateUrl: function templateUrl(element, attr) {\n return attr.templateUrl ? attr.templateUrl : 'partials/viewer.html';\n },\n link: function link(scope, element, attrs) {\n var renderTask = null;\n var pdfLoaderTask = null;\n var debug = false;\n var url = scope.pdfUrl;\n var httpHeaders = scope.httpHeaders;\n var pdfDoc = null;\n var pageToDisplay = isFinite(attrs.page) ? parseInt(attrs.page) : 1;\n var pageFit = attrs.scale === 'page-fit';\n var scale = attrs.scale > 0 ? attrs.scale : 1;\n var canvasid = attrs.canvasid || 'pdf-canvas';\n var canvas = $document[0].getElementById(canvasid);\n var creds = attrs.usecredentials;\n debug = attrs.hasOwnProperty('debug') ? attrs.debug : false;\n\n var ctx = canvas.getContext('2d');\n var windowEl = angular.element($window);\n\n element.css('display', 'block');\n\n windowEl.on('scroll', function () {\n scope.$apply(function () {\n scope.scroll = windowEl[0].scrollY;\n });\n });\n\n PDFJS.disableWorker = true;\n scope.pageNum = pageToDisplay;\n\n scope.renderPage = function (num) {\n if (renderTask) {\n renderTask._internalRenderTask.cancel();\n }\n\n pdfDoc.getPage(num).then(function (page) {\n var viewport = void 0;\n var pageWidthScale = void 0;\n var renderContext = void 0;\n\n if (pageFit) {\n viewport = page.getViewport(1);\n var clientRect = element[0].getBoundingClientRect();\n pageWidthScale = clientRect.width / viewport.width;\n scale = pageWidthScale;\n }\n viewport = page.getViewport(scale);\n\n setCanvasDimensions(canvas, viewport.width, viewport.height);\n\n renderContext = {\n canvasContext: ctx,\n viewport: viewport\n };\n\n renderTask = page.render(renderContext);\n renderTask.promise.then(function () {\n if (angular.isFunction(scope.onPageRender)) {\n scope.onPageRender();\n }\n }).catch(function (reason) {\n $log.log(reason);\n });\n });\n };\n\n scope.goPrevious = function () {\n if (scope.pageToDisplay <= 1) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) - 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.goNext = function () {\n if (scope.pageToDisplay >= pdfDoc.numPages) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) + 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.zoomIn = function () {\n pageFit = false;\n scale = parseFloat(scale) + 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.zoomOut = function () {\n pageFit = false;\n scale = parseFloat(scale) - 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.fit = function () {\n pageFit = true;\n scope.renderPage(scope.pageToDisplay);\n };\n\n scope.changePage = function () {\n scope.renderPage(scope.pageToDisplay);\n };\n\n scope.rotate = function () {\n if (canvas.getAttribute('class') === 'rotate0') {\n canvas.setAttribute('class', 'rotate90');\n } else if (canvas.getAttribute('class') === 'rotate90') {\n canvas.setAttribute('class', 'rotate180');\n } else if (canvas.getAttribute('class') === 'rotate180') {\n canvas.setAttribute('class', 'rotate270');\n } else {\n canvas.setAttribute('class', 'rotate0');\n }\n };\n\n function clearCanvas() {\n if (ctx) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n }\n }\n\n function renderPDF() {\n clearCanvas();\n\n var params = {\n 'url': url,\n 'withCredentials': creds\n };\n\n if (httpHeaders) {\n params.httpHeaders = httpHeaders;\n }\n\n if (url && url.length) {\n pdfLoaderTask = PDFJS.getDocument(params);\n pdfLoaderTask.onProgress = scope.onProgress;\n pdfLoaderTask.onPassword = scope.onPassword;\n pdfLoaderTask.then(function (_pdfDoc) {\n if (angular.isFunction(scope.onLoad)) {\n scope.onLoad();\n }\n\n pdfDoc = _pdfDoc;\n scope.renderPage(scope.pageToDisplay);\n\n scope.$apply(function () {\n scope.pageCount = _pdfDoc.numPages;\n });\n }, function (error) {\n if (error) {\n if (angular.isFunction(scope.onError)) {\n scope.onError(error);\n }\n }\n });\n }\n }\n\n scope.$watch('pageNum', function (newVal) {\n scope.pageToDisplay = parseInt(newVal);\n if (pdfDoc !== null) {\n scope.renderPage(scope.pageToDisplay);\n }\n });\n\n scope.$watch('pdfUrl', function (newVal) {\n if (newVal !== '') {\n if (debug) {\n $log.log('pdfUrl value change detected: ', scope.pdfUrl);\n }\n url = newVal;\n scope.pageNum = scope.pageToDisplay = pageToDisplay;\n if (pdfLoaderTask) {\n pdfLoaderTask.destroy().then(function () {\n renderPDF();\n });\n } else {\n renderPDF();\n }\n }\n });\n }\n };\n}];\n\n/***/ }),\n\n/***/ \"./src/angular-pdf.module.js\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Pdf = undefined;\n\nvar _angular = __webpack_require__(0);\n\nvar _angular2 = _interopRequireDefault(_angular);\n\nvar _angularPdf = __webpack_require__(\"./src/angular-pdf.directive.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Pdf = exports.Pdf = _angular2.default.module('pdf', []).directive('ngPdf', _angularPdf.NgPdf).name;\n\n/***/ }),\n\n/***/ 0:\n/***/ (function(module, exports) {\n\nmodule.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n/***/ })\n\n/******/ });\n});\n\n\n// WEBPACK FOOTER //\n// angular-pdf.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/angular-pdf.module.js\");\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a4257fd975d7127336b8","export const NgPdf = ($window, $document, $log) => {\n 'ngInject';\n\n const backingScale = canvas => {\n const ctx = canvas.getContext('2d');\n const dpr = $window.devicePixelRatio || 1;\n const bsr = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n\n return dpr / bsr;\n };\n\n const setCanvasDimensions = (canvas, w, h) => {\n const ratio = backingScale(canvas);\n canvas.width = Math.floor(w * ratio);\n canvas.height = Math.floor(h * ratio);\n canvas.style.width = `${Math.floor(w)}px`;\n canvas.style.height = `${Math.floor(h)}px`;\n canvas.getContext('2d').setTransform(ratio, 0, 0, ratio, 0, 0);\n return canvas;\n };\n\n return {\n restrict: 'E',\n templateUrl(element, attr) {\n return attr.templateUrl ? attr.templateUrl : 'partials/viewer.html';\n },\n link(scope, element, attrs) {\n let renderTask = null;\n let pdfLoaderTask = null;\n let debug = false;\n let url = scope.pdfUrl;\n let httpHeaders = scope.httpHeaders;\n let pdfDoc = null;\n let pageToDisplay = isFinite(attrs.page) ? parseInt(attrs.page) : 1;\n let pageFit = attrs.scale === 'page-fit';\n let scale = attrs.scale > 0 ? attrs.scale : 1;\n let canvasid = attrs.canvasid || 'pdf-canvas';\n let canvas = $document[0].getElementById(canvasid);\n let creds = attrs.usecredentials;\n debug = attrs.hasOwnProperty('debug') ? attrs.debug : false;\n\n let ctx = canvas.getContext('2d');\n let windowEl = angular.element($window);\n\n element.css('display', 'block');\n\n windowEl.on('scroll', () => {\n scope.$apply(() => {\n scope.scroll = windowEl[0].scrollY;\n });\n });\n\n PDFJS.disableWorker = true;\n scope.pageNum = pageToDisplay;\n\n scope.renderPage = num => {\n if (renderTask) {\n renderTask._internalRenderTask.cancel();\n }\n\n pdfDoc.getPage(num).then(page => {\n let viewport;\n let pageWidthScale;\n let renderContext;\n\n if (pageFit) {\n viewport = page.getViewport(1);\n const clientRect = element[0].getBoundingClientRect();\n pageWidthScale = clientRect.width / viewport.width;\n scale = pageWidthScale;\n }\n viewport = page.getViewport(scale);\n\n setCanvasDimensions(canvas, viewport.width, viewport.height);\n\n renderContext = {\n canvasContext: ctx,\n viewport\n };\n\n renderTask = page.render(renderContext);\n renderTask.promise.then(() => {\n if (angular.isFunction(scope.onPageRender)) {\n scope.onPageRender();\n }\n }).catch(reason => {\n $log.log(reason);\n });\n });\n };\n\n scope.goPrevious = () => {\n if (scope.pageToDisplay <= 1) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) - 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.goNext = () => {\n if (scope.pageToDisplay >= pdfDoc.numPages) {\n return;\n }\n scope.pageToDisplay = parseInt(scope.pageToDisplay) + 1;\n scope.pageNum = scope.pageToDisplay;\n };\n\n scope.zoomIn = () => {\n pageFit = false;\n scale = parseFloat(scale) + 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.zoomOut = () => {\n pageFit = false;\n scale = parseFloat(scale) - 0.2;\n scope.renderPage(scope.pageToDisplay);\n return scale;\n };\n\n scope.fit = () => {\n pageFit = true;\n scope.renderPage(scope.pageToDisplay);\n }\n\n scope.changePage = () => {\n scope.renderPage(scope.pageToDisplay);\n };\n\n scope.rotate = () => {\n if (canvas.getAttribute('class') === 'rotate0') {\n canvas.setAttribute('class', 'rotate90');\n } else if (canvas.getAttribute('class') === 'rotate90') {\n canvas.setAttribute('class', 'rotate180');\n } else if (canvas.getAttribute('class') === 'rotate180') {\n canvas.setAttribute('class', 'rotate270');\n } else {\n canvas.setAttribute('class', 'rotate0');\n }\n };\n\n function clearCanvas() {\n if (ctx) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n }\n }\n\n function renderPDF() {\n clearCanvas();\n\n let params = {\n 'url': url,\n 'withCredentials': creds\n };\n\n if (httpHeaders) {\n params.httpHeaders = httpHeaders;\n }\n\n if (url && url.length) {\n pdfLoaderTask = PDFJS.getDocument(params);\n pdfLoaderTask.onProgress = scope.onProgress;\n pdfLoaderTask.onPassword = scope.onPassword;\n pdfLoaderTask.then(\n _pdfDoc => {\n if (angular.isFunction(scope.onLoad)) {\n scope.onLoad();\n }\n\n pdfDoc = _pdfDoc;\n scope.renderPage(scope.pageToDisplay);\n\n scope.$apply(() => {\n scope.pageCount = _pdfDoc.numPages;\n });\n }, error => {\n if (error) {\n if (angular.isFunction(scope.onError)) {\n scope.onError(error);\n }\n }\n }\n );\n }\n }\n\n scope.$watch('pageNum', newVal => {\n scope.pageToDisplay = parseInt(newVal);\n if (pdfDoc !== null) {\n scope.renderPage(scope.pageToDisplay);\n }\n });\n\n scope.$watch('pdfUrl', newVal => {\n if (newVal !== '') {\n if (debug) {\n $log.log('pdfUrl value change detected: ', scope.pdfUrl);\n }\n url = newVal;\n scope.pageNum = scope.pageToDisplay = pageToDisplay;\n if (pdfLoaderTask) {\n pdfLoaderTask.destroy().then(() => {\n renderPDF();\n });\n } else {\n renderPDF();\n }\n }\n });\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/angular-pdf.directive.js","import angular from 'angular';\nimport { NgPdf } from './angular-pdf.directive'\n\nexport const Pdf = angular\n .module('pdf', [])\n .directive('ngPdf', NgPdf)\n .name;\n\n\n\n// WEBPACK FOOTER //\n// ./src/angular-pdf.module.js","module.exports = __WEBPACK_EXTERNAL_MODULE_0__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"angular\"\n// module id = 0\n// module chunks = 0"],"sourceRoot":""}
\ No newline at end of file
diff --git a/package.json b/package.json
index 50f2a09..5342bf4 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "angular-pdf",
"description": "An Angularjs directive to display PDF in the browser with PDFJS.",
"homepage": "https://github.com/sayanee/angular-pdf#readme",
- "version": "1.6.2",
+ "version": "1.6.3",
"main": "dist/angular-pdf.js",
"author": {
"email": "sayanee@gmail.com",