Reading Weblink from Bookmarks

Hi,

How to read weblinck from bookmarks (e.g - www.google.com). Please find my attachec document containg weblinks .

here is my code

foreach (OutlineItemCollection anItem in pdfDocument.Outlines)
{
//if (anItem.Action != null)
//{

                    OutlineItemCollection bookmark = anItem; // doc.Outlines.First

                    GoToAction goToAction = (GoToAction)bookmark.Action; // if bookmark is GoToAction

                    PdfAction bmaction1 = bookmark.Action;

}
}

But i am getting Action as NULL.BookmarksWithWeblink.pdf (206.5 KB)

@kranthireddyr

Thanks for contacting support.

Please use following code snippet in order to achieve what you require:

Document doc = new Document(dataDir + "BookmarksWithWeblink.pdf");
OutlineCollection outlines = doc.Outlines;
foreach (OutlineItemCollection anItem in outlines)
{
 if (anItem.Action != null)
 {
  if (anItem.Action is GoToURIAction)
  {
    GoToURIAction goToUriAction = (GoToURIAction)anItem.Action;
    Console.WriteLine(goToUriAction.URI);
  }
 }
} 

In case you still face any issue, please feel free to let us know.