Free Support Forum - aspose.com

ChildItem.Add - bookmark

Hi,

Why is the following code not working?

Dim parentbookmark As New Aspose.Pdf.Kit.BookMark

Dim childbookmark As New Aspose.Pdf.Kit.BookMark

parentbookmark.PageNumber = 1

parentbookmark.Title = "Parent"

childbookmark.PageNumber = 2

childbookmark.Title = "Child"

parentbookmark.ChildItem.Add(childbookmark)

'after the last line I get an NullReferenceExeption, but why?

Thanks,

Daniel

Hi Daniel,

Thank you very much for considering Aspose.

I have tried the following code snippet and it worked perfectly fine at my end.


Dim editor As New Aspose.Pdf.Kit.PdfBookMarkEditor

editor.BindPdf(“input.pdf”)


Dim parentbookmark As New Aspose.Pdf.Kit.BookMark

Dim childbookmark As New Aspose.Pdf.Kit.BookMark


parentbookmark.PageNumber = 1

parentbookmark.Title = “Parent”


childbookmark.PageNumber = 2

childbookmark.Title = “Child”


Dim bms As New Aspose.Pdf.Kit.BookMarks()

bms.Add(childbookmark)



parentbookmark.ChildItem = bms


editor.CreateBookmarks(parentbookmark)

editor.Save(“output.pdf”)




Please try this at your end. In case, you find any further questions, or have some issue please do let us know.
Regards,

Thanks for your response,

I just wondering why the bookmark object has the methode "ChildItem.add(Bookmark)" when it doesen´t work.

Hi Daniel,

We’re sorry for the inconvenience.

I have logged the issue with ChildItem.Add method as PDFKITNET-11413 in our issue tracking system. Our team will be looking into the matter and you’ll be updated via this forum as the issue is resolved.

We appreciate your patience.
Regards,

The issues you have found earlier (filed as 11413) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.