How can I create named destination link for an external PDF document ?

91 views
Skip to first unread message

Support

unread,
Aug 27, 2007, 1:42:35 PM8/27/07
to PDFTron PDFNet SDK
Q:

How can I create named destination link for an external PDF document ?

---
A:

// In C#
NameTree dests = NameTree.Create(remote_doc, "Dests");
Destination dest = Destination.CreateFit(remote_dest_page);
dests.Put("My Key", dest.GetSDFObj());

// In C++
NameTree dests = NameTree::Create(remote_doc, "Dests");
const char* key = "My Key";
Destination dest = Destination::CreateFit(remote_dest_page);
dests.Put((UChar*)key, strlen(key), dest.GetSDFObj());

Since named destinations are often used in conjunction with PDF
Actions, you can also use Action.CreateGoto(...) static method to
create a GoTo action that is using a named destination:

Destination remote_dest = Destination.CreateFit(remote_dest_page);
Action goto_action = Action.CreateGoto("My Key",
remote_dest.GetSDFObj());

To create a 'Remote GoTo' action (i.e. GoToR action) to a named
destination object in a different PDF document, you could use the
following snippet:

Action remote_goto_action = Action.CreateGotoRemote (file_spec,
remote_dest.GetSDFObj());
// Set the destination to be the key of the
// named destination in the remote PDF.
remote_goto_action.Put("D", Obj.CreateString("My Key"));

Reply all
Reply to author
Forward
0 new messages