# Stamps

Stamps in DsPdf helps in applying branding, and indicating the status of documents. Learn how to create, delete, and modify stamps in docs.

## Content

Stamps are generally used to personalize, apply branding, and indicate status of the documents, which can be easily moved and modified. A stamp annotation is intended to look as if it is stamped on the page with a rubber stamp just like conventional paper documents. On clicking, it displays a pop-up window containing the text of the associated note. For more information on stamp annotation, refer to PDF Specification 2.0 (Section 12.5.6.12).
DsPdf allows you to add stamps to a PDF document, using [StampAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.StampAnnotation.html) class. These stamps are text stamp and image stamp. Text stamp allows you to add page numbers, text, and dynamic text stamps like Date, Time, Author to the document. On the other hand, image stamps allow you to add images as stamps and create stamps from PDF, JPG, JPG2000, BMP, and PNG files. The library also lets you to specify possible icons, such as "Confidential", "Departmental", etc., to display the stamps using [Icon](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.StampAnnotation.Icon.html) property of StampAnnotation class, which takes the value from [StampAnnotationIcon](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.StampAnnotationIcon.html) enum.
![PDF Stamps](https://cdn.mescius.io/document-site-files/images/884d2bfb-301b-49bc-8d90-656c5b910507/images/stamps.png)

## Add Stamp

To add a stamp in a PDF document, use the StampAnnotation class. The StampAnnotation class provides the essential properties for creating an image or text stamp that looks similar to a rubber stamp.
To add a stamp:

1. Create an object of [GcPdfDocument](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.GcPdfDocument.html) and [StampAnnotation](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.StampAnnotation.html) class.
2. Set the required properties of StampAnnotation object.
3. Call the **Add** method to add the stamp on the page.

    ```csharp
    public void CreatePDF(Stream stream)
    {
        GcPdfDocument doc = new GcPdfDocument();
        var page = doc.NewPage();
    
        //Add Stamp
        var stamp = new StampAnnotation()
        {
            Contents = "This is a sample stamp",
            Color = Color.Aqua,
            Icon = StampAnnotationIcon.Confidential.ToString(),
            CreationDate = DateTime.Today,
            Rect = new RectangleF(100.5F, 110.5F, 72, 72),
        };
    
        // Add stamp to page
        page.Annotations.Add(stamp);
        //Save Document
        doc.Save(stream);
    }
    ```

## Modify Stamp

To modify stamp annotation, you can set the properties of stamp annotation you used on a page. For instance, setting [Contents](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.AnnotationBase.Contents.html) property of [AnnotationBase](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.AnnotationBase.html) class and [Color](/document-solutions/dot-net-pdf-api/api/online/DS.Documents.Pdf/GrapeCity.Documents.Pdf.Annotations.MarkupAnnotation.Color.html) property of the StampAnnotation class modifies the existing content and color of the annotation.

```csharp
stamp.Contents = "Draft Copy";
stamp.Color = Color.Red;
```

## Delete Stamp

To delete a particular stamp annotation in PDF document, use [RemoveAt](https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.collection-1.removeat?view=netframework-4.8) method to remove the stamp by specifying its index value. Apart from this, [Clear](https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.collection-1.clear?view=netframework-4.8) method can be used to remove all the stamp annotations from the document.

```csharp
// Delete a particular stamp annotation
page.Annotations.RemoveAt(0);

// Delete all stamp annotations
page.Annotations.Clear();
```

For more information about implementation of stamps using DsPdf, see [DsPdf sample browser](https://developer.mescius.com/documents-api-pdf/demos/basics/annotations/stamp-image/code-cs).