> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/uwp/forms/new-fields.md).

# Create new form fields and widget annotations in UWP

Learn how to create new form fields and widget annotations within a PDF document. Explore PDF interactive forms (AcroForms) and understand field types for optimized user engagement. The Apryse uwp SDK

To create new form fields and widget annotations within a new document.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// Create a blank page
PDFDoc doc = new PDFDoc();
Page blankPage = doc.PageCreate();

// Create a new text field and text widget/annotation (aka AcroForms).
Field textField = doc.FieldCreate("employee.name", FieldType.e_text);
TextWidget text = TextWidget.Create(doc, new Rect(110, 660, 380, 690), textField);
text.SetFont(Font.Create(doc, Font.StandardType1Font.e_times_bold));
text.RefreshAppearance();
blankPage.AnnotPushBack(text);

// Create a new signature field and signature annotation (aka AcroForms)
DigitalSignatureField sigField = doc.CreateDigitalSignatureField("employee.signature");
SignatureWidget signature = SignatureWidget.Create(doc, new Rect(0, 100, 200, 150), sigField);
signature.RefreshAppearance();
blankPage.AnnotPushBack(signature);

// Create a new checkbox field and checkbox widget/annotation (aka AcroForms)
Field checkboxField = doc.FieldCreate("employee.checkbox", FieldType.e_check);
CheckBoxWidget checkbox = CheckBoxWidget.Create(doc, new Rect(190, 490, 250, 540), checkboxField);
checkbox.SetBackgroundColor(new ColorPt(1, 1, 1), 3);
checkbox.SetBorderColor(new ColorPt(0, 0, 0), 3);
checkbox.SetChecked(true); // Check the widget (by default it is unchecked).
checkbox.RefreshAppearance();
blankPage.AnnotPushBack(checkbox);

// Create a radio button group and add three radio button widget/annotation (aka AcroForms) in it.
RadioButtonGroup radioGroup = RadioButtonGroup.Create(doc, "employee.radiogroup");
RadioButtonWidget radiobutton1 = radioGroup.Add(new Rect(140, 410, 190, 460));
radiobutton1.SetBackgroundColor(new ColorPt(1, 1, 0), 3);
radiobutton1.RefreshAppearance();
RadioButtonWidget radiobutton2 = radioGroup.Add(new Rect(310, 410, 360, 460));
radiobutton2.SetBackgroundColor(new ColorPt(0, 1, 0), 3);
radiobutton2.RefreshAppearance();
RadioButtonWidget radiobutton3 = radioGroup.Add(new Rect(480, 410, 530, 460));
radiobutton3.EnableButton(); // Enable the third radio button. By default the first one is selected
radiobutton3.SetBackgroundColor(new ColorPt(0, 1, 1), 3);
radiobutton3.RefreshAppearance();
radioGroup.AddGroupButtonsToPage(blankPage);

// Add the page as the last page in the document.
doc.PagePushBack(blankPage);
```

{% endcode %}
{% endtab %}
{% endtabs %}

[PDF interactive forms (AcroForms)](/uwp/get-started/samples.md#interactiveforms) Full code sample which illustrates some basic PDFNet capabilities related to interactive forms (also known as AcroForms).

## About creating form fields

Regardless of which field type you create, you must provide a Field name:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
Field myField = doc.FieldCreate("address", FieldType.e_text);
```

{% endcode %}
{% endtab %}
{% endtabs %}

Under most circumstances, field names must be unique. If you have a field you name as "address" and you create a second field you likewise call "address", you cannot supply different data in the two fields.

Field names can use alphanumeric characters to identify a field. All field names are case-sensitive. For example, you can use names such as empFirstName, empSecondName, empNumber, and so on for a group of fileds that are related to the same concept (in our sample employee entity).

Another technique for naming fields is to use a parent and child name. For example, you could name the above fields as follows: `employee.name.first`, `employee.name.second`, `employee.number`.

This naming convention is not only useful for organizing purposes but is well-suited for automatic operations on Fields. In the Apryse SDK, `Field.GetName()` returns a string representing the fully qualified name of the field (e.g. "employee.name.first"). To get the child name ("first") use the `Field.GetPartialName()` method.

For more information about adding Fields, see the [FDF code sample ](/uwp/get-started/samples.md#fdf).

## Understand field types

PDF offers six different field types. Each type of form field is used for a different purpose, and they have different properties, appearances, options, and actions that can be associated with the fields. In this section, we will explain how to create all the seven field types and some attributes specific to each one.

Common field types are text-box, checkbox, radio-button, combo-box, and push-button. To find out the type of the Field use `Field.GetType()` method:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
FieldType type = field.GetType();
switch (type)
{
case FieldType.e_button:
  Console.WriteLine("Button");
  break;
case FieldType.e_check:
  Console.WriteLine("Check");
  break;
case FieldType.e_radio:
  Console.WriteLine("Radio");
  break;
case FieldType.e_text:
  Console.WriteLine("Text");
  break;
case FieldType.e_choice:
  Console.WriteLine("Choice");
  break;
case FieldType.e_signature:
  Console.WriteLine("Signature");
  break;
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/uwp/forms/new-fields.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
