Fixed diagonal watermark
This commit is contained in:
parent
4cc98cd2c7
commit
3d211dc0d4
@ -18,7 +18,7 @@ export const DEFAULT_WATERMARK: WatermarkModel = {
|
||||
opacity: 70,
|
||||
fontSize: 11,
|
||||
fontType: 'sans-serif',
|
||||
orientation: 'DIAGONAL'
|
||||
orientation: WatermarkModel.WatermarkOrientationEnum.DIAGONAL
|
||||
};
|
||||
|
||||
@Component({
|
||||
@ -145,12 +145,12 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
const lines = text.split('\n');
|
||||
const fontSize = this.configForm.get('fontSize').value;
|
||||
const fontType = this.configForm.get('fontType').value;
|
||||
const orientation = this.configForm.get('orientation').value;
|
||||
const orientation: WatermarkModel.WatermarkOrientationEnum = this.configForm.get('orientation').value;
|
||||
const lineHeight = fontSize + 4;
|
||||
const opacity = this.configForm.get('opacity').value;
|
||||
const color = this.configForm.get('hexColor').value;
|
||||
|
||||
if (orientation === 'ROTATE_LEFT_45_DEG') {
|
||||
if (orientation === WatermarkModel.WatermarkOrientationEnum.DIAGONAL) {
|
||||
this._instance.docViewer.setWatermark({
|
||||
diagonal: {
|
||||
text,
|
||||
@ -169,10 +169,10 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
|
||||
for (let idx = 0; idx < lines.length; ++idx) {
|
||||
ctx.save();
|
||||
if (orientation === 'HORIZONTAL') {
|
||||
if (orientation === WatermarkModel.WatermarkOrientationEnum.HORIZONTAL) {
|
||||
ctx.translate(pageWidth / 2, pageHeight / 2 - (lineHeight * lines.length) / 2);
|
||||
}
|
||||
if (orientation === 'VERTICAL') {
|
||||
if (orientation === WatermarkModel.WatermarkOrientationEnum.VERTICAL) {
|
||||
ctx.translate(pageWidth / 2, 0);
|
||||
ctx.rotate(-Math.PI / 2);
|
||||
ctx.translate(-pageHeight / 2, -(lineHeight * lines.length) / 2);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user