Free Support Forum -

How to convert doc to pdf bookmarks?

When I convert a word document with bookmarks to pdf I do not get any bookmarks in the PDF document. The converter spreadsheet at states that bookmarks are converted but are anchored at paragraph start, not the exact position.

The Aspose.pdf wiki states that bookmarks are added at "Headings". [ ]. I see no heading nodes in the pdf-xml and applying a Word heading style to a paragraph in the document does not result in pdf bookmarks being created either.

Can you please clarify what I need to do to get bookmarks in my PDF document when converting a Word document? I'm using the following code:

pdf.IsBookmarked = True

pdf.BookMarkLevel = 0

doc.Save(xmlOutFilePath, Aspose.Words.SaveFormat.FormatAsposePdf)

pdf.BindXML(xmlOutFilePath, Nothing) 'Read the document in Aspose.Pdf.Xml format into Aspose.Pdf.


You need to set the following property before doing the conversion:

doc.SaveOptions.PdfExportBookmarkLevel = level;

The issue is referenced in Roman Korchagin blog:

Thanks. That is helpful but it does not quite solve my problem since the names of the pdf bookmarks I want are in the .doc section headers.

Bookmarked headings in the document section headers are not getting translated to PDF.

I tried a workaround using bookmarked hidden text in the body of the section, but if the text is hidden then no bookmarks appear in PDF: for example

Suppose a section of my document is named MySectionName. The .doc section header contains the text "MySectionName" (and some other text). Since bookmarking in the section header is not translated to pdf, I add the hidden bookmarked text "MySectionName" to the beginning of the body of the section.

I seem to recall an entry in Roman's blog about automatically adding bookmarks at page breaking section breaks. Is this feature implemented or forthcoming soon?

If there is not an existing solution to my problem, I'd like to suggest the two features for an upcoming release:

1. PDF translation of bookmarks in section headers [and some way of setting the PDF name of these bookmarks] and/or

2. PDF translation of bookmarks on hidden text.


-Charu Tevari

Architect, John Hancock Life Insurance, USA.

doc.SaveOptions.PdfExportBookmarkLevel just creates PDF bookmarks for text that is assigned standard "Heading x" styles in MS Word.

I'm not sure I understand your phrase "bookmarked headings in the document section headers". Send us a .doc file that shows that and if possible a .pdf file that shows how you want those bookmarks in PDF.

Here is an example:

Sorry for the confusion ["section header" vs "heading style", too many heads!].

By section header I mean headings as in the header/footer story vs the document body.

Attached are two files bookmarks.doc, pdf.

The text in the doc files' header and body explains what I want- the PDF is a result of conversion with Aspose.PDF- as you can see, bookmarks in the document body are converted but not in the document section header.

The other file is an example of the kind of template file I consume with Aspose.Words. The Green text in the section headers is what I want to bookmark.


-Charu Tevari

Ok, thanks, I now understand.

This cannot be done by Aspose.Words only. I will invite the Aspose.Pdf team into the discussion.

Dear customer,

Creating bookmark for headings in header or footer is not supported in Aspose.Pdf. I will study this issue and try to support this in a week.

Dear customer,

Heading within the header in the doc file you attached is not an actual heading, you only

applied heading level 1 style to the text segment, if you open the doc file in Microsoft

Office with structure tree view, you can't find any entry to the heading of header in

navigating box, so creating bookmark for heading in header would not be supported by

aspose.pdf now.

Thank you for the analysis.

I would still like to have a way of translating MS Word bookmarks into PDF bookmarks in the course of converting .doc to pdf- even if the word bookmarks are not headings in the Document Map.

OK will we will try to support this feature but that may need much time. Please use headings in the section but not header or footer as workaround.