Free Support Forum -

How to intend bookmarks?

HI ,

I want to create a child bookmark below the parent bookmark.Could you please let me know how to do that?


Hi Anand,

Thanks for using our products and sorry for replying you late.

In order to create child bookmark, please try using setChilitem(…) method of Bookmark class. Besides this, you may consider first exporting/extracting the Bookmarks into XML format using exportBookmarksToXML(java.lang.String outXMLFile) method of PdfBookmarkEditor class and add child bookmark item in XML file and then import the same XML file to create Bookmarks in same PDF file using importBookmarksWithXML(java.lang.String XMLFile) method of PdfBookrmarkEditor class.

Please take a look over following link to create child bookmarks in existing PDF file.


BookmarkEditor object and bind PDF<o:p></o:p>

com.aspose.pdf.kit.PdfBookmarkEditor editor = new com.aspose.pdf.kit.PdfBookmarkEditor();


//create Bookmark object and set appropriate attributes

Bookmark bm11 = new Bookmark();




//create another bookmark

Bookmark bm1 = new Bookmark();



//create a list and add bookmarks in it

ArrayList aList1 = new ArrayList();



Bookmark bm2 = new Bookmark();



Bookmark bm = new Bookmark();



ArrayList aList = new ArrayList();




//create bookmarks in the PDF file


//save output PDF file"d:/pdftest/testCreateBookmarksOut.pdf");

Hi My requirement is like I am convrting office documents to pdf.I need to merge all thedocument and then have to create a single PDF on that.Then I am bookmarking the document name and thir corresponding page numbers.A document may have a child document.I need to intend those chlid documnent name in the bookmarks.A child document may also have another child document.I need to intend those under the first child document name.Like in below fashion.Please help on how to do that.

Like wise it should go..........

Hi Anand,

Thanks for sharing the details.

We are looking into the details of this requirement and will get back to you soon.

Hi Thank you for the update.Any how i found out a way on how to do this.As you suggested I have framed XML while converting the document to PDF and then imported XML in my converted PDF using importBookmarksWithXML.

Could you please share the XSD pattern alone on how to frame the parent child relationship in XML what are all the nodes ,elements attributes to set.

Hi Anand,

Thanks for your patience.

Please take a look over the following XML structure which shows how Bookmarks (Parent & Child) can be defined in XML file. I have also attached the PDF document which shows how these Bookmarks will appear in PDF file.


<?xml version=“1.0”


<Title Color="0 0 0" Page="0 Fit" Action="GoTo" Open="False">Parent<Title Color="0 0 0" Page="1 FitH 792" Action="GoTo">First Child<Title Color="0 0 0">Second Child


In case I have not properly understood your requirement, please share some further details.

Hi what does that 0 FIT and 1 FITH792 mean?Thank you.

Hi Anand,

Thanks for contacting support and sorry for replying you late.

The value Page=“1 FitH 0” means that Bookmark is pointing to page number 1 and when displaying the respective page, the origin of page should be 0 (display page as normal, complete page is displayed) and if the value is Page=“38 FitH 600”, it means bookmark is pointing to page 38 and when displaying respective page (when bookmark is selected), the origin is shifted to 500 points (around middle of the page. Calculation is performed from bottom of page).

In the event of any further query, please feel free to contact.