Is this two different questions now?
Some of the high level functions in Acrobat can be run through a mechanism called AVCommand. The hardest part of this is discovering the command names and parameters. Please do not ask us for sample code. If any part of the documentation is not clear perhaps we can explain it. There is much to learn and experiment with to get AVCommands working.