diff --git a/src/frontend/app/document/document.component.ts b/src/frontend/app/document/document.component.ts index 7a9fd841f359d4642ef885e788d7ac96291c0ade..52afbd3679a8b47cfe6abae0b8776db28f958589 100755 --- a/src/frontend/app/document/document.component.ts +++ b/src/frontend/app/document/document.component.ts @@ -128,12 +128,7 @@ export class DocumentComponent implements OnInit { this.loadingDoc = true; this.http.get('../rest/documents/' + params['id']) .subscribe((data: any) => { - this.docList = []; - this.signaturesService.signaturesContent = []; - this.signaturesService.notesContent = []; - this.signaturesService.currentAction = 0; - this.signaturesService.currentPage = 1; - this.signaturesContent.currentDoc = 1; + this.initDoc(); this.mainDocument = data.document; this.signaturesService.mainDocumentId = this.mainDocument.id; this.actionsList = data.document.actionsAllowed; @@ -149,6 +144,7 @@ export class DocumentComponent implements OnInit { this.docList.push({ 'id': attach.id, 'encodedDocument': '', 'title': '' }); }); this.loadingDoc = false; + this.pdfRender(this.docList[this.currentDoc]); setTimeout(() => { this.loadingPage = false; @@ -165,6 +161,17 @@ export class DocumentComponent implements OnInit { }); } + initDoc() { + this.docList = []; + this.signaturesService.signaturesContent = []; + this.signaturesService.notesContent = []; + this.signaturesService.currentAction = 0; + this.signaturesService.currentPage = 1; + this.pageNum = 1; + this.signaturesContent.currentDoc = 1; + this.currentDoc = 0; + } + pdfRender(document: any) { const binary_string = window.atob(document.encodedDocument); const len = binary_string.length;