From bc947d240726d843bb58bca1946761a0c7694fa5 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 8 Nov 2023 10:23:30 +0200 Subject: [PATCH] RED-3800 update watermark paddings --- .../file-preview/services/stamp.service.ts | 16 ++++++++-------- apps/red-ui/src/app/utils/page-stamper.ts | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/services/stamp.service.ts b/apps/red-ui/src/app/modules/file-preview/services/stamp.service.ts index 4b110eb24..cad859998 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/stamp.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/stamp.service.ts @@ -1,14 +1,14 @@ import { Injectable } from '@angular/core'; -import { clearStamps, stampPDFPage } from '../../../utils'; -import { FilePreviewStateService } from './file-preview-state.service'; -import { ViewModeService } from './view-mode.service'; import { TranslateService } from '@ngx-translate/core'; import { Core } from '@pdftron/webviewer'; -import { PdfViewer } from '../../pdf-viewer/services/pdf-viewer.service'; -import { REDDocumentViewer } from '../../pdf-viewer/services/document-viewer.service'; -import { LicenseService } from '@services/license.service'; -import { WatermarksMapService } from '@services/entity-services/watermarks-map.service'; import { WATERMARK_HORIZONTAL_ALIGNMENTS, WATERMARK_VERTICAL_ALIGNMENTS } from '@red/domain'; +import { WatermarksMapService } from '@services/entity-services/watermarks-map.service'; +import { LicenseService } from '@services/license.service'; +import { clearStamps, stampPDFPage } from '../../../utils'; +import { REDDocumentViewer } from '../../pdf-viewer/services/document-viewer.service'; +import { PdfViewer } from '../../pdf-viewer/services/pdf-viewer.service'; +import { FilePreviewStateService } from './file-preview-state.service'; +import { ViewModeService } from './view-mode.service'; import PDFNet = Core.PDFNet; @Injectable() @@ -61,7 +61,7 @@ export class StampService { this._translateService.instant('file-preview.excluded-from-redaction') as string, 17, 'courier', - 'TOP_LEFT', + 'DIAGONAL', WATERMARK_HORIZONTAL_ALIGNMENTS.CENTER, WATERMARK_VERTICAL_ALIGNMENTS.CENTER, 50, diff --git a/apps/red-ui/src/app/utils/page-stamper.ts b/apps/red-ui/src/app/utils/page-stamper.ts index 28a19fc4e..4d6602c47 100644 --- a/apps/red-ui/src/app/utils/page-stamper.ts +++ b/apps/red-ui/src/app/utils/page-stamper.ts @@ -1,12 +1,12 @@ -import { hexToRgb } from './functions'; import { Core } from '@pdftron/webviewer'; -import PDFDoc = Core.PDFNet.PDFDoc; import { WATERMARK_HORIZONTAL_ALIGNMENTS, WATERMARK_VERTICAL_ALIGNMENTS, WatermarkHorizontalAlignment, WatermarkVerticalAlignment, } from '@red/domain'; +import { hexToRgb } from './functions'; +import PDFDoc = Core.PDFNet.PDFDoc; const HORIZONTAL_TEXT_ALIGNMENT_MATRIX = [ [-1, 0, 1], @@ -62,7 +62,7 @@ export async function stampPDFPage( text: string, fontSize: number, fontType: string, - orientation: 'DIAGONAL' | 'HORIZONTAL' | 'VERTICAL' | 'TOP_LEFT', + orientation: 'DIAGONAL' | 'HORIZONTAL' | 'VERTICAL', horizontalTextAlignment: WatermarkHorizontalAlignment, verticalTextAlignment: WatermarkVerticalAlignment, opacity: number, @@ -117,17 +117,17 @@ export async function stampPDFPage( case 'VERTICAL': await stamper.setRotation(-90); await stamper.setTextAlignment(VERTICAL_TEXT_ALIGNMENT_MATRIX[verticalAlignment + 1][horizontalAlignment + 1]); - await stamper.setPosition(10, 20); + await stamper.setPosition(10, 15); break; case 'HORIZONTAL': await stamper.setTextAlignment(HORIZONTAL_TEXT_ALIGNMENT_MATRIX[verticalAlignment + 1][horizontalAlignment + 1]); - await stamper.setPosition(20, 10); + await stamper.setPosition(15, 10); break; case 'DIAGONAL': default: await stamper.setRotation(-45); await stamper.setTextAlignment(DIAGONAL_TEXT_ALIGNMENT_MATRIX[verticalAlignment + 1][horizontalAlignment + 1]); - await stamper.setPosition(20, 10); + await stamper.setPosition(15, 10); } const initialFont = await pdfNet.Font.create(document, convertFont(pdfNet, fontType));