Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Printing subforms


Level 4

I'm trying to capture which subforms I currently have visible, so that I can keep them visible after printing.

My current aim is to be able to hit the print button, have every form printed out and then for only the forms that were visible to be visible after the print.

I can make them visible and hidden in the pre and post print events, but how do I record which forms were open, so that they stay open later on?

Many thanks,

3 Replies


Level 4
Is it possible to create an event in the script?

I can easily track which form is open, and then if it was possible put in something like:



Level 4
Right. I came up with a messy solution!

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 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.

Told you it was messy.



Level 4
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.