We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to get the page number from a PDF bookmark

How to get the page number from a PDF bookmark?

 

The bookmark destination page number can be found by comparing the document pages and bookmark destination pages.

Please find the following code example and sample for the same:

C#:

//Load the PDF document.

PdfLoadedDocument document = new PdfLoadedDocument("Input.pdf");

 

//Get all the bookmarks.

PdfBookmarkBase bookmarks = document.Bookmarks;

 

//Check the page number of the bookmark

foreach(PdfBookmark bookmark in bookmarks)

{

for(int i=0;i< document.Pages.Count;i++)

{

if(bookmark.Destination.Page==document.Pages[i])

{

Console.WriteLine(bookmark.Title + " Page no is " + (i + 1));

}

}

}

 

//Save and close the document

document.Save("Output.pdf");

document.Close(true);

 

 

Sample link:

http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfSample459633443

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
6101 01/25/2016 01/25/2016 Windows Forms PDF
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.