20 Replies Latest reply on Nov 19, 2008 3:13 PM by try67

    Print with comments summary

    Level 1
      Is there a way to use java script to script the "print with comments summary" option from the file menu?
        • 1. Re: Print with comments summary
          gkaiseril MVP & Adobe Community Professional
          Yes, if you add a new menu item with a folder level JavaScript.
          • 2. Re: Print with comments summary
            Level 1
            Why would I need to need to add a new menu item? Its already in the "File" menu.

            I can't find it in the reference guide either.
            • 3. Re: Print with comments summary
              try67 MVP & Adobe Community Professional
              Yes, but that item is connected to a pre-defined tool which you can't change.
              You can, however, create a custom-made script that is similar to this tool, but more suited to your own needs.
              • 4. Re: Print with comments summary
                gkaiseril MVP & Adobe Community Professional
                If you want need to call that item by JavaScript you need to get the JavaScript menu item name and not the display name. The Acrobat JS API Reference has examples for listing the menu items. Once you get the name, you can use the "executeMenuItem()" method to call the menu item. Since this item requires additional confirmation of choices, it will only popup for the "Summarize Comments". A fully unattended operation would require either finding out the called function and parameters or writing your own report.

                Sometimes Adobe changes the menu item name between versions, so this technique is not without some problems.
                • 5. Re: Print with comments summary
                  Level 1
                  Ok so I found that in Acrobat Pro 7 (thats the version I am using) that menu item is called "Annots:PrintWithComments". But like you said it only brings up the dialog box with options and then proceeds to the print dialog box after that.

                  So I need to find that parameters so that I can predefine those choices and make this automatic. I just can't seem to find the parameters. I've looked in the script guide but can't find it anywhere. Am I looking in the wrong place?

                  After I find the parameters I shouldn't have any problems, I just can't find them. Can you help?
                  • 6. Re: Print with comments summary
                    Bernd Alheit Adobe Community Professional & MVP
                    You can't predefine those choices. There is no JavaScript API for this dialog.
                    • 7. Re: Print with comments summary
                      gkaiseril MVP & Adobe Community Professional
                      There is a provided function within Acrobat called "ANsummarize(oDoc, )". Since Adobe has provided the builtin function libraries as pre-compiled code starting with version 6, the source code is no longer visible, but one can use the console to print the code:

                      console.println(ANsummarize);

                      A check of the code for this function shows there will be at least one restricted method that will require the use of a trusted function.
                      • 8. Re: Print with comments summary
                        Level 1
                        Thanks Geo but I am afraid I am going to need a little more help. I don't quite understand what its saying in the console. It looks like the parameters plus a bunch of examples.

                        So this is the part that I need I just don't know what each on of those things does:

                        ANsummarize(doc, title, p, r, dest, fs, print, twoUp, useSeqNum, scale, noAssocDoc, filter, paperWidth, paperHeight)

                        Is there an old ref guide somewhere that would give me an explanation? or will the console?

                        I need more guidance!
                        • 9. Re: Print with comments summary
                          try67 MVP & Adobe Community Professional
                          Have a look at this: http://try67.blogspot.com/2008/11/acrobat-create-comments-summary-txt-pdf.html
                          • 10. Re: Print with comments summary
                            Level 1
                            Thats cool but where is the script? I'd want it to print with connector lines on a single page. This is going to be part of a process where a pdf's dropped into a watched folder will be print with the comments on a single page.

                            Is it possible after I get the pop-up window just to tell it to "click" ok? It will hold the settings as long I set it the first time. This is much less then ideal but I can't make sense of what Geo showed me in the console.
                            • 11. Re: Print with comments summary
                              try67 MVP & Adobe Community Professional
                              In my script there's no popup window, unless you want to change the settings of the output each time you run it. And I'm not sure what you mean by "connector lines"... Anyway, the script can be purchased from me via private communication. Email me for more info.
                              • 12. Re: Print with comments summary
                                gkaiseril MVP & Adobe Community Professional
                                There is no authorized documentation about this function, the term is undocumented. Also this function can be changed or removed by Adobe without notice.

                                You have to reverse engineer the code.

                                The first parameter, "doc", is the document object to be processed, usually the "this".

                                The second parameter, "title", is the title for the summary report.

                                So the very basic command will be:

                                ANsummarize(this);

                                And if you want to add a title to the report, you can provide the title as a string of variable:

                                ANsummarize(this, this.info.title); // simple comment report with the PDF's title
                                • 13. Re: Print with comments summary
                                  Level 1
                                  Geo,

                                  Thanks. I've been exeprimenting and I figured out the same thing you did.

                                  doc=the document, title=the title, p=the page

                                  thats the furthest I've gotten so far. If I could get it to one page then that would be good enough. Any idea on these others?

                                  ANsummarize(doc, title, p, r, dest, fs, print, twoUp, useSeqNum, scale, noAssocDoc, filter, paperWidth, paperHeight)

                                  try67, did you use this to write your script? Do you know what these other parameters are?
                                  If you look in the pop-up window from "Print with Comment Summary" in the File menu it has an option to print with "...connector lines on single pages", Thats what I was refering to.
                                  • 14. Re: Print with comments summary
                                    Level 1
                                    Geo,

                                    Thanks. I've been exeprimenting and I figured out the same thing you did.

                                    doc=the document, title=the title, p=the page

                                    thats the furthest I've gotten so far. If I could get it to one page then that would be good enough. Any idea on these others?

                                    ANsummarize(doc, title, p, r, dest, fs, print, twoUp, useSeqNum, scale, noAssocDoc, filter, paperWidth, paperHeight)

                                    try67, did you use this to write your script? Do you know what these other parameters are?
                                    If you look in the pop-up window from "Print with Comment Summary" in the File menu it has an option to print with "...connector lines on single pages", Thats what I was refering to.
                                    • 15. Re: Print with comments summary
                                      try67 MVP & Adobe Community Professional
                                      BChase: No, my script doesn't use this function. It creates its own report, but it doesn't have the "connector lines" functionality you mention.
                                      I can guess what some of the parameters mean (twoUp is probably related to the view option of the report, paperWidth and paperHeight are the dimensions of it, useSeqNum is probably a boolean...), but I don't know for sure.
                                      • 16. Re: Print with comments summary
                                        gkaiseril MVP & Adobe Community Professional
                                        This is a type of action that is possible:

                                        this.syncAnnotScan(); // update the annotations object
                                        var annots;
                                        // now loop through the pages
                                        for(p = 0; p < this.numPages; p++) {
                                        // for page get the annotations sorted by author
                                        annots = this.getAnnots({nPage:p, nSortBy: ANSB_Author, bReverse: false });
                                        // see if we have something to process
                                        if (annots != null) {
                                        console.println("Page " + p + " has " + annots.length + "Annotations.");
                                        var msg = "%s in a %s annot said: \"%s\""; // format message for display
                                        for (var i = 0; i < annots.length; i++) // process annotations for page
                                        console.println(util.printf(msg, annots[i].author, annots[i].type, annots[i].contents));
                                        } // end page processing
                                        } // end loop through pages
                                        • 17. Re: Print with comments summary
                                          Level 1
                                          If I want to use this and don't know some of those parameters can I skip some of them without having to put everything in the right order?

                                          ANsummarize(doc, title, p, r, dest, fs, print, twoUp, useSeqNum, scale, noAssocDoc, filter, paperWidth, paperHeight)

                                          I was thinking something like this but it won't get the document I have open

                                          ANsummarize({doc: this, title: "Note Summary"})

                                          It works when I do this: ANsummarize(this, "Note Summary")

                                          What am I missing?
                                          • 18. Re: Print with comments summary
                                            gkaiseril MVP & Adobe Community Professional
                                            It may be a bug or change in the different versions. You are using the same function, but without the parameter names.
                                            • 19. Re: Print with comments summary
                                              Level 1
                                              OK, so how in javascript do I tell it to "click" ok when a window pops-up?
                                              • 20. Re: Print with comments summary
                                                try67 MVP & Adobe Community Professional
                                                You can't.