Copy link to clipboard
Copied
Hello,
I have a Script that batch Stamps Multiple Files.
Would like that at each file the user is propmted to write which Stamp to Use (via a dialog box)
this.addAnnot({type:"Stamp", page:0, AP:"MyStamp001", rec[x1,y1,x1,y1],})
The idea is that "MyStamp001" is to be inserted by the User ("UserStampString"). If "UserStampString" Exists then Good. Else, if "UserStampString" deos not exists then Apply default "MyDefaultStamp000" for example.
Thank you in advance.
Kind Regards
Copy link to clipboard
Copied
That's not going to work. If they specify a stamp name that doesn't exist it will add a stamp with a black cross in the middle. You have no way of knowing it's a bad name.
Copy link to clipboard
Copied
If a stamp with a non-existant AP is applied to a page, Acrobat will create a stamp object with all the regular stamp properties. So it's tricky. But there is a way for the script to know whether or not a particular stamp exists.
If the stamp is applied to a point rather than a rectangle, then the rectange of the resulting annotation will be the natural size of the stamp for a real stamp AP, but for a non-existant stamp AP, the rectangle will remain a point. So the script can test the stamp rectangle after its applied to decide if the AP needs to be set to default AP.
Copy link to clipboard
Copied
I guess it's not possible to get a list of all stamp names available.
Copy link to clipboard
Copied
Not from a script.
Many versions ago, all the stamps were on a menu, and it's possible to get a list of menu names. This menu was very deliberately removed for security reasons.