Hi,
The recommended way to generate multi-page PDFs in Mendix is by using Document Templates with the correct structure.
For dynamic or repeating data, always place the content inside a table bound to a list. When the table grows beyond one page, Mendix will automatically continue it on the next page. No manual pagination logic is needed.
Manual page breaks usually don’t work well with dynamic content and often cause layout issues, so it’s better to avoid them.
As long as you:
Use tables for repeating data
Avoid fixed heights
Let text and images grow naturally
pagination works reliably.
In most cases, Document Templates alone are enough. Custom styling or Java actions are only required for very complex layouts.
This approach has worked well for me in production apps.
The key to solving this is using Document Templates while making sure the layout and CSS don’t interfere with normal page flow. In Mendix, content should automatically continue onto the next page once it exceeds the current one. When that doesn’t happen, it’s usually caused by fixed heights (height: 100%, px, vh), overflow: hidden, or styles like position: absolute. To avoid this, the main containers in your template should be allowed to flow naturally.
For controlled page breaks between sections, using print-specific CSS works really well. You can add a class with page-break-before: always between major sections, and use page-break-inside: avoid for elements that shouldn’t be split across pages (such as a signature or a single card). For lists or tables, it’s best to let rows flow naturally and use these “avoid” rules sparingly so pagination isn’t blocked.
Overall, most multi-page PDF issues can be solved without custom Java actions or extra widgets, and getting the Document Template structure and print CSS right usually does the trick.