Please consult the official documentation.
Bookmarks are discussed in Chapter 7 where you'll find the BookmarkedTimeTable example. As you're working with iTextSharp (C#), not iText (Java), you'll want to look up the corresponding example in the list of examples ported to C#, more specifically BookmarkedTimeTable.cs.
Update after you updated the question:
Your error indicates that testdata
isn't really of type IList<Dictionar(string,object)>
; note that I've added a g to strin assuming that this is a typo in your question, not in your actual code.
Please start with the example from my book, and then change that example gradually until you break that code.
Update based on extra comment:
When a PDF is digitally signed, there is a limited number of operations that may (or may not) be allowed. See Which operations are allowed on a digitally signed PDF? Adding bookmarks is not an allowed operation, so you'll have to remove all signature fields before applying the change. Depending on whether or not you want to keep the empty signature field or completely remove the field, you'll use either the method clearSignatureField()
or removeField()
passing the name of a signature field as parameter. You can get an ArrayList
of names using the getSignatureNames()
method (see ÀcroFields
).