mirror of
https://github.com/alam00000/bentopdf.git
synced 2026-11-08 08:52:28 +01:00
Position of watermark text now calculated in polar coordinates
Watermark text will now appear to rotate around the page centre, rather than at the bottom corner of the text element.
This commit is contained in:
1 parent
75df8a48cb
commit
5e66d42f59
1 file changed
+2
-2
@@ -178,8 +178,8 @@ async function addWatermark() {
|
||||
const textWidth = watermarkAsset.widthOfTextAtSize(text, fontSize);
|
||||
|
||||
page.drawText(text, {
|
||||
x: (width - textWidth) / 2,
|
||||
y: height / 2,
|
||||
x: (width / 2) - ((textWidth / 2) * Math.cos(angle * Math.PI / 180)),
|
||||
y: (height / 2) - ((textWidth / 2) * Math.sin(angle * Math.PI / 180)),
|
||||
font: watermarkAsset,
|
||||
size: fontSize,
|
||||
color: rgb(textColor.r, textColor.g, textColor.b),
|
||||
|
||||
Reference in new issue
Block a user