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

Free Support Forum - aspose.com

Bookmark levels

We are creating training materials. Our source docs are Word files. From these, we are using Aspose to generate different pdf documents. I am creating bookmarks for each of the Headings in the Word document. The headings have different levels (as most docs, a tree structure).
The problem is, when the pdf is created, all the bookmarks are at the same top level.
Is there a way to set up the bookmarks so the tree structure of the document is shown in the bookmarks of the pdf document?

Hi Brad,
Thanks for your inquiry.
You can skip the need to manually insert bookmarks around your heading by marking them using Heading styles instead. You should then specify the HeadingOutlineLevels property of the PdfSaveOptions class.
If it still is not working as expected, could you please attach your template here for testing?

Hi Brad,
This is just to make sure you received a notification after Adam has edited his reply to your bookmarks in PDF question.

I am attaching a simple test site (didn’t add bin dir). I have not found a pdfSaveOptions class. As you can see in my saveDocToPdf sub, I did find PdfOptions and SaveOptions. I did use Heading styles for all but the title.
Hopefully, you can show me where I went wrong.
If I don’t call setAllBookmarks, I get no bookmarks; if I do call it, they are all at the top level.
I would like to actually set the bookmarks so that I know their name and can create an “outline” pdf with links into the larger output document. If you can give me a clue how to do that, it would also be appreciated.


Thank you for additional information. As I can see you use some old version of Aspose.Words. Please try using the latest version of Aspose.Words (9.4.0). You can download this version from here:
and the following code:

Protected Sub saveDocToPdf(ByRef oWord As Document, ByVal sFile As String)
Dim options As New Saving.PdfSaveOptions()
options.HeadingsOutlineLevels = 4
options.ExpandedOutlineLevels = 5
oWord.Save(sFile, options)
End Sub

In this case you do not need to use setAllBookmarks method.
Please let me know in case of any issues, I will be glad to help you.
Best regards,

Thanks, that did the trick (and the Words version I was using was only 4 months old).
I have several sites that use Aspose. I have a bin directory under each site. Is there some way to keep the Aspose site in a common directory for all and keep them updated? I notice that there was an Aspose.Words.dll.refresh file. Was that supposed to keep updating?

Hi Brad,

Thanks for your request. Anyway after update Aspose.Words you need to rebuild your application.
Best regards,