# How do I change the font size or text color on a PDF form field?

Question

Is it possible to change the font size of an PDF field?

You can set the default appearance string for the field as
follows:

``````string da_str = "/Helv 0 Tf 0 g ";
my_field.GetSDFObj().PutString("DA", da_str);

// Refresh the appearance...
my_field.EraseAppearance();
my_field.RefreshAppearance();
``````

The number value preceding ‘Tf’ in da_str indicates the desired font
size. Value 0 means that the font size should be selected
automatically so that text fills out the field.

The following are some default appearances that you may play with
during testing:

``````"/Helv 14 Tf 0 g "; // font size is fixed to 14pts. Text is black.
"/Helv 12 Tf 1 0 0 rg "; // font size is fixed to 12pts. Text color is red.
``````