watermark further fixes
This commit is contained in:
parent
0d4178a0b5
commit
8d621bc8a2
@ -137,19 +137,19 @@ export class WatermarkScreenComponent implements OnInit {
|
||||
private _drawWatermark() {
|
||||
const lines = this.configForm.get('text').value.split('\n');
|
||||
const fontSize = this.configForm.get('fontSize').value;
|
||||
const lineHeight = fontSize + 10;
|
||||
const lineHeight = fontSize + 4;
|
||||
|
||||
this._instance.docViewer.setWatermark({
|
||||
custom: (ctx, pageNumber, pageWidth, pageHeight) => {
|
||||
ctx.fillStyle = this.configForm.get('hexColor').value;
|
||||
ctx.font = `${fontSize}pt Times`;
|
||||
ctx.font = `${fontSize}pt Arial`;
|
||||
ctx.globalAlpha = this.configForm.get('opacity').value / 100;
|
||||
|
||||
for (let idx = 0; idx < lines.length; ++idx) {
|
||||
ctx.save();
|
||||
ctx.translate(pageWidth / 2 - (lineHeight * (lines.length - 1)) / 4, pageHeight / 2 - (lineHeight * lines.length) / 2);
|
||||
ctx.rotate(-Math.PI / 4);
|
||||
ctx.translate(-40, 0);
|
||||
ctx.translate(0, 10);
|
||||
ctx.fillText(lines[idx], 0, idx * lineHeight);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user