Thank you for your interest in Aspose products.
In order to insert TOC into an RTF document you can use Aspose.Words. Please see the following links in our documentation:
Then you can convert it to PDF using Aspose.Words and Aspose.Pdf together. How to do this you can read here:
Conversion is performed in two steps. First we ask Aspose.Words.Document object to save as intermediate Aspose.Pdf XML format. It is understood by Aspose.Pdf to generate the result PDF document. Of course you can create this XML manually but it’s a big mess. Also this could bring compatibility issues when upgrading to the later versions even in spite of the fact their format is documented. So it’s much more convenient to use our libraries in pair.
Please let us know if you have any further questions. We’ll help you build your solution as much as we could.