Aspose.Pdf.Facades.CreateBookmarks throws null exception

6.8.0.0. Completely unable to use Aspose.Pdf.Facades.CreateBookmarks. Object reference not set to an instance of an object.


Trying to find any workaround for <a href="https://forum.aspose.com/t/98061 because you won’t provide timely support.

So now there’s this bug, and I’m completely unable to add/remove bookmarks. Should be simple.

Hi Tim,

Thank you for using our products.

I tested the scenario with below mentioned source code using Aspose.Pdf for .NET v6.8, I am unable to find any issue in BookMark creation or deletion. Resultant PDF documents are attached for your reference. Kindly use the below code and check if it fits your need.

[Add BookMark]

//open document
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
bookmarkEditor.BindPdf(@"d:\pdffiles\bs.pdf");
//create bookmark of all pages
bookmarkEditor.CreateBookmarks();
//save updated PDF file
bookmarkEditor.Save(@"d:\pdffiles\AddBookMark.pdf");

[Delete BookMark]

//open document
PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
bookmarkEditor.BindPdf(@"d:\pdffiles\AddBookMark.pdf");
//delete bookmark
bookmarkEditor.DeleteBookmarks("Page2");
//save updated PDF file
bookmarkEditor.Save(@"d:\pdffiles\DeleteBookMark.pdf");

Please feel free to contact support in case you face any problem.

Thanks & Regards,

Try using bookmarkEditor.DeleteBookmarks() first. Then what do you get when you try to create?

Hi Tim,

I am able to generate your mentioned issue and your issue is registered in our issue tracking system with issue id: PDFNEWNET-33467. You will be notified via this forum thread regarding any updates against your issue. Also, I have shared a workaround regarding this issue [here](http://www.aspose.com/community/forums/371659/cannot-delete-pages-and-also-bookmarks/showthread.aspx#371659). Please check it and let us know if it fulfills your requirement.

Sorry for the inconvenience,