ImageGear .NET v25.2 - Updated
Developer Guide / How to Work with... / PDF / How to... / Work with PDF Forms / Modify Field Appearance
In This Topic
    Modify Field Appearance
    In This Topic
    ImageGear for .NET does not support modification of forms in PDF documents containing XFA. Please see XFA Support for more information.

    The Acrofroms API supports changing visual properties of fields, such as color, border, and text information. These are properties of the Field and WidgetAnnotation.

    Widget Border and Fill Properties

    The visual appearance of a widget annotation can be changed through the BorderStyleBorderColorBorderWidth and FillColor properties of a widget annotation.

    A BorderWidth of 0 will result in no border being drawn. A BorderStyle of SOLID will be returned as the default for fields with no border. A border of INSET is initially applied to RadioGroup fields created by ImageGear.

    Example border styles:

     

    C# Example
    Copy Code
    void ModifyWidgetProperties(Field field)
    {
        foreach(WidgetAnnotation widget in field.Widgets)
        {
            // Set some fill and border colors.
            widget.FillColor = Color.Red;
            widget.BorderColor = Color.YellowGreen;
     
            // Set a thick border width (size 3).
            // Any integer can also be used.
            widget.BorderWidth = AnnotationBorderWidth.THICK;
     
            // Set a border style.
            widget.BorderStyle = AnnotationBorderStyle.DASHED;
        }
    }
    

    Field Text Properties and Fonts

    Most fields containing text have the ability to modify the FontNameFontSize, and TextColor of the displayed textual value.

    The applicable fields are TextFieldListBox,  ComboBox,  CheckBox,  SignatureField, and PushButton. Setting these properties for other fields will have no effect.

    Example FontName, FontSize, and TextColor applications to TextField:

    C# Example
    Copy Code
    void ModifyTextProperties(TextField field)
    {
        // Set some font settings.
        field.FontName = "Helvetica";
        field.FontSize = 22;
     
        // Color the text.
        field.TextColor = Color.BlanchedAlmond;
    }