3 Replies Latest reply on Feb 9, 2012 9:48 AM by try67

    Problem printing comments summary in continuous list


      I have made a bunch of underline comments through a large pdf in the hopes of printing just the comments and having essentially a shorter, more succinct version of the large file. When I go to print the comment summary (comments only) I end up with the comments from each page still printed on separate pages, which defeats the purpose of me trying to get a shorter document. I'd like just one, continous list of all the comments on as few pages as possible. I found some other forums (which are read-only now) that suggested using the following JavaScript to get a continuous comments summary:


      // Get the comments in this document, and sort by author


      annots = this.getAnnots({nSortBy: ANSB_Author});

      // Open a new report

      var rep = new Report();

      rep.size = 1.2;

      rep.color = color.blue;

      if (annots) {

      rep.writeText("Summary of Comments: By Author");

      rep.color = color.black;

      rep.writeText(" ");

      rep.writeText("Number of Comments: " + annots.length);

      rep.writeText(" ");

      var msg = "\200 page %s: \"%s\"";

      var theAuthor = annots[0].author;



      for (var i=0; i < annots.length; i++) {

      if (theAuthor != annots[i].author) {

      theAuthor = annots[i].author;

      rep.writeText(" ");






      util.printf(msg, 1 + annots[i].page, annots[i].contents));


      } else {

      var msg = "No annotations found in this document, %s.";

      rep.writeText(util.printf(msg, this.documentFileName));


      // Now open the report

      var docRep = rep.open("myreport.pdf");

      docRep.info.Title = "End of the month report: August 2006";

      docRep.info.Subject = "Summary of comments at the August meeting";


      I think this could be a great solution, but I'm having a problem with it: it's only printing the comments for the first half of my document. At the very end of the last page it prints, some of the comments overlap, some are skipped altogether, and then it stops going any further through the comments. I tried reading through the code to see if there was some sort of max number of comments defined or anything like that, but wasn't able to debug it. Does anyone know why the code isn't printing all the comments? I'm using Acrobat 9.5.0 Pro on Windows.


      Thank you in advance for your help!

        • 1. Re: Problem printing comments summary in continuous list
          BarlaeDC Adobe Community Professional



          After you have run the code can you look at the Console to see if there is any error there?


          You may have to enable settings to have the console so on exceptions - "Edit->Preferences->JavaScript" (Acrobat->Preferences->JavaScript on MAC) under the JavaScript Debugger heading.


          Check the following

          "Enable JavaScript debugger after Acrobat is restarted"

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





          • 2. Re: Problem printing comments summary in continuous list
            CJones72 Level 1

            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?

            • 3. Re: Problem printing comments summary in continuous list
              try67 MVP & Adobe Community Professional

              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.