Copy link to clipboard
Copied
I need a way to batch/automated swap stamp#1 with stamp#2; same size/location.
E.g., Copyright stamp with one year needs to be changed to new stamp with new year.
Thousands of files....
Any help is much appreciated.
Alan
Copy link to clipboard
Copied
You can do it by using a script to change the stamp's AP property, which defines its appearance.
For example, the AP value of the Approved stamp is "SBApproved" and of the Not Approved stamp is "SBNotApproved".
So, this code will convert all Approved stamps in a file to Not Approved:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.AP=="SBApproved") annot.AP = "SBNotApproved";
}
}
You can run this code as a part of an Action on multiple files, if you have Acrobat Pro.
Now, how do you find out the AP values for your old and new stamp types? Easy.
Apply the stamp to a page, click it with the mouse, open the JS Console (Ctrl+J) and then enter the following code and press Ctrl+Enter to run it:
this.selectedAnnots[0].AP
It will print out the AP value that you need to use in the code above.
Copy link to clipboard
Copied
You can do it by using a script to change the stamp's AP property, which defines its appearance.
For example, the AP value of the Approved stamp is "SBApproved" and of the Not Approved stamp is "SBNotApproved".
So, this code will convert all Approved stamps in a file to Not Approved:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.AP=="SBApproved") annot.AP = "SBNotApproved";
}
}
You can run this code as a part of an Action on multiple files, if you have Acrobat Pro.
Now, how do you find out the AP values for your old and new stamp types? Easy.
Apply the stamp to a page, click it with the mouse, open the JS Console (Ctrl+J) and then enter the following code and press Ctrl+Enter to run it:
this.selectedAnnots[0].AP
It will print out the AP value that you need to use in the code above.
Copy link to clipboard
Copied
Is this for a CUSTOM STAMP that I created or just the standard ones ?
I could not get:
01.this.selectedAnnots[0].AP
to run it gave me error:
01.this.selectedAnnots[0].AP
TypeError: 1.this is undefined
1:Console:Exec
undefined
Copy link to clipboard
Copied
I GOT IT TO RUN - THANK YOU
Copy link to clipboard
Copied
- Either one.
- "01." is not part of the code, just the line number.
Copy link to clipboard
Copied
Cool Beans and thank you !
Now I got the selectedAnnots value, how do I debug the following error ?
syntax error 1:Console:Exec undefined
Copy link to clipboard
Copied
Hard to say... Make sure you select the entire code before running it.
If it still doesn't work post your code.
Copy link to clipboard
Copied
I appear to be getting 'undefined' as response in the Java debugger when I use the exact code above:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots;
if (annot.AP=="SBApproved") annot.AP = "SBNotApproved";
}
}
I am trying to test the code to swap the 'Approved' stamp for the 'Not Approved' stamp before I insert my AP values but cannot seem to get the code to work.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now