How do I update hyperlinks within a PDF page?

Q: How do I update hyperlinks within a PDF page?
-------
A: You can update hyperlinks (and other annotations) in existing PDF
documents along the lines of AnnotationHighLevelAPI in Annotation
sample project: http://www.pdftron.com/net/samplecode.html#Annotation

For example,

... init PDFNet, open doc...
Page page = doc.GetPage(1);
int num_annots = page.GetNumAnnots();
for (int i=0; i<num_annots; ++i) {
  Annot annot = page.GetAnnot(i);
  if (annot.IsValid() == false) continue;
  if (annot.GetType() == Annot.Type.e_Link) {
    Action action = annot.GetLinkAction();
    if (action.Isalid() && action.GetType() == Action.Type.e_URI) {
       // String old_uri =
action.GetSDFObj().Get("URI").Value().GetAsPDFText();
       action.SetLinkAction(Action.CreateURI(doc, "http://
www.pdftron.com"));
    }
  }
}
... save pdf...

Q: Thanks for your reply. I already tried the code which you sent me.
But this is detecting only those annotations which I created. I mean
in the attached sample file there is one hyperlink "http://foo.com"
which is not detected by the GetNumAnnots() or GetAnnot(). Perhaps
that is different object and not annotation. Can you help me how to
change the target URL of that hyperlink?
-----
A: You are right. The link in this PDF is not a hyperlink annotation.
Although it looks like a hyperlink it is a regular text with a line
draw underneath. You could use TextExtractor class to extract and
recognize this type of links.