Copy link to clipboard
Copied
I have a total of 150 PDFs in a particular folder. If there is no comment in the PDF, then Acrobat should add a new comment "No comment in file". Is there any way or JavaScript to batch process this task on 150+ PDFs?
Copy link to clipboard
Copied
Hi,
The mikeb41294032's script is correct, but if you use the try catch statment, you don't need to use the if (annots==null) condition.
Here is a script using only the if condition:
annots=this.getAnnots();
if (annots==null) {
var annot=this.addAnnot({
page: 0,
type: "Text",
contents: "No comment in file",
point: [300,400]
})
this.saveAs({cPath: this.path});
}
Then when you run the action wizard, you have to select the folder containing all your 150 files.
@+
Copy link to clipboard
Copied
Hello @abhijeett89122812
Give this a try...
Start off by creating a new Action, on the top right you will need to point the action to the folder with the files to be processed. Under More tools select/add Execute JavaScript > Specify Setting, paste the below code in the editor window and uncheck Prompt User.
try{ this.syncAnnotScan();
var annots = this.getAnnots();
if(annots == null){
var annot = this.addAnnot ({page: 0, type: "Text", point: [300,400], contents: "No comments in file."});
app.execMenuItem("Save");
}
} catch(e) {
app.alert(e);
}
Regards,
Mike
Copy link to clipboard
Copied
Hi,
The mikeb41294032's script is correct, but if you use the try catch statment, you don't need to use the if (annots==null) condition.
Here is a script using only the if condition:
annots=this.getAnnots();
if (annots==null) {
var annot=this.addAnnot({
page: 0,
type: "Text",
contents: "No comment in file",
point: [300,400]
})
this.saveAs({cPath: this.path});
}
Then when you run the action wizard, you have to select the folder containing all your 150 files.
@+
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more