These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Adding custom stamp through Batch Javascript

srprice
Registered: Sep 19 2007
Posts: 138
Answered

I'm trying to add a custom stamp to several hundred PDF files through a batch using Javascript.
 
I can add one of the preinstalled stamps no problem. I'm using this code to do it:
var annot = this.addAnnot({
page: 0,
type: "Stamp",
rect: [400, 400, 550, 500],
AP: "NotApproved" });
 
However I need to update the AP property for the name of my custom stamp. I used a custom calculation script to get the stamp name (event.value = event.source.stampName;) but it still does not add it. All I get is a blank box.
 
How do I find the name of my custom stamp?
 
scopley

My Product Information:
Acrobat Pro 9.3.1, Windows
srprice
Registered: Sep 19 2007
Posts: 138
I just found the answer. With the newly created custom stamp file open run this code in the console.

var t=templates;
for (var i=0; i < t.length; i++) {
t[i].spawn({nPage:0,bOverlay:false});
var b=this.getPageBox("BBox",0);
var width=(b[2]-b[0]).toFixed(2);
var height=(b[1]-b[3]).toFixed(2);
var a=t[i].name.split("=");
console.println("User name: \""+a[1]+"\", name="+a[0]+",width="+width+"bp,height="+height+"bp");
this.deletePages(0);
}


It will give you the exact name of the stamp and you can copy and paste. I rekeyed the name wrong originally and that's why it wouldn't work.

scopley