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

Batch Edit Properties on Existing Comments

New Here ,
Jul 18, 2018 Jul 18, 2018

I made many comments on several pages of a .pdf then realized I should have made them a different color.  Is there a way to batch edit the properties to change all the existing properties instead of having to change them one by one? - Danielle

TOPICS
Edit and convert PDFs
3.2K
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 ,
Jul 18, 2018 Jul 18, 2018

No problem. Here's what you need to do.

Press Ctrl+J and a window will appear. It will look something like this:

Click into the text area in the lower half of the window. If it asks you whether to enable the console, click Yes.

Select all the text in that field and delete it. Then paste the following code into the same field:

 

this.syncAnnotScan();

var annots = this.getAnnots();

if (annots!=null) {

    for (var i in annots) {

        var annot = annots[i];

        if (annot.type=="FreeText") {

            var annotContents = annot.richContents;

            for (var j in annotContents) {

                annotContents[j].textColor = color.green;

            }

            annot.setProps({richContents: annotContents});

        }

    }

}

 

Now the tricky part. Select all of that text using the keyboard (Ctrl+A) or mouse and then press Ctrl+Enter. Use the Enter key next to the number-pad, though, not the big one in the center of the keyboard. If it works the word "undefined" should appear at the bottom of the field, and the comments should be changed to green.
If something else happens, please describe what it was.

 

If it worked you can now select one of these comments using the Object Select Tool (a black cursor), right-click it, go to Properties and then tick the "Make Properties Default" box, and press OK. Any new comments you create afterwards will be green by default, so you won't need to run the script again.

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 ,
Jul 18, 2018 Jul 18, 2018

Yes, that's possible with a script. What kind of comments are they, and what color do you want to change (font color? fill color? border color? etc.), and to what color?

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 ,
Jul 18, 2018 Jul 18, 2018

They are in text format from the typewriter and lines.  I just want to change the font color from red to green.

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 ,
Jul 18, 2018 Jul 18, 2018

OK. Do you know how to use the JS Console?

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 ,
Jul 18, 2018 Jul 18, 2018

sorry - i do not.  i can work well with instructions though!

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 ,
Jul 18, 2018 Jul 18, 2018

No problem. Here's what you need to do.

Press Ctrl+J and a window will appear. It will look something like this:

Click into the text area in the lower half of the window. If it asks you whether to enable the console, click Yes.

Select all the text in that field and delete it. Then paste the following code into the same field:

 

this.syncAnnotScan();

var annots = this.getAnnots();

if (annots!=null) {

    for (var i in annots) {

        var annot = annots[i];

        if (annot.type=="FreeText") {

            var annotContents = annot.richContents;

            for (var j in annotContents) {

                annotContents[j].textColor = color.green;

            }

            annot.setProps({richContents: annotContents});

        }

    }

}

 

Now the tricky part. Select all of that text using the keyboard (Ctrl+A) or mouse and then press Ctrl+Enter. Use the Enter key next to the number-pad, though, not the big one in the center of the keyboard. If it works the word "undefined" should appear at the bottom of the field, and the comments should be changed to green.
If something else happens, please describe what it was.

 

If it worked you can now select one of these comments using the Object Select Tool (a black cursor), right-click it, go to Properties and then tick the "Make Properties Default" box, and press OK. Any new comments you create afterwards will be green by default, so you won't need to run the script again.

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 ,
Jul 19, 2018 Jul 19, 2018

that did work!!!  thank you - now i see in the script you have color.green... so say i wanted to change it to blue i would just type color.blue?

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 ,
Jul 19, 2018 Jul 19, 2018

or if i needed it a darker green?

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 ,
Jul 19, 2018 Jul 19, 2018

For blue you can use color.blue, yes.

For more custom colors you can use a generic color array, like this:

["RGB", 0.4, 0, 1]

The three values are R, G, B values, ranging from 0 to 1. So if you have values that range from 0 to 255 then you should divide then by 255 before using them.

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 ,
Jul 19, 2018 Jul 19, 2018
LATEST

Thank you!  this is awesome!  I appreciate it!.

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