Table of content not displaying when converting from RTF to PDF

Hello, We are using java Aspose.words-21.4.0-jdk17
, while creating pdf from rtf template , The Table of content is not visible.
We tried using the methods below, still the changes were not reflected.

document.updateFields();
document.updatePageLayout();

@ykaware Could you please attach your input and output documents here for testing? We will check the issue and provide you more information.