RED-3800 update watermark paddings
This commit is contained in:
parent
11f5fe79cf
commit
bc947d2407
@ -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,
|
||||
|
||||
@ -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));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user