diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-exclusion/page-exclusion.component.ts b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-exclusion/page-exclusion.component.ts index 68339a7ea..58dc2bc0c 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-exclusion/page-exclusion.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/components/page-exclusion/page-exclusion.component.ts @@ -70,8 +70,8 @@ export class PageExclusionComponent implements OnChanges { this.excludedPagesService.toggle(); } catch (e) { this._toaster.error(_('file-preview.tabs.exclude-pages.error')); - this._loadingService.stop(); } + this._loadingService.stop(); } async includePagesRange(range: IPageRange): Promise { @@ -87,5 +87,6 @@ export class PageExclusionComponent implements OnChanges { .toPromise(); this._inputComponent.reset(); this.excludedPagesService.toggle(); + this._loadingService.stop(); } } 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 f94aac910..f023065a9 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 @@ -48,7 +48,7 @@ import { FileActionsComponent } from '../../shared/components/file-actions/file- import { FilesService } from '@services/entity-services/files.service'; import { DossiersService } from '@services/entity-services/dossiers.service'; import { FileManagementService } from '@services/entity-services/file-management.service'; -import { filter, map, switchMap, switchMapTo, tap } from 'rxjs/operators'; +import { filter, map, switchMap, tap } from 'rxjs/operators'; import { FilesMapService } from '@services/entity-services/files-map.service'; import { WatermarkService } from '@shared/services/watermark.service'; import { ExcludedPagesService } from './services/excluded-pages.service'; @@ -409,6 +409,10 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni await this._stampPDF(); await this._cleanupAndRedrawManualAnnotations$().toPromise(); + this._instance.Core.documentViewer.addEventListener('pageNumberUpdated', () => { + this._setExcludedPageStyles(); + }); + // Go to initial page from query params const pageNumber = this._lastPage || this._activatedRoute.snapshot.queryParams.page; if (pageNumber) { @@ -459,6 +463,21 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni return false; } + private _setExcludedPageStyles() { + const file = this._filesMapService.get(this.dossierId, this.fileId); + setTimeout(() => { + const iframeDoc = this._instance.UI.iframeWindow.document; + const pageContainer = iframeDoc.getElementById(`pageWidgetContainer${this.activeViewerPage}`); + if (pageContainer) { + if (file.excludedPages.includes(this.activeViewerPage)) { + pageContainer.classList.add('excluded-page'); + } else { + pageContainer.classList.remove('excluded-page'); + } + } + }, 100); + } + private async _reloadFile(file: File): Promise { await this._loadFileData(file, true); await this._cleanupAndRedrawManualAnnotations$().toPromise(); @@ -523,14 +542,15 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni document, this._instance.Core.PDFNet, this._translateService.instant('file-preview.excluded-from-redaction'), - 25, + 17, 'courier', - 'DIAGONAL', - 33, - '#283241', + 'TOP_LEFT', + 50, + '#dd4d50', excludedPages, ); } + this._setExcludedPageStyles(); } private _subscribeToFileUpdates(): void { diff --git a/apps/red-ui/src/app/utils/page-stamper.ts b/apps/red-ui/src/app/utils/page-stamper.ts index decf09723..e292356c1 100644 --- a/apps/red-ui/src/app/utils/page-stamper.ts +++ b/apps/red-ui/src/app/utils/page-stamper.ts @@ -42,7 +42,7 @@ export async function stampPDFPage( text: string, fontSize: number, fontType: string, - orientation: 'DIAGONAL' | 'HORIZONTAL' | 'VERTICAL', + orientation: 'DIAGONAL' | 'HORIZONTAL' | 'VERTICAL' | 'TOP_LEFT', opacity: number, color: string, pages: number[], @@ -67,6 +67,11 @@ export async function stampPDFPage( break; case 'HORIZONTAL': break; + case 'TOP_LEFT': + await stamper.setAlignment(-1, 1); + await stamper.setRotation(90); + await stamper.setPosition(20, 20); + break; case 'DIAGONAL': default: await stamper.setAlignment(0, 0); diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index 7aef1c722..171d9267d 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1032,7 +1032,7 @@ "document-info": "Your Document Info lives here. This includes metadata required on each document.", "download-original-file": "Download Original File", "exclude-pages": "Exclude pages from redaction", - "excluded-from-redaction": "excluded from automatic redaction", + "excluded-from-redaction": "excluded", "fullscreen": "Full Screen (F)", "last-reviewer": "Last Reviewed by:", "no-data": { diff --git a/apps/red-ui/src/assets/pdftron/stylesheet.css b/apps/red-ui/src/assets/pdftron/stylesheet.css index eb90df61e..65408fd9a 100644 --- a/apps/red-ui/src/assets/pdftron/stylesheet.css +++ b/apps/red-ui/src/assets/pdftron/stylesheet.css @@ -33,3 +33,7 @@ .Popup .Button img { width: 18px; } + +.excluded-page { + border: 2px solid #dd4d5080; +}