How do I create a PDF link and set the desination object?

Q:

I am trying to use the destination object to set the page that the
document will open to but it is not clear to me how and I could not
find a sample. Could you please give me a jump start?
------------

A:
// To create a 'goto' link annotation ... in C#
PageIterator itr = doc.PageFind(3); // Link to page #3 in the same PDF
document
if (itr != doc.PageEnd()) {
  Page dest_page = itr.Current();
  Action goto_page_3 =
Action.CreateGoto(Destination.CreateFitH(dest_page, 0));
  Annot link = Annot.CreateLink(doc.GetSDFDoc(), new Rect(85, 458,
503, 502), goto_page_3);
  src_page.AnnotPushBack(link);
}

// To create a 'goto' link annotation ... in C++
PageIterator itr = doc.PageFind(3); // Link to page #3 in the same PDF
document
if (itr != doc.PageEnd()) {
  Page dest_page = *itr;
  Action goto_page_3 =
Action::CreateGoto(Destination::CreateFitH(dest_page, 0));
  Annot link = Annot::CreateLink(doc, Rect(85, 458, 503, 502),
goto_page_3);
  src_page.AnnotPushBack(link);
}

For more examples, please see Annotation sample project:

Q:

This sample inserts a link to go to another page in the same
document. What I want to do is embed in the pdf file instructions for
the reader to open another document at a specified page.
-----

A:
In this case it seems that you need to create a 'remote goto
action' (i.e. GoToR action).

The following sample code shows how to create a GoToR action.

// Create 'relative' FileSpec by hand
Obj file_spec = doc.CreateIndirectDict();
file_spec.Put("Type", Obj.CreateName("Filespec"));
file_spec.Put("F", Obj.CreateString("dest.pdf"));
FileSpec spec = new FileSpec(file_spec);

// The second parameter is the page number... (so, jump to page #5)
Action goto_remote = Action.CreateGotoRemote(spec, 5, true);

Annot link = Annot.CreateLink(doc.GetSDFDoc(), new Rect(85, 458, 503,
502), goto_remote); src_page.AnnotPushBack(link);

Using PDFNet it is also possible to create a 'named' destination in
the destination document, however this would involve editing of the
destination document (if the 'named' destination is not available).