Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I mass swap custom stamps ?

New Here ,
Jun 06, 2019 Jun 06, 2019

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

1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jun 06, 2019 Jun 06, 2019

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.

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2019 Jun 06, 2019

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 06, 2019 Jun 06, 2019

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 06, 2019 Jun 06, 2019

I GOT IT TO RUN - THANK YOU

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2019 Jun 06, 2019

- Either one.

- "01." is not part of the code, just the line number.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2019 Jun 07, 2019

Cool Beans and thank you !

Now I got the selectedAnnots value, how do I debug the following error ?

syntax error 1:Console:Exec undefined

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2019 Jun 07, 2019

Hard to say... Make sure you select the entire code before running it.

If it still doesn't work post your code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 18, 2021 Nov 18, 2021
LATEST

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. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines