This is not possible natively with document templates. However, the underlying technology that Mendix uses does have support for this. Probably you need to do some java magic to access and change the generated templates
http://www.herongyang.com/XSL-FO/Hyperlink-Clickable-Table-of-Content.html
Hope this helps