- add CheckBox object on a group header and set up its Hyperlink: set Kind to "Custom" and Value to group's name;
- create a Click event handler that will be executed when you click the checkbox;
- create a BeforePrint event handler of a group header. In the handler, check whether current group is visible or not.
See the script's code for more details.