From 230d7814c084dc1ccb72febb2e31378a3021773e Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Wed, 12 Jan 2022 10:26:08 +0200 Subject: [PATCH] fixed ocr doc reload issue --- .../file-preview-screen.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts index 61a18608d..bf35e0ffd 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.ts @@ -389,6 +389,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni async viewerReady($event: WebViewerInstance) { this._instance = $event; this.ready = true; + await this._stampPDF(); await this._reloadAnnotations(); this._setExcludedPageStyles(); @@ -410,6 +411,7 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni } else { this._loadingService.stop(); } + this._changeDetectorRef.markForCheck(); } async annotationsChangedByReviewAction(annotation: AnnotationWrapper) { @@ -469,19 +471,25 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni if (!this._instance) { return; } + + const document = this._instance.Core.documentViewer.getDocument(); + if (!document) { + return; + } + const pdfNet = this._instance.Core.PDFNet; - const document = await this._instance.Core.documentViewer.getDocument().getPDFDoc(); + const pdfDoc = await this._instance.Core.documentViewer.getDocument().getPDFDoc(); const file = this._filesMapService.get(this.dossierId, this.fileId); const allPages = [...Array(file.numberOfPages).keys()].map(page => page + 1); - await clearStamps(document, pdfNet, allPages); + await clearStamps(pdfDoc, pdfNet, allPages); if (this.viewModeService.viewMode === 'REDACTED') { const dossier = this._dossiersService.find(this.dossierId); if (dossier.watermarkPreviewEnabled) { - await this._stampPreview(document, dossier.dossierTemplateId); + await this._stampPreview(pdfDoc, dossier.dossierTemplateId); } } else { - await this._stampExcludedPages(document, file.excludedPages); + await this._stampExcludedPages(pdfDoc, file.excludedPages); } this._instance.Core.documentViewer.refreshAll(); this._instance.Core.documentViewer.updateView([this.activeViewerPage], this.activeViewerPage);