Radio Button

In c#, I have loaded an existing pdf document into a Aspose.Pdf.Document and want to select a radio button that is in a group. I have tried
        Field field = (Field)FaxDocument.Form["topmostSubform[0].Page1[0].Priority[0]"];
        for (int x = 1; x < 5; x++)
        {
            field[x].ActiveState = RadioIndex == x ? "On" : "Off";
        }

but that just hides the specified radio button.

The documentation does not seem to cover radio buttons very well.


Hi,

Thanks for contacting support and sorry for the delayed response.

In order to select radio button from group, please try using following code snippet.

[C#]

// Open document
Document pdfDocument = new Document("c:/pdftest/RadioButton_Added.pdf");

// Get a field
Aspose.Pdf.InteractiveFeatures.Forms.RadioButtonField radioField = pdfDocument.Form["radio"] as Aspose.Pdf.InteractiveFeatures.Forms.RadioButtonField;

// specify the index of radio button from group
radioField.Selected = 2;

// Save the updated document
pdfDocument.Save("c:/pdftest/FilledRadioButton_output.pdf");