# Setting the action on a bookmark within a PDF document

Q: I am trying to modify the action on bookmarks within a document but
having difficulty with the code. The select action is ' Go to a page
within this document'. The action that is added is Open a file and
then a file path is specified. I need to access the filepath
properties to modify this but is unable to do so.
-----
A: The simplest way to change a bookmark action would be to call
bookmark.SetAction() using a new action. For example:

// To create a UTR Action....
bookmark.SetAction(Action.CreateURI("http://www.pdftron.com/"));

// To create an intra-document GoTo action (to page number 3)...
bookmark.SetAction(Action.CreateGoto(Destination.CreateFitH(doc.GetPage(3),
0)));

// To create a remote GoTo action (i.e. a GoToR action)....

// Create file specification dictionary by hand (the file referred to
by the remote bookmark)
Obj file_spec = doc.CreateIndirectDict();
file_spec.Put("Type", Obj.CreateName("Filespec"));
file_spec.Put("F", Obj.CreateString("bookmark.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);

bookmark.SetAction(goto_remote);