Hi
We want to create certain categories and sub categories as bookmarks but, in our document subcategories can repeat within the categories.
For example : Category1 -> subCategory1, subCategory2
Category2 -> subCategory3, subCategory2
Since subCategory2 is repeated in between the category1 and category2, We are getting following errors.
We are getting following error
Caused by: java.lang.IllegalArgumentException: duplicate
at asposewobfuscated.zz9O.zzK(Unknown Source)
at com.aspose.words.BookmarksOutlineLevelCollection.add(Unknown Source).
We are using something similar to following code:
com.aspose.words.PdfSaveOptions options = new com.aspose.words.PdfSaveOptions();
builder.startBookmark("Bookmark 1");
//builder.writeln("hi");
builder.endBookmark("Bookmark 1");
options.getOutlineOptions().getBookmarksOutlineLevels().add("Bookmark 1", 1);
builder.startBookmark("nested bookmark 1");
//builder.writeln("hello");
builder.endBookmark("nested bookmark 1");
options.getOutlineOptions().getBookmarksOutlineLevels().add("nested bookmark 1", 2);
builder.startBookmark("nested bookmark 2");
//builder.writeln("hello");
builder.endBookmark("nested bookmark 2");
options.getOutlineOptions().getBookmarksOutlineLevels().add("nested bookmark 2", 2);
builder.startBookmark("Bookmark 2");
//builder.writeln("hi");
builder.endBookmark("Bookmark 2");
options.getOutlineOptions().getBookmarksOutlineLevels().add("Bookmark 2", 1);
builder.startBookmark("nested bookmark 3");
//builder.writeln("hello");
builder.endBookmark("nested bookmark 3");
options.getOutlineOptions().getBookmarksOutlineLevels().add("nested bookmark 3", 2);
builder.startBookmark("nested bookmark 2");
//builder.writeln("hello");
builder.endBookmark("nested bookmark 2");
options.getOutlineOptions().getBookmarksOutlineLevels().add("nested bookmark 2", 2);
We want the bookmark to match the name of the subCategory1. Please let us know if there is any other way to do that.
Thankyou.