# Stamp 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 stamp annotation displays graphics, images, or texts to look as if they were stamped on a page. Upon opening, the stamp annotations display a pop-up window with the text of the associated note. DsPdf provides [StampAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.StampAnnotation.html) class to enable users to apply stamp annotations to the PDF file.
![Stamp annotation in a PDF file](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/stampannotation_again.png)
StampAnnotation class provides the following members to set various options for the stamp annotation:

| **Member** | **Description** |
| ------ | ----------- |
| UserName | Adds the user name to the text label in the title bar of the annotation’s pop-up window when the annotation is open and active. |
| Subject | Adds the text representing the subject of the annotation. |
| Contents | Adds the text to the annotation for display. |
| RichText | Adds the text to the annotation for display in the pop-up window when opened. You can format this text using HTML tags. |
| Opacity | Sets the opacity of the annotation. |
| Icon | Sets a string specifying the name of an icon used to display the annotation. The PDF specification provides a predefined set of icons; those are provided by the [StampAnnotationIcon](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.StampAnnotationIcon.html) enumeration. |
| RotateContent | Rotates the annotation content by the specified angle. Positive values indicate a counterclockwise rotation. |
| BorderWidth | Sets the border width. |
| Color | Sets the annotation color, popup window color, line color, etc. |
| Font | Sets a font to draw the stamp. |
| PdfRect | Sets the rectangle that defines the location and size of the annotation on a page in PDF user space coordinates. The positive X axis extends horizontally to the right, and the positive Y axis extends vertically upward, with the origin usually in the lower left corner of the page. |

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

```csharp
public void CreateStampAnnotation()
{
    GcPdfDocument doc = new GcPdfDocument();
    var page = doc.NewPage();

    //Create an instance of StampAnnotation class and set its relevant properties
    var stamp = new StampAnnotation()
    {
        Contents = "This is a sample stamp",
        UserName = "Jamie Smith",
        Color = Color.SkyBlue,
        Icon = StampAnnotationIcon.Confidential.ToString(),
        CreationDate = DateTime.Today,
        PdfRect = new RectangleF(100.5F, 110.5F, 72, 72),
    };

    page.Annotations.Add(stamp); //Add the stamp annotation
    doc.Save("StampAnnotation.pdf");
}
```