# Watermark Annotation

DsPdf is a Document Solutions product that offers a rich library to read, create, modify, and save PDF files without using any external tool.

## Content

A watermark annotation defines graphics that is expected to be printed at a fixed size and position on a page, regardless of the dimensions of the printed page. DsPdf provides [WatermarkAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.WatermarkAnnotation.html) class to enable the users to apply watermark annotations to the PDF file.
![Watermark annotation in a PDF file](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/watermark_1.png)
WatermarkAnnotation class provides the following properties to set various options for the watermark annotation:

| **Property** | **Description** |
| -------- | ----------- |
| HorzTranslate | Sets the amount to translate the associated content horizontally as a percentage of the width of the target media (or, if unknown, the width of the page’s MediaBox). 1.0 represents 100%, and 0.0 represents 0%. Negative values are not recommended since they may cause content to be drawn off the page. |
| Image | Sets the image for watermark annotation. |
| Text | Sets the text for watermark annotation. |
| TextFormat | Sets the formatting of the annotation's text. |
| VertTranslate | Sets the amount to translate the associated content vertically as a percentage of the height of the target media (or, if unknown, the height of the page’s MediaBox). 1.0 represents 100%, and 0.0 represents 0%. Negative values are not recommended since they may cause content to be drawn off the page. |

> !type=note
> **Note:** If both **Text** and **Image** properties are specified, then Image property is used as watermark content.

Refer to the following example code to add a watermark annotation to a PDF document:

```csharp
public void CreateWatermarkAnnotation()
{
    GcPdfDocument doc = new GcPdfDocument();
    var fs = new FileStream(Path.Combine("CompleteJavaScriptBook.pdf"), FileMode.Open, FileAccess.Read);
    doc.Load(fs);  //Load the document

    //Loop over pages, add a watermark to each page:
    foreach (var page in doc.Pages)
    {
        //Create an instance of WatermarkAnnotation class and set its relevant properties
        var watermark = new WatermarkAnnotation()
        {
            PdfRect = new RectangleF(50, 300, 500, 150),
            Image = Image.FromFile("draft-copy.png"),
            Page = page // Add watermark to page                
        };
        doc.Save("WatermarkAnnotation.pdf");
    }

}
```