I am dealing with mail merge templates that have freetext fields that can take any amount of text which may cause the document to dynamically expand to any number of pages per mail merge record.
I tried hooking into the FieldMerginCallback and querying e.getDocument().getPageCount(), but this count does not seem to get updated with the actual number of pages during the mail merge.
And there seems to be no other callback that gets executed per record or per page added. Am I missing something? This seems fairly straight forward and in my case is needed so I can generate appropriate barcodes for each individual page of the mailmerge as well as for reporting and billing purposes.