I\'m trying to check if a page in a pdf file has a bookmark and what is in that bookmark, I\'m using \"iTextSharp.text.pdf\" for reading and manipulating a pdf, but I can\'t fin
IList<Dictionary<string, object>> bookmarks = SimpleBookmark.GetBookmark(pdfReader);
foreach (Dictionary<string, object> bk in bookmarks)
{
string bjj = bk.Values.ToArray().GetValue(0).ToString();
Use This.
You can extract the page for each bookmark from the Page key in each bookmark dictionary.
For example:
public bool isBookmarked(string pdfSourceFile, int pageNumber)
{
var reader = new PdfReader(pdfSourceFile, new System.Text.ASCIIEncoding().GetBytes(""));
var bookmarks = SimpleBookmark.GetBookmark(reader);
foreach (var bookmark in bookmarks)
if (Int32.Parse(bookmark["Page"].ToString().Split(' ')[0]) == pageNumber)
return true;
return false;
}