Stamp Annotations

To create a stamp programmatically, instantiate a Stamp object just like any other annotation type and then call CreateAnnotationAsync on a Document:

Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var approvedStamp = new Stamp
{
    BoundingBox = new Rect(10, 10, 400, 200),
    StampType = StampType.Approved
};

await pdfView.Document.CreateAnnotationAsync(approvedStamp);

var customStamp = new Stamp
{
    BoundingBox = new Rect(10, 300, 400, 200),
    StampType = StampType.Custom,
    Title = "A Title",
    Subtitle = "A Subtitle",
    Note = "A Note"
};

await pdfView.Document.CreateAnnotationAsync(customStamp);

You can also create a stamp from Instant JSON:

Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
    "bbox": [
        10,
        10,
        400,
        200
    ],
    "stampType": "Custom",
    "opacity": 1,
    "pageIndex": 0,
    "subtitle": "5/16/13, 10:34 AM",
    "title": "Custom Stamp",
    "type": "pspdfkit/stamp",
    "v": 1
}
Copy
1
2
3
var stampJson = LoadJsonObjectAsync("myStamp.json");
var stamp = PSPDFKit.Pdf.Annotation.Factory.FromJson(stampJson);
await pdfView.Document.CreateAnnotationAsync(stamp);