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

Free Support Forum - aspose.com

Hierarchical Bookmarks after merging multiple PDF

Hello,

I try AsposePDF to merge multiple PDF files. PDF files are arranged like a tree, and I need to create Bookmarks to represent this tree, that means several levels of child bookmarks pointing on nearly each PDF file.

I first concatenate all PDF files, performance is really nice! During this I stock in memory (array) what I need to create Bookmarks. I want to loop on the array to build my bookmarks but the result is not right. I only see the last bookmark added to the Outlines.

For example, I want to obtain the bookmarks following :

+ France

- Aquitaine

> martin

- Bretagne

> maxime

- Charente

> julien

I use this simplify code:

OutlineItemCollection pdfOutlineAsset = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineAsset.setTitle("France");

pdfOutlineAsset.setBold(true);

pdfOutlineAsset.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(9)));

OutlineItemCollection pdfOutlineGis = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineGis.setTitle("Aquitaine");

pdfOutlineGis.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(11)));

OutlineItemCollection pdfOutlineRes = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineRes.setTitle("martin");

pdfOutlineRes.setItalic(true);

pdfOutlineRes.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(13)));

OutlineItemCollection pdfOutlineGis2 = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineGis2.setTitle("Bretagne");

pdfOutlineGis2.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(14)));

OutlineItemCollection pdfOutlineRes2 = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineRes2.setTitle("maxime");

pdfOutlineRes2.setItalic(true);

pdfOutlineRes2.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(16)));

OutlineItemCollection pdfOutlineGis3 = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineGis3.setTitle("Charente");

pdfOutlineGis3.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(17)));

OutlineItemCollection pdfOutlineRes3 = new OutlineItemCollection(monPdf.getOutlines());

pdfOutlineRes3.setTitle("julien");

pdfOutlineRes3.setItalic(true);

pdfOutlineRes3.setAction(new com.aspose.pdf.GoToAction(monPdf.getPages().get_Item(19)));

pdfOutlineGis.add(pdfOutlineRes);

pdfOutlineGis2.add(pdfOutlineRes2);

pdfOutlineGis3.add(pdfOutlineRes3);

pdfOutlineAsset.add(pdfOutlineGis);

pdfOutlineAsset.add(pdfOutlineGis2);

pdfOutlineAsset.add(pdfOutlineGis3);

monPdf.getOutlines().add(pdfOutlineAsset); //mon pdf is my PDF Document

I obtain this instead of what I expect:

+ France

- Charente

> julien

I dont't understand why I lost elements... Can you explain me please?

Hi Karine,

We are sorry for the inconvenience caused. While testing the scenario with the latest version of Aspose.Pdf for Java 9.1.0, we have managed to reproduce the reported issue and logged it in our bug tracking system as PDFNEWJAVA-34243 for further investigation and resolution. We will notify you via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-34243) have been fixed in Aspose.Pdf for Java 9.3.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.