How can I get the FileSpec from the GoToR Action in a Bookmark?

42 views
Skip to first unread message

Aaron Gravesdale

unread,
Apr 11, 2014, 7:16:57 PM4/11/14
to pdfne...@googlegroups.com
Q:

I can add bookmarks containing GoToR actions just fine and they work correctly. However, when I went to adapt your sample code that prints the outline hierarchy, I couldn’t find how to recover the FileSpec from the GoToR Action. What did I miss?


A:

Unfortunately the high-level "PDF" API does not provide a way to get the FileSpec object directly from a GoToR bookmark.  You can, however, get it from the low-level "SDF" API.  For example, to recover the filespec of "remoteBookmark1" in the sample, you could do:

if (remoteBookmark1.GetAction().GetType() == pdftron.PDF.Action.Type.e_GoToR)
{
    Obj value = remoteBookmark1.GetSDFObj().FindObj("A").FindObj("F").Find("F").Value();               
    if (value != null) Console.WriteLine("File spec: " + value.GetAsPDFText());
}
Reply all
Reply to author
Forward
0 new messages