Text stamps are not added as annotations

Hello,
We are currently trying to extract text from a TextStamp we added onto a document earlier on.
I found a site in the docs that explains how to achieve this: Extract Text From Stamps using C#|Aspose.PDF for .NET

However, the Annotations property on the affected page does not contain the stamp that was added. If the Document is saved to the file system, we can see that it actually contains the stamp (see image).
image.png (6.2 KB)

This simple test to verify the annotations currently fails:

[Fact]
public void InsertTextShape()
{
    // arrange
    var doc = new Document();
    var page = doc.Pages.Add();
    var textStamp = new TextStamp("Hello World!");

    // act
    page.AddStamp(textStamp);
    doc.Save();

    // assert
    page.Annotations.Should().NotBeEmpty("stamps should be readable through annotations");
}

We use Aspose.PDF in version 22.9.0.
Did we misunderstand the way that TextStamps can be extracted from a PDF document or are we doing something wrong?

@markus.estermann

Stamp and Annotation are two different objects. If you want to extract annotations, you need to add text as TextAnnotation. If you are adding TextStamp, it can be extracted using below code snippet:

Facades.PdfContentEditor contentEditor = new Facades.PdfContentEditor();
contentEditor.BindPdf(sourceFile);
Facades.StampInfo[] stamp = contentEditor.GetStamps(1); // 1 is page number
var waterMarkStamp = stamp.FirstOrDefault(x => x.StampId == 1);

Thank you for your help, using the provided snippet we were able to extract the text associated with the TextStamp.

@markus.estermann

It is nice to know that your issue has been resolved. Please keep using our API and feel free to create a new topic in case you need further assistance.