My requirement is same as described in this question: Bookmark to specific page using iTextSharp 4.1.6
I tried the answer, but the last line gives my the following error:
Can not implicitly convert
ArrayList
toIList<Dictionar(strin,object)>
I am not sure how to correct it.
The line that gave error is, in the Answer 1 of above link
wri.Outlines = bookmarks
I modified the example like this:
List<Dictionary<string, object>> testData = new List<Dictionary<string, object>>(100);
// Just Sample data for understanding.
//for (int i = 0; i < 100; i++)
//{
var test = new Dictionary<string, object>
{
{ "Action", "GoTo"},
{ "Title", "Page1 0 H 0" },
{"Page", "1 XYZ 0 " + h + " 0" }
};
testData.Add(test);
//}
wri.Outlines = testData;
Now after adding the bookmarks, I'm unable to open the PDF because the file has been corrupted.