How do I mark sticky notes in PDF as 'open' and automatically show them in PDF viewer control?

Q: How do I mark sticky notes in PDF as ‘open’ and automatically show them in PDF viewer control?

A: The following code to replaces the OpenPDF function in the PDFViewSimple CS project (http://www.pdftron.com/pdfnet/samplecode.html#PDFViewSimple). It iterates through all the sticky notes and marks them for opening.

public bool OpenPDF(String filename)

{
try
{
PDFDoc oldDoc = _pdfview.GetDoc();
_pdfdoc = new PDFDoc(filename);

//////////////////////////////////////////////////////////////////////
// open all sticky notes
int page_count = _pdfdoc.GetPageCount();
// note, page_index begins at 1 and goes to page_count (inclusive)
for (int page_index = 1; page_index <= page_count; ++page_index)
{
Page page = _pdfdoc.GetPage(page_index);
int num_annots = page.GetNumAnnots();
for (int annot_index = 0; annot_index < num_annots; ++annot_index)
{
Annot annot = page.GetAnnot(annot_index);
if (annot.IsValid() == false)
continue;
if (annot.GetType() == Annot.Type.e_Popup)
{
Popup popup = new Popup(annot);
popup.SetOpen(true);
}
}
}
//////////////////////////////////////////////////////////////////////

_pdfview.SetDoc(_pdfdoc);

// Use built-in navigation (thumbnails, bookmarks, layers, etc)?
// _pdfview.ShowNavToolbar(true);
// _pdfview.ShowNavPanel(true);

filePath = filename;
if (oldDoc != null)
{
oldDoc.Dispose();
}
}
catch(PDFNetException ex)
{
MessageBox.Show(ex.Message);
return false;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}

this.Text = filename; // Set the title
return true;
}