I thought about this a bit and came up with a way to do it in a single microflow with no custom Java or other coding necessary.
I have shared my microflow here, and I will walk through what it does below.
To start, here is the domain model that supports this microflow:
The microflow retrieves Materials that start with the letter s or S from a database entity.
First: get all of the materials, count them and determine number of pages
Next, set up some variables to control looping and page contents
Go through a loop and retrieve 1 page worth of records, create a PDF and add it to the list of pages
When the loop is done, use the Java action MergeMultiplePdfs from community commons to merge our list of pages into a single document, finally, delete all of the single page documents because we don't need them anymore.
The document template I use is pretty simple, just for demonstration purposes:
The resulting combined file can be seen here.
The only thing you need to determine is how many records will fit on a single page. If you wanted to, it would be easy to have a different first page (different template and maybe number of records), than the other pages.
Hope that is helpful,
https://forum.mendix.com/link/questions/4816 mentions the same problem and offers a workaround. I don't think there's a proper solution for this problem yet.
I've done this for a customer in the following way:
Work to do upfront:
Creating the document in your app:
Asuming you have the functionality present where you create your document. (you'll need to create the document twice)
You may need to work by trial and error regarding the correct position of your repeatable header. If you need more help, contact me by mail.