DEV Community

Atir Tahir
Atir Tahir

Posted on • Updated on

Adding text or image watermark programmatically

Have a look at these supported file formats. Yes, you can add watermark (image or text) to all of them programmatically.
Have a look at the following code, it adds a text watermark with a specific font-family and size.

using (Watermarker watermarker = new Watermarker("sample.pdf"))
    TextWatermark watermark = new TextWatermark("top secret", new Font("Arial", 36));
    watermark.ForegroundColor = Color.Red;
    watermark.HorizontalAlignment = HorizontalAlignment.Center;
    watermark.VerticalAlignment = VerticalAlignment.Center;
Enter fullscreen mode Exit fullscreen mode

For further details, please visit this documentation article and in case of any issue, you can post it here.

Top comments (0)