How do I create a sticky note annotation?

Q: How do I create a sticky note annotation? I can see the
pdftron.PDF.Annots.Text class for creating sticky notes, but I can't
find any sample code anywhere. Any sample code would be greatly
appreciated.
------
A: You can create a sticky note annotation as follows (C++ and C#
pseudo code):

//------------------------------------------------------
Text txt = pdftron::PDF::Annots::Text::Create(doc, Rect(161, 388, 180,
406), "Hello World");

// Create the icon for the sticky note. We used some hardcoded values
copied using CosEdit
// You could also use ElementBuilder/ElementWriter to programatically
create the stream.
const char* app_data = "0 G 1 1 0 rg 0 i 0.60 w 4 M 1 j 0 J []0 d
19.62 7.52 m 19.62 5.72 18.12 4.26 16.28 4.26 c 9.07 4.25 l 4.93 0.32
l 6.03 4.26 l 3.70 4.26 l 1.86 4.26 0.36 5.72 0.36 7.52 c 0.36 14.37 l
0.36 16.17 1.86 17.63 3.70 17.63 c 16.28 17.63 l 18.12 17.63 19.62
16.17 19.62 14.37 c 19.62 7.52 l h B 0 g 3.87 14.41 m 3.70 14.41 3.57
14.28 3.57 14.11 c 3.57 13.95 3.70 13.81 3.87 13.81 c 16.10 13.81 l
16.27 13.81 16.41 13.95 16.41 14.11 c 16.41 14.28 16.27 14.41 16.10
14.41 c 3.87 14.41 l h f 3.87 11.23 m 3.70 11.23 3.57 11.10 3.57 10.93
c 3.57 10.76 3.70 10.63 3.87 10.63 c 16.10 10.63 l 16.27 10.63 16.41
10.76 16.41 10.93 c 16.41 11.10 16.27 11.23 16.10 11.23 c 3.87 11.23 l
h f 3.87 8.05 m 3.70 8.05 3.57 7.91 3.57 7.75 c 3.57 7.58 3.70 7.45
3.87 7.45 c 12.84 7.45 l 13.01 7.45 13.15 7.58 13.15 7.75 c 13.15 7.91
13.01 8.05 12.84 8.05 c 3.87 8.05 l h f";

Obj app = doc.CreateIndirectStream(app_data, strlen(app_data));
app.PutRect("BBox", 0, 0, 20, 18); app.PutName("Subtype", "Form");
app.PutName("Type", "XObject"); txt.SetAppearance(app);

// Create a 'pop-up' annotation associated with the sticky note.
Popup pop = Popup::Create(doc, Rect(272, 300, 450, 450)); pop.SetParent
(txt); txt.SetPopup(pop);

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

// Using C# (very similar to the above...)
//------------------------------------------------------
Text txt = pdftron.PDF.Annots.Text.Create(doc, new Rect(161, 388, 180,
406), "Hello World"); Obj app = doc.CreateIndirectStream(new
System.Text.UTF8Encoding().GetBytes(app_data));
app.PutRect("BBox", 0, 0, 20, 18);
app.PutName("Subtype", "Form");
app.PutName("Type", "XObject");
txt.SetAppearance(app);

// Create a 'pop-up' annotation associated with the sticky note.
Popup pop = pdftron.PDF.Annots.Popup.Create(doc, new Rect(272, 300,
450, 450)); pop.SetParent(txt); txt.SetPopup(pop);

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

//------------------------------------------------------

If you are implementing a new tool mode (i.e. 'create sticky note
tool') in PDFView class you should call view.Update() or view.Update
(txt) to refresh the area of the page covered with the new annotation.