Table_of_Contents.zip (22.9 KB)
please run this code for the attached document
String inputFileName = “Table_of_Contents.docx”;
String outputFileName1 = “Table_of_Contents1.pdf”;
String outputFileName2 = “Table_of_Contents2.pdf”;
com.aspose.words.License license = new com.aspose.words.License();
license.setLicense(Thread.currentThread().getContextClassLoader().getResourceAsStream("Aspose.Words.lic"));
Document doc = new Document(inputFileName);
doc.save(outputFileName1);
doc.updateFields();
doc.save(outputFileName2);
please note the difference between two files before and after updateFields, the TOC links are bold after updateFields()