diff --git a/CHANGELOG.md b/CHANGELOG.md index ba39c7f92..a044d5cd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ # Changelog +## 1.1.2 +* [[#112](https://github.com/VadimDez/ng2-pdf-viewer/issues/112)] - Error handling +* Updated documentation + ## 1.1.1 -[[#111](https://github.com/VadimDez/ng2-pdf-viewer/issues/111)] - out of order +* [[#111](https://github.com/VadimDez/ng2-pdf-viewer/issues/111)] - out of order ## 1.1.0 * [[#72](https://github.com/VadimDez/ng2-pdf-viewer/issues/72)] - Updated for Angular 4 diff --git a/README.md b/README.md index 04e7c6345..0df8fc78b 100644 --- a/README.md +++ b/README.md @@ -191,7 +191,10 @@ Then add it to `pdf-component` in component's template (error)="onError($event) ``` -## Develop +## Contribute + +Clone project and switch to latest version branch (right now `features/1.1.2`) + ``` npm start ``` diff --git a/dist/pdf-viewer.component.d.ts b/dist/pdf-viewer.component.d.ts index b4af6f736..a5684bdd2 100644 --- a/dist/pdf-viewer.component.d.ts +++ b/dist/pdf-viewer.component.d.ts @@ -11,6 +11,7 @@ export declare class PdfViewerComponent implements OnChanges { private _zoom; private _rotation; afterLoadComplete: EventEmitter; + onError: EventEmitter; constructor(element: ElementRef); src: string | Uint8Array | PDFSource; page: any; diff --git a/dist/pdf-viewer.component.js b/dist/pdf-viewer.component.js index f63448a47..8c482b6fe 100644 --- a/dist/pdf-viewer.component.js +++ b/dist/pdf-viewer.component.js @@ -21,6 +21,7 @@ var PdfViewerComponent = (function () { this._zoom = 1; this._rotation = 0; this.afterLoadComplete = new core_1.EventEmitter(); + this.onError = new core_1.EventEmitter(); this.pageChange = new core_1.EventEmitter(true); } Object.defineProperty(PdfViewerComponent.prototype, "page", { @@ -95,10 +96,13 @@ var PdfViewerComponent = (function () { if (!this.src) { return; } - PDFJS.getDocument(this.src).then(function (pdf) { + PDFJS.getDocument(this.src) + .then(function (pdf) { _this._pdf = pdf; _this.afterLoadComplete.emit(pdf); _this.update(); + }, function (error) { + _this.onError.emit(error); }); }; PdfViewerComponent.prototype.update = function () { @@ -191,6 +195,10 @@ var PdfViewerComponent = (function () { core_1.Output('after-load-complete'), __metadata("design:type", Object) ], PdfViewerComponent.prototype, "afterLoadComplete", void 0); + __decorate([ + core_1.Output('error'), + __metadata("design:type", Object) + ], PdfViewerComponent.prototype, "onError", void 0); __decorate([ core_1.Input(), __metadata("design:type", Object) diff --git a/dist/pdf-viewer.component.metadata.json b/dist/pdf-viewer.component.metadata.json index 9a0cb54de..026ecc9a6 100644 --- a/dist/pdf-viewer.component.metadata.json +++ b/dist/pdf-viewer.component.metadata.json @@ -1 +1 @@ -[{"__symbolic":"module","version":3,"metadata":{"PdfViewerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"pdf-viewer","template":"
","styles":["\n.ng2-pdf-viewer--zoom {\n overflow-x: scroll;\n}\n\n:host >>> .ng2-pdf-viewer-container > div {\n position: relative;\n z-index: 0;\n}\n\n:host >>> .textLayer {\n font-family: sans-serif;\n overflow: hidden;\n}\n "]}]}],"members":{"afterLoadComplete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["after-load-complete"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"src":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"page":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"pageChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"renderText":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["render-text"]}]}],"originalSize":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["original-size"]}]}],"showAll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["show-all"]}]}],"zoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["zoom"]}]}],"rotation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["rotation"]}]}],"ngOnChanges":[{"__symbolic":"method"}],"loadPDF":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"renderMultiplePages":[{"__symbolic":"method"}],"isValidPageNumber":[{"__symbolic":"method"}],"buildSVG":[{"__symbolic":"method"}],"renderPageOverlay":[{"__symbolic":"method"}],"renderPage":[{"__symbolic":"method"}],"removeAllChildNodes":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"PdfViewerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"pdf-viewer","template":"
","styles":["\n.ng2-pdf-viewer--zoom {\n overflow-x: scroll;\n}\n\n:host >>> .ng2-pdf-viewer-container > div {\n position: relative;\n z-index: 0;\n}\n\n:host >>> .textLayer {\n font-family: sans-serif;\n overflow: hidden;\n}\n "]}]}],"members":{"afterLoadComplete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["after-load-complete"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"src":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"page":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"pageChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"renderText":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["render-text"]}]}],"originalSize":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["original-size"]}]}],"showAll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["show-all"]}]}],"zoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["zoom"]}]}],"rotation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["rotation"]}]}],"ngOnChanges":[{"__symbolic":"method"}],"loadPDF":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"renderMultiplePages":[{"__symbolic":"method"}],"isValidPageNumber":[{"__symbolic":"method"}],"buildSVG":[{"__symbolic":"method"}],"renderPageOverlay":[{"__symbolic":"method"}],"renderPage":[{"__symbolic":"method"}],"removeAllChildNodes":[{"__symbolic":"method"}]}}}}] \ No newline at end of file +[{"__symbolic":"module","version":3,"metadata":{"PdfViewerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"pdf-viewer","template":"
","styles":["\n.ng2-pdf-viewer--zoom {\n overflow-x: scroll;\n}\n\n:host >>> .ng2-pdf-viewer-container > div {\n position: relative;\n z-index: 0;\n}\n\n:host >>> .textLayer {\n font-family: sans-serif;\n overflow: hidden;\n}\n "]}]}],"members":{"afterLoadComplete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["after-load-complete"]}]}],"onError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["error"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"src":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"page":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"pageChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"renderText":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["render-text"]}]}],"originalSize":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["original-size"]}]}],"showAll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["show-all"]}]}],"zoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["zoom"]}]}],"rotation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["rotation"]}]}],"ngOnChanges":[{"__symbolic":"method"}],"loadPDF":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"renderMultiplePages":[{"__symbolic":"method"}],"isValidPageNumber":[{"__symbolic":"method"}],"buildSVG":[{"__symbolic":"method"}],"renderPageOverlay":[{"__symbolic":"method"}],"renderPage":[{"__symbolic":"method"}],"removeAllChildNodes":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"PdfViewerComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"pdf-viewer","template":"
","styles":["\n.ng2-pdf-viewer--zoom {\n overflow-x: scroll;\n}\n\n:host >>> .ng2-pdf-viewer-container > div {\n position: relative;\n z-index: 0;\n}\n\n:host >>> .textLayer {\n font-family: sans-serif;\n overflow: hidden;\n}\n "]}]}],"members":{"afterLoadComplete":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["after-load-complete"]}]}],"onError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["error"]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"src":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"page":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"pageChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"renderText":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["render-text"]}]}],"originalSize":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["original-size"]}]}],"showAll":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["show-all"]}]}],"zoom":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["zoom"]}]}],"rotation":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["rotation"]}]}],"ngOnChanges":[{"__symbolic":"method"}],"loadPDF":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"renderMultiplePages":[{"__symbolic":"method"}],"isValidPageNumber":[{"__symbolic":"method"}],"buildSVG":[{"__symbolic":"method"}],"renderPageOverlay":[{"__symbolic":"method"}],"renderPage":[{"__symbolic":"method"}],"removeAllChildNodes":[{"__symbolic":"method"}]}}}}] \ No newline at end of file diff --git a/package.json b/package.json index 3b43269aa..edb0abade 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ng2-pdf-viewer", - "version": "1.1.1", + "version": "1.1.2", "description": "Angular2+ component for rendering PDF", "main": "dist/index.js", "typings": "./dist/index.d.ts",