diff --git a/dist/pdf-viewer.component.js b/dist/pdf-viewer.component.js index a9705e7d7..2a4f38041 100644 --- a/dist/pdf-viewer.component.js +++ b/dist/pdf-viewer.component.js @@ -27,7 +27,7 @@ var PdfViewerComponent = (function () { this.onError = new core_1.EventEmitter(); this.onProgress = new core_1.EventEmitter(); this.pageChange = new core_1.EventEmitter(true); - if (!isSSR()) { + if (!isSSR() && typeof PDFJS.workerSrc !== 'string') { PDFJS.workerSrc = "https://cdnjs.cloudflare.com/ajax/libs/pdf.js/" + PDFJS.version + "/pdf.worker.min.js"; } } @@ -304,6 +304,9 @@ var PdfViewerComponent = (function () { }; PdfViewerComponent.prototype.getScale = function (viewportWidth) { var offsetWidth = this.element.nativeElement.offsetWidth; + if (offsetWidth === 0) { + return 1; + } return this._zoom * (offsetWidth / viewportWidth) / PdfViewerComponent.CSS_UNITS; }; PdfViewerComponent.CSS_UNITS = 96.0 / 72.0; diff --git a/package.json b/package.json index c48f47ff3..490efed74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng2-pdf-viewer", - "version": "3.0.3", + "version": "3.0.4", "description": "Angular2+ component for rendering PDF", "main": "dist/index.js", "typings": "./dist/index.d.ts",