Document template for Mendix are limited. You have an option to convert normal Mendix pages into PDF’s including all fancy CSS styling and UI widgets.
We create a service for this, though it is not completely for free, it might help you to get things done.
I was struggling with the same problems that you describe so I built a module that can generate complex document/PDF reports with repeating page headers from Mendix pages.
Give it a try and let me know if you run into any difficulties, I have some experience in the matter 😉
We use this tool to generate documents in Mendix and are pretty happy about it https://appronto.nl/document-generation-for-mendix/