How to extract titles from documents?
The automate the extraction of a title is an example of extractive summarization. It is typically solved with a combination of supervised and sem-supervised learning. More recently Deep Learning models with attention have been giving state-of-the-art results.

You'll need labeled to train your own model or used established packages such as symy.