Free Support Forum - aspose.com

Convert Word bookmark to PDF bookmark?

Is there any way to convert the Word bookmark into the PDF bookmark or something like that if using doc.Save(pdfFile, Aspose.Words.SaveFormat.Pdf); I'm using the Aspose Word 11.5 now.

Thanks

Tom.

Hi Tom,

Thanks for your inquiry. Please note that all Bookmarks in Microsoft Word document are always on the same level. Please use PdfSaveOptions.BookmarksOutlineLevel property to achieve your requirements.

Document doc = new Document(MyDir + "in.docx");

PdfSaveOptions options = new PdfSaveOptions();

//NOTE: This property is now obsolete.

options.BookmarksOutlineLevel = 1;

doc.Save(MyDir + "Out.pdf", options);


I would suggest you please upgrade to the latest version (v13.3.0) from here:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/entry455473.aspx

The BookmarksOutlineLevel is obsolete now, please use the OutlineOptions class to specify outline options like HeadingsOutlineLevels, ExpandedOutlineLevels, BookmarksOutlineLevels. Following are the details.

BookmarksOutlineLevels : Allows to specify individual bookmarks outline level.
DefaultBookmarksOutlineLevel : Specifies the default level in the document outline at which to display Word bookmarks.
ExpandedOutlineLevels : Specifies how many levels in the document outline to show expanded when the file is viewed.
HeadingsOutlineLevels : Specifies how many levels of headings (paragraphs formatted with the Heading styles) to include in the document outline.