How do I create caret and pop-up annotation in PDF ?

Q: I’m interested in using your pdfnet api and am evaluating it. I
need to insert a caret and a text insert popup in a specific location
of a pdf file, to indicate some text that I want to include. I can do
this in Adobe Acrobat Standard, and I’m certain pdfnet can do it too.
Please send sample code that can produce the following file output
from the input file. I’m coding in C#.NET. Thanks!
-----------
A: You could use the following code to create a caret and a pop-up
annotation:

int x = 282;
int y = 388;
Caret crt = pdftron.PDF.Annots.Caret.Create(doc, new Rect(x, y, x+10, y
+15) );
crt.SetColor( new ColorPt( 1, 0, 0 ) ); // change caret's color to
red
crt.RefreshAppearance(); // this gives caret a default appearance, you
also
// have the option of generating your own appearance stream if you
want to

// create a 'pop-up' annotation associated with the caret.
Popup pop = pdftron.PDF.Annots.Popup.Create(doc, new Rect(x+50, y+20, x
+150, y+80));
pop.SetParent(crt);
crt.SetPopup(pop);

// Add annotations to the page.
page.AnnotPushBack(crt);
page.AnnotPushBack(pop);

... view refresh ? pdfview.UpdateAnnot/Rect()

You will notice that PDFViewSimple project includes a number of built-
in tools (which include ‘caret’ and pop-up create tool-modes) for
which you don't need to write any code. If built-in tools are not
doing exactly what you are looking for, you can also write your own
tools.