Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Obtain a Checked Appearance Name for Each Radio Button in the Radio Group

This example shows how to get a checked appearance name for each radio button and check the corresponding radio button with the obtained value.

View Example

static void Main(string[] args)
{
    // Load a document with an interactive form.
    PdfDocumentProcessor processor = new PdfDocumentProcessor();
    processor.LoadDocument(@"DocumentToFill.pdf");

    // Retrieve the form field facade:
    PdfDocumentFacade documentFacade = processor.DocumentFacade;
    PdfAcroFormFacade acroFormFacade = documentFacade.AcroForm;

    // Specify a checked appearance name for the Female radio button:
    PdfRadioGroupFormFieldFacade genderField = acroFormFacade.GetRadioGroupFormField("Gender");
    foreach (PdfFormFieldItem item in genderField.Field.Items)
    {
        if (item.Value == "Female")
            genderField.Value = item.Value;
    }

    // Save the modified document.
    processor.SaveDocument("..\\..\\Result.pdf");
}