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

Free Support Forum - aspose.com

How to use heading to create a bookmark when Convert docx to pdf

Hello,
I want to convert docx to pdf,I want to the Heading in docx that converted to bookmark in pdf and show in the pdf(Please have a look about the attachment(pdf file)),I don’t know how to use aspose to realize the attachment pdf file,could you tell me? Thank you very much!AfterrConverted123.pdf (469.0 KB)
Desktop.zip (426.0 KB)

@www.evget.com,

Thanks for your inquiry. The OutlineOptions.HeadingsOutlineLevels property specifies how many levels of headings (paragraphs formatted with the Heading styles) to include in the document outline. You can achieve your requirement using following code example. However, heading bookmarks are not created in output PDF using this code. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15701. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Document doc = new Document(MyDir + "123.docx");
 
PdfSaveOptions options = new PdfSaveOptions();
options.OutlineOptions.HeadingsOutlineLevels = 9;
 
doc.Save(MyDir + "17.7.pdf", options);

Thank you for your quick reply!

@www.evget.com,

The issues you have found earlier (filed as WORDSNET-15701) have been fixed in this Aspose.Words for .NET 17.9 update and this Aspose.Words for Java 17.9 update.