We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot process muliple tasks with PdfContentEditor

Hello,

I believe this is a bug as no error is generated and I'm not getting the results I would expect.

I'm trying to CreateBookmarks and CreateLocalLinks, but I cannot do this without first saving and re-binding a pdf file.

This code will create bookmarks, but not the link:

PdfContentEditor editor = new PdfContentEditor();

editor.BindPdf(this.textBoxOutputFolder.Text);

editor.CreateLocalLink(new Rectangle(0, 0, 200, 200), 2, 1, Color.Green);

editor.CreateBookmarks();

editor.Save("c:\\tfs\\test.pdf");

This code will create the link, but not the bookmarks.

PdfContentEditor editor = new PdfContentEditor();

editor.BindPdf(this.textBoxOutputFolder.Text);

editor.CreateBookmarks();

editor.CreateLocalLink(new Rectangle(0, 0, 200, 200), 2, 1, Color.Green);

editor.Save("c:\\tfs\\test.pdf");

To get around the problem I'm first creating the bookmarks, saving then re-binding and adding the links and saving again. Can only 1 type of task be done per PDF Bind/save or is this a bug?

Thanks,

Chris

Hi,

We are sorry for the inconveniece. Now, in the PdfContentEditor class, the functions of creating bookmarks can not be used with other functions at the same time. the right code is as below:

PdfContentEditor editor = new PdfContentEditor();

editor.BindPdf(this.textBoxOutputFolder.Text);

MemoryStream ms=new MemoryStream();

//multi functions can be used in the same time

editor.CreateLocalLink(new Rectangle(0, 0, 200, 200), 2, 1, Color.Green);

editor.CreateWebLink(rect, "http://www.aspose.com", 2);

editor.Save(ms);

PdfContentEditor editor1 = new PdfContentEditor();

editor1.BindPdf(ms);

//multi functions can be used in the same time

editor1.CreateBookmarks();

editor1.Save("c:\\tfs\\test.pdf");

In order to not puzzled user, next, we plan to design a new class to process bookmark. That is to say, the functions of creating bookmark will be separated from the PdfContentEditor class.

I thought that was probably the case.

Thanks!