Defines the rotation angle of the watermark. A positive value corresponds to a clockwise rotation angle, negative - to a counterclockwise rotation angle.
Specifies the vertical coordinate of the watermark within the parent document.
The code below demonstrates how to specify the desired watermark appearance and position before applying it to the document:
usingGroupDocs.Watermark;usingGroupDocs.Watermark.Common;usingGroupDocs.Watermark.Watermarks;// Specify an absolute or relative path to your document.using(Watermarkerwatermarker=newWatermarker("C:\\Docs\\sample.docx")){// Specify the desired text and font for the watermarkTextWatermarkwatermark=newTextWatermark("Customized watermark.",newFont("Arial",24,FontStyle.Bold));// Specify the appearance and the position of the watermarkwatermark.ForegroundColor=Color.DarkOrange;watermark.ConsiderParentMargins=true;watermark.HorizontalAlignment=HorizontalAlignment.Center;watermark.VerticalAlignment=VerticalAlignment.Top;watermark.SizingType=SizingType.ScaleToParentDimensions;watermark.RotateAngle=45;watermark.ScaleFactor=0.7;// Apply the watermarkwatermarker.Add(watermark);// Save the resulting documentwatermarker.Save("C:\\Docs\\watermarked-sample.docx");}
Run the program. A watermark will be added at a specified position and will have the specified look.
Customizing image watermarks
Image watermarks have similar settings that affect their look and position. To adjust an image watermark, use the properties of the ImageWatermark class.
Defines the rotation angle of the watermark. A positive value corresponds to a clockwise rotation angle, negative - to a counterclockwise rotation angle.
Specifies the vertical coordinate of the watermark within the parent document.
The code below demonstrates how to specify the desired watermark appearance and position before applying it to the document:
usingGroupDocs.Watermark;usingGroupDocs.Watermark.Common;usingGroupDocs.Watermark.Watermarks;// Specify an absolute or relative path to your document.using(Watermarkerwatermarker=newWatermarker("C:\\Docs\\seagull.jpg")){// Specify the desired text and font for the watermarkImageWatermarkwatermark=newImageWatermark("C:\\Docs\\greetings-stamp.png");// Specify watermark position, rotation and opacitywatermark.HorizontalAlignment=HorizontalAlignment.Right;watermark.VerticalAlignment=VerticalAlignment.Top;watermark.RotateAngle=15;watermark.IsBackground=false;watermark.Opacity=0.8;// Apply the watermarkwatermarker.Add(watermark);// Save the resulting documentwatermarker.Save("C:\\Docs\\custom-image-watermark.jpg");}
Run the program. An image watermark will be added at a specified position.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.