Copy link to clipboard
Copied
Hi everyone, I would like to change the font in a text field.
It´s not a global change. It would affect only a specific group of text fields in a given
page.
I found the script: this.getField("Textfield").textFont = "Font name"
but it is not working. Please let me know if I´m doing anything wrong.
Thanks a lot!!
The code seems fine. The tricky part is knowing the actual internal name of the font you want to use, as you can't just use the name that appears in the font selection list.
The best way of finding out that name is by manually assigning this font to a field (let's say it's called "Text1") and then running this code from the JS Console:
this.getField("Text1").textFont;
It will print out the internal name of that font, and you can then use that in your real script to apply it to other fields i
...Copy link to clipboard
Copied
You may want to share the exact script thatis not working for your or an example of that PDF in order to get better assistance.
Copy link to clipboard
Copied
What happens when you use the script? Any error in the Javascript console?
Copy link to clipboard
Copied
The code seems fine. The tricky part is knowing the actual internal name of the font you want to use, as you can't just use the name that appears in the font selection list.
The best way of finding out that name is by manually assigning this font to a field (let's say it's called "Text1") and then running this code from the JS Console:
this.getField("Text1").textFont;
It will print out the internal name of that font, and you can then use that in your real script to apply it to other fields in the file.
Copy link to clipboard
Copied
Thanks a lot for yor tip and advice!
The problem was: My desired font´s name has two words. Using your method, I found out that
it is actually written as one word. Now, everything worked perfectly!!