After you have run the code can you look at the Console to see if there is any error there?
Check the following
"Show console on errors and messages"
Then if you rerun the code if there is an error in the script the console should show and tell you what the error was.
Thanks for your help Malcolm -- I just set the preferences as you described. I seem to be having a different problem today, although I don't think I have changed anything. I've tried running the code several times using different pdf documents and verifying I'm using the same code, but none of the comments are printing now. It won't even open a document to print the comments. The error that the console is telling me is:
ReferenceError: docRep is not defined
How do I define docRep?
There's a bug in the implementation of the Report object, starting from
Acrobat 9, that causes it not to create a new page properly but to
overwrite all the lines one on top of another. The solution is to edit the
code so that it counts the lines printed, and when you think you arrived to
the end of the page, manually call the breakPage() command.