Aspose.Words for net

word源文件有书签,但是转成pdf之后就不带书签了,之前尝试过以下代码(aspose技术人员提供的):
Document document = new Document(); DocumentBuilder builder = new DocumentBuilder(document); builder.insertBreak(BreakType.PAGE_BREAK); builder.startBookmark(“MyBookmark”); builder.writeln(“Text inside a bookmark.”); builder.endBookmark(“MyBookmark”); PdfSaveOptions options = new PdfSaveOptions(); options.getOutlineOptions().setDefaultBookmarksOutlineLevel(1); document.save(“E:\Temp\awjava-19.7.pdf”, options);

但是发现没有这个方法:options.getOutline微信图片_20190823134716.png (3.3 KB)
Options().setDefaultBookmarksOutlineLevel(1)
请查看附件

@jiao,

请先升级到Aspose.Words for Java的最新版本,即19.8。

之后请尝试运行以下代码:

Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
builder.insertBreak (BreakType.PAGE_BREAK);
builder.startBookmark("MyBookmark");
builder.writeln("Text inside a bookmark.");
builder.endBookmark("MyBookmark");

com.aspose.words.PdfSaveOptions options = new com.aspose.words.PdfSaveOptions();
options.getOutlineOptions() .setDefaultBookmarksOutlineLevel(1);
document.save("E:\\Temp\\awjava-19.8.pdf", options);