Skip to main content
Known Participant
Jul 20, 2016 4:10 AM UTC
Answered

change font & font size in all text fields

hi, i want to change font & font size in all text fields. I have tried bellow code but it change the font size but didn't change the font. can u pls help me. thanks..

font - Courier New

font size - 10

// Loop throught the fields in the document

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

              // Get a reference to the current field

var f = getField(getNthFieldName(i));

              // Change the properties of certain types of fields

switch(f.type) {

  case "text":

f.textFont = font. Courier New; 

f.textSize = 10; 

}

}

This topic is closed to new replies. Start a new post to keep the conversation going.
George_JohnsonCorrect answer
Inspiring
Jul 20, 2016 4:54 AM UTC

Do you have a good reason for wanting to use Courier New instead of the built-in Courier font? In any case, you need change that one line to:

// Use the built-in Courier font

f.textFont = font.Cour;

- or -

// Use Courier New

f.textFont = "CourierNew";

3 replies

George_JohnsonCorrect answer
Inspiring
Jul 20, 2016 4:54 AM UTC

Do you have a good reason for wanting to use Courier New instead of the built-in Courier font? In any case, you need change that one line to:

// Use the built-in Courier font

f.textFont = font.Cour;

- or -

// Use Courier New

f.textFont = "CourierNew";

Translate
Participant
Jan 9, 2019 8:46 PM UTC

Can't font size be changed with out code for those who don't know?

Translate
try67
Community Expert
Community Expert
Jan 9, 2019 8:53 PM UTC

Sure. You can select multiple fields at once, then right-click one of them, go to Properties and change it under the Appearance tab.

Translate