How to get destination file name of bookmark

Hi Team,

I have pdf bookmark navigating to another pdf file, The action type i was getting is GoToR,
I need to get the file path of the destination.

I got this with hyperlinks by using below code.
string filename = ((Aspose.Pdf.Annotations.GoToRemoteAction)(a.Action)).File.Name;

in the same way i need for bookmark.
string filename = a.RemoteFile;
By using above i am getting file name only, i want entire path.

Waiting for your response.

Thanks,
Harish G

@HarishGali

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PDF document.
  • Please attach the expected output.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

in attached pdf first bookmark has destination to another pdf, and i have also attached image with highlighted file path,

i want code to get the file path into string variable.

i hope you understand what i need.

Thanks,
Capture.PNG (37.3 KB)
pdf-example-bookmarks.pdf (7.9 MB)
Harish G

@HarishGali

Please use the following code example to get the desired output.

// Create PdfBookmarkEditor
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
// Open PDF file
bookmarkEditor.BindPdf(MyDir + "pdf-example-bookmarks.pdf");
// Extract bookmarks
Aspose.Pdf.Facades.Bookmarks bookmarks = bookmarkEditor.ExtractBookmarks();
foreach (Aspose.Pdf.Facades.Bookmark bookmark in bookmarks)
{
    // Get the information related to associated action with bookmark
    Console.WriteLine("Remote File : " + bookmark.RemoteFile);
}

bookmark.RemoteFile
with this i am not getting entire path
please help me to get the path as highlighted in yellow color in image.

@HarishGali

The Bookmark.RemoteFile property returns “/D/process-validation.pdf”. You can remove the first forward slash and replace second one with :\ using .NET APIs.

However, we have logged this problem in our issue tracking system as PDFNET-52096. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

A post was split to a new topic: Unable to get none or other leader options