Skip to main content
Participant
June 15, 2012
Answered

Print comments only

  • June 15, 2012
  • 6 replies
  • 36989 views

Is there a way to print comments only in a continuous fashion, not just one per page?  I have many short comments and need to print these out on just a few sheets.

I've looked at a similar question from 2010 with one answer suggesting Java Script, but no link or details, and unfortunately I don't know how to pursue this.

I have tried several possibilities including converting to Word, but this results in individual pages as well.  Also, since the PDF page numbers are in a header, it isn't possibly to replace the "section break--new page" with just a line break!  I tried using small paper size to print multiple pages on one sheet, but each page shrinks so that it is unreadable.  Is there a way to put multiple pages on one sheet without any reduction in the original font size?

Thanks for any help.  Using Acrobat X Pro in Windows XP Pro.

This topic has been closed for replies.
Correct answer Dave Merchant

The best way to do it is by scripting a new PDF Report. Open the JS console (ctrl-J) and clear it, then paste in the following code:

this.syncAnnotScan();

var a = this.getAnnots();

if (a) {

  var rep = new Report();

  rep.size = 1.8;

  rep.color = color.blue;

  rep.writeText("Summary of Comments for " + this.documentFileName);

  rep.color = color.black;

  rep.writeText(" ");

  rep.size = 1.2;

  rep.writeText("Total of " + a.length + " comments in this file");

  rep.writeText(" ");

  rep.writeText(" ");

  rep.indent(20);

  var msg = "\200 page %s by %s on %s";

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

    rep.writeText(" ");

    rep.writeText(util.printf(msg,1 + a.page,a.author,a.creationDate)); 

    rep.indent(20);

    rep.writeText(a.contents);

    rep.outdent(20);

  }

  var docReport = rep.open("commentSummary.pdf");

  docReport.info.Title = "Comments Summary for " + this.documentFileName;

}

Select it all and press ENTER on your numeric keypad (or ctrl+Return on the main keypad). A new PDF will appear with all your comments in. You can customize the code to set how the Report is laid out, see the Acrobat SDK documentation for what the commands are, but it's relatively simple to work it out from the example above.

You can also drop the code into an Action (using a JavaScript step) and set the Action to run against the current file.

6 replies

Participant
December 16, 2022

I see the Correct Answer to this question was posted over 10 years ago.

(And I'm really not competent to follow the instructions.)

Surely in that time Adobe could have come up with a simple "click here" option, to print all comments – or, better still, to convert them to a simple text file!

Participant
December 17, 2022
Participant
January 29, 2018

Thanks, very helpful

Participating Frequently
October 27, 2016

I want to output in a database format for import into MS Access.

I think modifying, in particular, to insert comma's

rep.writeText(util.printf(msg,1+a.page, "," a.author, ...

but I don't know the syntax

Can you help me with that? Maybe include a reference so that I can read on it?

As (somewhat) of an aside - I'm using ie 11 and can't paste into the browser here... had to type the above - how frustrating...

Thanks

Gilbert Rajkumar
Participant
September 15, 2015

Is there a way to print only the pages that have comments. For example, I have a document with 84 pages and have only 32 pages with comments. I need to print only those 32 pages with comments.

Thanks for any help.  Using Acrobat X Pro in Windows XP Pro.

Inspiring
September 15, 2015

There's no built-in feature for printing only pages with comments, but you could use JavaScript to implement two different approaches:

1. Loop through the annots array (doc.getAnnots method) and determine which pages (annot.page property) have comments on them. Delete the pages (doc.deletePages method) that do not have any comments (starting from the end of the document) and print the document (doc.print method). This will involve a single print job.

2. Loop through the annots array and determine which pages have comments on them. Print continuous ranges of pages until all of the pages with comments on them have been printed. With Acrobat 11 and later you can use the printRange PrintParams property to specify multiple ranges, so you can get away with a single print job. Otherwise, you'd have issue a print job of each page range.

Participant
September 1, 2021

// I made minor changes to the script to better number the pages and skip pages without comments.

 

app.addMenuItem({


cName: "-",


cParent: "Edit",


cExec: " "


});

 

// Add a menu item for the comments report function


app.addMenuItem({


cName: "AS_comments_report",


cUser: "Comments Report",


cParent: "Edit",


cExec: "AS_comments_report(this);",


cEnable: "event.rc = app.doc;"


});

 

AS_comments_report = app.trustedFunction (function (doc) {

 

if (app.viewerType === "Reader") {


app.beginPriv();


app.alert({


cMsg: "This comment report utility cannot be used with Adobe Reader. It requires Acrobat Pro or Acrobat Standard.",


nIcon: 1, // Warning


cTitle: "Acrobat required"


});


app.endPriv();


return;


}

 

// Prompt the user for the sorting type


var aSortTypes = [];


aSortTypes.push({cName: "Select a sort type below", bEnabled: false});


aSortTypes.push({cName: "-"});


aSortTypes.push({cName: "None", cReturn: ANSB_None});


aSortTypes.push({cName: "Page #", cReturn: ANSB_Page});


aSortTypes.push({cName: "Author", cReturn: ANSB_Author});


aSortTypes.push({cName: "Date", cReturn: ANSB_ModDate});


aSortTypes.push({cName: "Type", cReturn: ANSB_Type});

 

var nSortType = app.popUpMenuEx.apply(app, aSortTypes) || ANSB_None;

 

// Change to true to reverse the sort order


var bReverseOrder = false;

 

// Specify some page sizes


var PageSize = {


letter_portrait: [0, 11 * 72, 8.5 * 72, 0],


letter_landscape: [0, 8.5 * 72, 11 * 72, 0],


legal_portrait: [0, 14 * 72, 8.5 * 72, 0],


legal_landscape: [0, 8.5 * 72, 14 * 72, 0],


A4_portrait: [0, 11.69 * 72, 8.27 * 72, 0],


A4_landscape: [0, 8.27 * 72, 11.69 * 72, 0]


};

 

this.syncAnnotScan();


var a = this.getAnnots({nSortBy: nSortType, bReverse: bReverseOrder});

 

if (a) {


var rep = new Report(PageSize.letter_portrait);


rep.size = 1.8;


rep.color = color.blue;


rep.writeText("Summary of Comments for " + doc.documentFileName);


rep.color = color.black;


rep.writeText(" ");


rep.size = 1.2;


rep.writeText("Total of " + a.length + " comments in this file");


rep.writeText(" ");


rep.writeText(" ");


rep.indent(20);

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


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


rep.writeText(" ");

if (a[i].contents != null)
{
rep.writeText(util.printf(msg, 1 + a[i].page , util.printd("yyyy/mm/dd", util.scand("yyyy/mm/dd",a.creationDate))));

rep.indent(20);

rep.writeText(a[i].contents);

rep.outdent(20);
}

}


var docReport = rep.open("commentSummary.pdf");


docReport.info.Title = "Comments Summary for " + doc.documentFileName;


}

 


});

Participant
August 17, 2014

A slight modification, provided by the moderator (Dave Merchant) in a private message to me, on the above code that orders the comments from oldest to newest (usually this occurs in sync with the document as you read it--unless you read it backwards.

--

this.syncAnnotScan();

var a = this. getAnnots({nSortBy:ANSB_ModDate,bReverse:true});

if (a) {

  var rep = new Report();

  rep.size = 1.8;

  rep.color = color.blue;

  rep.writeText("Summary of Comments for " + this.documentFileName);

  rep.color = color.black;

  rep.writeText(" ");

  rep.size = 1.2;

  rep.writeText("Total of " + a.length + " comments in this file");

  rep.writeText(" ");

  rep.writeText(" ");

  rep.indent(20);

  var msg = "\200 page %s by %s on %s";

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

    rep.writeText(" ");

    rep.writeText(util.printf(msg,1 + a.page,a.author,a.creationDate));

    rep.indent(20);

    rep.writeText(a.contents);

    rep.outdent(20);

  }

  var docReport = rep.open("commentSummary.pdf");

  docReport.info.Title = "Comments Summary for " + this.documentFileName;

}


Jim

adkjeirjs
Participant
February 3, 2015

Wish I had the time to learn more about this...really adds functionality to adobe.  Does anyone know how to make it sort by page?  I'd like the comments in the order of the document not the date I added them.

Would really appreciate it

Corina

adkjeirjs
Participant
February 4, 2015

Did a little research and figured it out! Easy to alter.  Here it is if anyone wants:

this.syncAnnotScan();

var a = this. getAnnots({nSortBy:ANSB_Page});

if (a) {

  var rep = new Report();

  rep.size = 1.8;

  rep.color = color.blue;

  rep.writeText("Summary of Comments for " + this.documentFileName);

  rep.color = color.black;

  rep.writeText(" ");

  rep.size = 1.2;

  rep.writeText("Total of " + a.length + " comments in this file");

  rep.writeText(" ");

  rep.writeText(" ");

  rep.indent(20);

  var msg = "\200 page %s by %s on %s";

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

    rep.writeText(" ");

    rep.writeText(util.printf(msg,1 + a.page,a.author,a.creationDate));

    rep.indent(20);

    rep.writeText(a.contents);

    rep.outdent(20);

  }

  var docReport = rep.open("commentSummary.pdf");

  docReport.info.Title = "Comments Summary for " + this.documentFileName;

}

Dave MerchantCorrect answer
Legend
June 17, 2012

The best way to do it is by scripting a new PDF Report. Open the JS console (ctrl-J) and clear it, then paste in the following code:

this.syncAnnotScan();

var a = this.getAnnots();

if (a) {

  var rep = new Report();

  rep.size = 1.8;

  rep.color = color.blue;

  rep.writeText("Summary of Comments for " + this.documentFileName);

  rep.color = color.black;

  rep.writeText(" ");

  rep.size = 1.2;

  rep.writeText("Total of " + a.length + " comments in this file");

  rep.writeText(" ");

  rep.writeText(" ");

  rep.indent(20);

  var msg = "\200 page %s by %s on %s";

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

    rep.writeText(" ");

    rep.writeText(util.printf(msg,1 + a.page,a.author,a.creationDate)); 

    rep.indent(20);

    rep.writeText(a.contents);

    rep.outdent(20);

  }

  var docReport = rep.open("commentSummary.pdf");

  docReport.info.Title = "Comments Summary for " + this.documentFileName;

}

Select it all and press ENTER on your numeric keypad (or ctrl+Return on the main keypad). A new PDF will appear with all your comments in. You can customize the code to set how the Report is laid out, see the Acrobat SDK documentation for what the commands are, but it's relatively simple to work it out from the example above.

You can also drop the code into an Action (using a JavaScript step) and set the Action to run against the current file.

columba4Author
Participant
June 18, 2012

Dave,

Thanks VERY much. I will definitely give this a try. I appreciate your

taking time to do this.

Sincerely, Michele