This free consulting project uses Aspose.PDF to enable you to create TOC in exisiting PDF document by extracting first line/phrase of each page. It also showcases a functionality to extract lengthy content pages and create a separate PDF document from them. https://www.aspose.com/