Skip to main content
Participant
April 21, 2021
Question

Trying to print ONLY the comments from a PDF without the pages to which the comment is linking

  • April 21, 2021
  • 2 replies
  • 292 views

I have tried the following JavaScript after entering comments into a pdf in Adobe Pro X :

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;

}

 

 

However, once I hit "Enter" on the numeric keypad, it does create the report, but all of the "bullet" points say "page NaN by undefined on undefined"

Any idea what I am doing wrong?

 

This topic has been closed for replies.

2 replies

Bernd Alheit
Community Expert
Community Expert
April 21, 2021

To access the comments you must use a[i], not only a. 

Eric Dumas
Community Expert
Community Expert
April 21, 2021

Hi,

In the past, I exported the comments as a PDF and printed only that. seems simpler.