Skip to content

Commit

Permalink
fix: ensure pdf actions loads after pdf loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
jakerenzella committed Feb 1, 2023
1 parent b98c056 commit 0425c54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/common/pdf-viewer/pdf-viewer.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div id="pdfContainer">
<div id="pdfActions">
<div id="pdfActions" [hidden]="!loaded">
<form #loginForm="ngForm" (ngSubmit)="searchPdf(pdfSearchString)">
<mat-form-field floatLabel="never" appearance="outline" class="pdf-form-field" ngSubmit>
<mat-icon matPrefix>search</mat-icon>
Expand All @@ -21,5 +21,6 @@
[render-text]="true"
[original-size]="false"
(after-load-complete)="onLoaded()"
(page-rendered)="loaded = true"
></pdf-viewer>
</div>
3 changes: 3 additions & 0 deletions src/app/common/pdf-viewer/pdf-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class fPdfViewerComponent implements OnDestroy, OnChanges {
@ViewChild(PdfViewerComponent) private pdfComponent: PdfViewerComponent;
pdfSearchString: string;
zoomValue = 1;
loaded = false;

constructor(
@Inject(FileDownloaderService) private fileDownloader: FileDownloaderService,
Expand All @@ -43,6 +44,7 @@ export class fPdfViewerComponent implements OnDestroy, OnChanges {

// Get the new blob
this._pdfUrl = value;
this.loaded = false;
this.downloadBlob(value);
}
}
Expand Down Expand Up @@ -86,6 +88,7 @@ export class fPdfViewerComponent implements OnDestroy, OnChanges {
}

onLoaded() {
this.loaded = true;
window.dispatchEvent(new Event('resize'));
}
}

0 comments on commit 0425c54

Please sign in to comment.