7
Review, Markup, and Approval
Managing Comments
Managing Comments
Topics
Selecting, Moving, and Deleting Comments
Using the Comments List
Exporting and Importing Comments
Comparing Comments in Two PDF Documents
Aggregating Comments for Use in Excel
Extracting Comments in a Batch Process
Selecting, Moving, and Deleting Comments
Just as you can access the
Comments List
in the Acrobat user interface, you may likewise
do so through Acrobat JavaScript, using the
doc
object’s
syncAnnotScan
and
getAnnots
methods. The
syncAnnotScan
method guarantees that all annotations in
the documents are scanned, and the
getAnnots
method returns a list of annotations
satisfying specified criteria.
For example, the following code scans all the annotations on page 2 of the document and
captures them all in the variable
myAnnotList:
this.syncAnnotScan();
var myAnnotList = this.getAnnots({nPage: 2});
To move a comment, use the corresponding
annot
object’s
setProps
method to specify
a new location or page. To delete the comment, invoke the corresponding
annot
object’s
destroy
method. In the code sample below, all the free text comments on page 2 of the
document are deleted:
for (var i=0; i<myAnnotList.length; i++)
if (myAnnotList[i].type == "FreeText")
myAnnotList[i].destroy();
136
Acrobat JavaScript Scripting Guide