How do I get bookmark destination filename for a remote PDF bookmark

Q: How do I get bookmark destination filename for a remote PDF
bookmark?
--------
A:

Depending on the type of action that is associated with the bookmark,
you would need to use slightly different API-s.

For example, if the annotation type is 'Action.e_GoTo' you can obtain
the referenced page as follows:

// C#
Destination dest = action.GetDest();
Page page = dest.GetPage();

If the annotation type is 'Action.e_GoToR' (i.e. remote PDF bookmark)
you could obtain the path to referenced external file as follows:

// C#
Destination dest = action.GetDest();
// Get the file specification dict
Obj file_dict = action.GetSDFObj().Get("F").Value();
FileSpec file_spec = new FileSpec(file_dict);
String file_path = file_spec.GetFilePath();
...