Free Support Forum - aspose.com

PdfBookmarkEditor.Dispose disposes the pdf too

Using follwoing code:

var bookmarkEditor = new PdfBookmarkEditor();

bookmarkEditor.BindPdf(_currentPdf);

var bookmarks = bookmarkEditor.ExtractBookmarks();

bookmarkEditor.Close();

bookmarkEditor.Dispose();

will result in _currentPdf being disposed too. Is this an intended behaviour? I would expect _currentPdf not being disposed.

Cheers,

Rob

Hi Rob,


Thanks for your inquiry. while disposing off bookmarkEditor object it will dispose off only its own resources not _currentPdf stream. Please share some more details, If there is any difference in my understanding and your query.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Rob,


Thanks for contacting support and sorry for the delayed response.

Adding more to Tilal’s comment, when calling Close(…) method of bookmarkEditor class, the source/input document is also released. Besides this, you may consider using OutlineItemCollection class to deal with bookmarks. The new Document Object Model (DOM) offered by Aspose.Pdf namespace does not close the input PDF file. For further information, please visit Working with Bookmarks

In case I have not properly understood the problem, please share some details. We are sorry for this inconvenience.

Thanks for the information. I justed wanted to clarify if the behaviour was by design.

Cheers,

Rob