How to create a multi-page PDF in Mendix?

0
Hi everyone, I’m trying to generate a PDF with multiple pages in Mendix, but I’m not sure about the best approach. My requirements are: The PDF should contain multiple pages Each page may include data from a list (e.g. table rows, repeating content,images,coverletter) When the content exceeds one page, it should automatically continue on the next page I have already tried: Using Document Templates Adding page breaks, but the content still appears on a single page or does not split correctly Could someone please explain: The recommended way to create multi-page PDFs in Mendix? Whether this can be done using Document Templates only, or if custom styling / widgets / Java actions are required? If possible, a simple example or best practice would be very helpful. Thanks in advance!          
asked
2 answers
0

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.

answered
0

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.

answered