@@ -5,8 +5,9 @@ import { Component, Input, Output, ViewChild, EventEmitter, ElementRef } from '@
55 template : `<iframe title="ng2-pdfjs-viewer" [hidden]="externalWindow || (!externalWindow && !pdfSrc)" #iframe width="100%" height="100%"></iframe>`
66} )
77export class PdfJsViewerComponent {
8- @ViewChild ( 'iframe' , { static : true } ) iframe : ElementRef ;
9- @Input ( ) public viewerId : string ;
8+ @ViewChild ( 'iframe' , { static : true } ) iframe : ElementRef ;
9+ static lastID = 0 ;
10+ @Input ( ) public viewerId = `ng2-pdfjs-viewer-ID${ ++ lastID } ` ;
1011 @Output ( ) onBeforePrint : EventEmitter < any > = new EventEmitter ( ) ;
1112 @Output ( ) onAfterPrint : EventEmitter < any > = new EventEmitter ( ) ;
1213 @Output ( ) onDocumentLoad : EventEmitter < any > = new EventEmitter ( ) ;
@@ -40,12 +41,12 @@ export class PdfJsViewerComponent {
4041 @Input ( ) public errorAppend : boolean = true ;
4142 @Input ( ) public errorMessage : string ;
4243 @Input ( ) public diagnosticLogs : boolean = true ;
43-
44+
4445 @Input ( ) public externalWindowOptions : string ;
4546 public viewerTab : any ;
4647 private _src : string | Blob | Uint8Array ;
4748 private _page : number ;
48-
49+
4950 @Input ( )
5051 public set page ( _page : number ) {
5152 this . _page = _page ;
@@ -274,7 +275,7 @@ export class PdfJsViewerComponent {
274275 if ( this . useOnlyCssZoom ) {
275276 viewerUrl += `&useOnlyCssZoom=${ this . useOnlyCssZoom } ` ;
276277 }
277-
278+
278279 if ( this . _page || this . zoom || this . nameddest || this . pagemode ) viewerUrl += "#"
279280 if ( this . _page ) {
280281 viewerUrl += `&page=${ this . _page } ` ;
@@ -334,4 +335,4 @@ export class PdfJsViewerComponent {
334335 // pagemode = ${this.errorMessage}
335336 // `);
336337 }
337- }
338+ }
0 commit comments