How to select an option from RadioButtonField

Hello,

I’ve faced an issue with an option selection. I am trying to create new radio button with two options and select the first one. Here is my code:

using (Aspose.Pdf.Document document = new Aspose.Pdf.Document(@"C://sample.pdf"))
{
    Table table = new Table
    {
        ColumnWidths = "120 120"
    };

    Row row = table.Rows.Add();

    RadioButtonField radioButton = new RadioButtonField(document.Pages[1]);

    foreach (string optionName in new List<string> { "option1", "option2" })
    {
        RadioButtonOptionField option = new RadioButtonOptionField
        {
            OptionName = optionName,
            Height = 70,
            Width = 70,
            Caption = new TextFragment(optionName)
        };

        radioButton.Add(option);

        Cell cell = row.Cells.Add();
        cell.Paragraphs.Add(option);
    }

    radioButton.Options[1].Selected = true;
    radioButton.Selected = 1;

    document.Form.Add(radioButton);
    document.Pages[1].Paragraphs.Add(table);

    document.Save(@"C://result.pdf");
}

Can you please help me with this issue? Am I doing something wrong?

files.zip (37.5 KB)
image.png (29.3 KB)

Regards,
Alex

@AlexBilakovskyi

We were also able to observe that the Radio Button Option was not selected in the output. The code snippet seems fine and we need to further investigate this behavior of the API. For the purpose, we have logged a ticket as PDFNET-50234 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.