Custom Fonts in Form Fields
When styling interactive form fields, use the SetDefaultFont(string FontName, int FontSize, Color FontColor) method to apply a custom font, size, and color to the field and its associated annotations in a single call.
For most cases, SetDefaultFont is all you need. If you require full control over the raw PDF operators, you can instead drive the font, size, and color directly through the field's DefaultAppearance property, which takes a string of raw PDF drawing instructions.
Solution
1. Apply a custom font with SetDefaultFont
Load the document, grab the field, and call SetDefaultFont with the font name, size, and color:
using IronPdf;
using IronSoftware.Drawing;
var pdf = PdfDocument.FromFile("FilledForm.pdf");
TextFormField field = pdf.Form[0] as TextFormField;
// Apply the font, size, and color in one call:
field.SetDefaultFont("AdobeThai-Bold", 15, new Color("#E42237"));
field.Value = "This is size 15";
pdf.SaveAs("customformfieldvalue15.pdf");
using IronPdf;
using IronSoftware.Drawing;
var pdf = PdfDocument.FromFile("FilledForm.pdf");
TextFormField field = pdf.Form[0] as TextFormField;
// Apply the font, size, and color in one call:
field.SetDefaultFont("AdobeThai-Bold", 15, new Color("#E42237"));
field.Value = "This is size 15";
pdf.SaveAs("customformfieldvalue15.pdf");
Imports IronPdf
Imports IronSoftware.Drawing
Dim pdf = PdfDocument.FromFile("FilledForm.pdf")
Dim field As TextFormField = TryCast(pdf.Form(0), TextFormField)
' Apply the font, size, and color in one call:
field.SetDefaultFont("AdobeThai-Bold", 15, New Color("#E42237"))
field.Value = "This is size 15"
pdf.SaveAs("customformfieldvalue15.pdf")
The named font must be installed on the machine rendering the document.
2. Set the appearance string by hand (low-level fallback)
Load the document, grab the field, and assign a DefaultAppearance string that describes the font, size, and color:
var pdf = PdfDocument.FromFile("FilledForm.pdf");
TextFormField field = pdf.Form[0] as TextFormField;
// Manually define the appearance string:
// Format: /{FontName}-{Weight} {FontSize} Tf {R} {G} {B} rg
field.DefaultAppearance = "/AdobeThai-Bold 15 Tf 0.898 0.133 0.215 rg";
field.Value = "This is size 15";
pdf.SaveAs("customformfieldvalue15.pdf");
var pdf = PdfDocument.FromFile("FilledForm.pdf");
TextFormField field = pdf.Form[0] as TextFormField;
// Manually define the appearance string:
// Format: /{FontName}-{Weight} {FontSize} Tf {R} {G} {B} rg
field.DefaultAppearance = "/AdobeThai-Bold 15 Tf 0.898 0.133 0.215 rg";
field.Value = "This is size 15";
pdf.SaveAs("customformfieldvalue15.pdf");
Imports System
Dim pdf = PdfDocument.FromFile("FilledForm.pdf")
Dim field As TextFormField = TryCast(pdf.Form(0), TextFormField)
' Manually define the appearance string:
' Format: /{FontName}-{Weight} {FontSize} Tf {R} {G} {B} rg
field.DefaultAppearance = "/AdobeThai-Bold 15 Tf 0.898 0.133 0.215 rg"
field.Value = "This is size 15"
pdf.SaveAs("customformfieldvalue15.pdf")
The string is parsed as PDF text operators, so the font you name must be installed on the machine rendering the document.
3. Read the appearance string
Each token in the string maps to one part of the field's styling:
/AdobeThai-Bold: the font name and weight. This font must be installed on the system.15 Tf: the font size, here 15 pt.0.898 0.133 0.215 rg: the RGB color, in this case a reddish shade.
The manual appearance string gives you full control over the font and color of form field text when you need to work with the raw PDF operators directly; for most cases, SetDefaultFont is the simpler choice.

