I have a variable with a prePrint() and postPrint() function (bad practise to copy names from elsewhere but never mind, was annoyed!).
There is a var in the printing variable called "visiblePage".
The prePrint() is called in the print button, just before the print command is sent via xfa.host.print and looks at every subform, checking if their presence is visible and if it is setting visiblePage to the name of that form.
Then I run my prePrint event on each form which makes each one visible.
Then I print.
Then I run my postPrint event which makes every form hidden again.
Then I call my postPrint() function, which looks at visiblePage and runs a switch statement turning whichever page was visible before the print, back to visible again.
Oh, the reason that the prePrint() is called when the button is pressed as opposed to in the form's prePrint is that it was running my function after it had made all the other forms visible, so was only recording the last form as visible.
Does anyone know in what order the prePrint events are called? I would have assumed they were from the first form down to the lowest level in the hierarchy, but that didn't happen for me.