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

Editing text fields

New Here ,
Jan 13, 2016 Jan 13, 2016

When editing a PDF and needing to change the text style throughout all text box fields is there a way that I can select every single field or automatcially set the font size and style.  I have not been able to figure this out and it consumes a lot of time to have to select each individual text field/highlight and select the ones that are on the current page and edit them that way.  It would save me so much time if I could just edit them all at once.

TOPICS
Acrobat SDK and JavaScript
824
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 ,
Jan 13, 2016 Jan 13, 2016

Depends what kind of "text fields" you're referring to. Are these actual form fields? If so then it can be quite easily done with a script.

Also free-text annotations can be edited using a script, but it's more complex. If you're referring to static content on the page then it's not possible, 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
New Here ,
Jan 14, 2016 Jan 14, 2016

They are text fields that I am creating in the document. 

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 ,
Jan 14, 2016 Jan 14, 2016

OK. So let's say you want to set them all to font-size 12. You can run this code from the console:

for (var i=0; i<this.numFields; i++) {

    var f = this.getField(this.getNthFieldName(i));

    if (f==null) continue;

    if (f.type=="text") {

        f.textSize = 12;

    }

}

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 ,
Jan 14, 2016 Jan 14, 2016

Okay so I want all the font to be Courier New Bold size 9.  Is that possible with the code you posted?

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
LEGEND ,
Jan 14, 2016 Jan 14, 2016

Yes, I think so check out the JS API Reference for available properties.

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 ,
Jan 14, 2016 Jan 14, 2016
LATEST

Add this line of code after line 5 of the code above:

f.textFont = "CourierNew,Bold";

If you're interested, by the way, I've developed a tool that allows you to easily perform such tasks without having to know how to write scripts.

You can purchase it from here: Custom-made Adobe Scripts: Acrobat -- Mass Edit Fields Properties

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 ,
Jan 14, 2016 Jan 14, 2016

I have no idea what JS API is.  Sorry...I am new to adobe.

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
LEGEND ,
Jan 14, 2016 Jan 14, 2016

Solving this is really a task for a programmer, I fear. This is the problem with saying something can "easily" be done in a script. If you are adventurous you can find where that code is setting point size and set it to 9 instead, but you won't get there with just copy/paste...

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 ,
Jan 14, 2016 Jan 14, 2016

I see.  I don't even know how to get to or find codes.  I was just hoping there would be a way so it would save me a lot of time.  I really appreciate all your help.

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