Problem with PDF Bookmarks

I used the sample code that was given to extract pdf bookmarks. It did not work. I got an error "Object reference not set to an instance of an object."

'create PdfBookmarkEditor
Dim bookmarkEditor As New PdfBookmarkEditor

'open PDF file

bookmarkEditor.BindPdf(Server.MapPath("DevelopersGuide.pdf"))

'extract bookmarks
Dim thebookmarks As Bookmarks

thebookmarks = bookmarkEditor.ExtractBookmarks()

NumberOfBookmarks = thebookmarks.Count

For Each bookmark As Bookmark In thebookmarks

Console.WriteLine("Title: {0}", bookmark.Title)

Console.WriteLine("Page Number: {0}", bookmark.PageNumber)

Next bookmark<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

v

Hi Joseph,

Thanks for using our products.

Can you please share the source PDF document so that we can test the scenario at our end. We apologize for your inconvenience.