Bookmarking

Hello,

I am having a problem with Aspose.Pdf.Kit. If I call

PdfContentEditor::CreateBookmarkOfPage multiple times, only the last bookmark is created. If I call CreateBookmarkOfPage with arrays as parameters I get the same result.

-Philip

Dear Philip,

Thank you for considering Aspose.

We will test it and reply you ASAP.

Best regards.

Hi Philip,

Would you please provide whole code segment which can reproduce the same error?

It is very helpful to make problems solution easier.

I was incorrect in my statement of the problem if I call it multiple times. If I call it multiple times I get a "Stream was not readable." If I pass it two arrays then only the last one shows up. Here is the code. I'm not including the entire thing because there is quite a bit of processing before I do the bookmarking. combinedStream is a stream containing a pdf file. bookmarks.Names is an array of strings and bookmarks.PageNumbers is an array of page numbers. Both contain the desired values.

MemoryStream outStream = new MemoryStream();

PdfContentEditor editor = new PdfContentEditor();

combinedStream.Seek(0, SeekOrigin.Begin);

editor.BindPdf(combinedStream);

//editor.CreateBookmarkOfPage(bookmarks.Names, bookmarks.PageNumbers);

for (int x = 1; x < 5; x++)

{

editor.CreateBookmarkOfPage(x.ToString(), x);

}

editor.Save(outStream);

Dear philip,

now ,the interface CreateBookmarkOfPage(String bookmarkName, int pageNumber) does not support to be called multiple times to a pdf document ,we'll modified it,but you can use CreateBookmarkOfPage(String [] bookmarkName, int []pageNumber) to achieve your task,i will solution your problem as soon as possible,Would you please provide the pdf document to be added bookmarks,It can help me to make problems solution .

Best regards.


Allen wen
Developer
Aspose Changsha Team
About Us
Contact Us

Hello Allen,

I have already tried CreateBookmarkOfPage(String [] bookmarkName, int []pageNumber) with bad results. I have created a test case for my problems.

PdfContentEditor editor = new PdfContentEditor();

editor.BindPdf("input.pdf");

string[] names = { "ABC", "DEF" };

int[] pageNumbers = { 1, 2 };

editor.CreateBookmarkOfPage(names, pageNumbers);

editor.Save("output.pdf");

The problem is that there is only 1 bookmark created. "DEF" on page 2. I have attached the input file I"m using. I am using Aspose.Pdf.Kit version 2.1.3.0. Thanks

-Philip

Hi Philip,

The error has been reproduced on my machine. We will try to get it fixed ASAP.

Hi, Philip

The bug has been fixed and we will release a new version in one or two days.

Best regards.