Processing multiple actions on bookmarks and links

Q: Using PDFTron , how to identify Bookmark and Links that has multiple action. Please provide us an example. I tried using this code for Links, but it returns null though there is multiple link action.

Obj link_dict = link.GetSDFObj();
Obj additional_actions_dict = link_dict.FindObj(“AA”);

A: You could use Action.GetNext().

The above method returns the next action dictionary, an array of action dictionaries, or NULL if there are no additional actions.

Sequences of actions can be chained together. For example, the effect of clicking a link annotation with the mouse might be to play a sound, jump to a new page, and start up a movie. Note that the Next entry is not restricted to a single action but may contain an array of actions, each of which in turn may have a Next entry of its own. The actions may thus form a tree instead of a simple linked list. Actions within each Next array are executed in order, each followed in turn by any actions specified in its Next entry, and so on recursively.

For example:

bool ProcessAction(Action act) {

if (!act.IsValid()) return false;

Action.Type t = act.GetType();

switch(t) {

case Action.Type.e_GoTo:

{

Destination dest = act.GetDest();

if(dest.IsValid()) {

Page pg = dest.GetPage();

}

}

break;

}

if (!ProcessNextAction(act.GetNext())) {

return false;

}

return true;

}