Multiple RadioButton Groups (using FormEditor)

Is there an example somewhere of creating two or three separate RadioButton groups on the same page using the FormEditor (so that each of the radio buttons has text next to them).


I have used the FormEditor.Items (which will create multiple RadioButtons next to each other when FormEditor.AddField is called, but it doesn’t give me any text).

Is there a “Best Practices” or “Standard” way of adding a RadioButton list to using the FormEditor?

Hi John,


Thanks for your inquiry. We are looking into your requirements and will get back to you soon.

Best Regards,

One other issue I’m having (dealing with RadioButtons) is that no matter what size I specify, the RadioButtons are always the default size. I have tried to make them 10x10 and 100x100 and they both render the same size RadioButton… any ideas?


FormEditor frm = new FormEditor(pdf);
frm.Items = new string[] { “Test” };
frm.AddField(FieldType.Radio, “RadioButton0”, 1, 20, 700, 30, 710);
frm.AddField(FieldType.Radio, “RadioButton1”, 1, 50, 700, 150, 800);

Hi John,


We are sorry for the inconvenience. I’m afraid, FormEditor class doesn’t allow to add text caption/label to Radio buttons and I’ve also noticed that rectangle size has no impact on Radio buttons size. After initial investigation, I’ve logged following tickets in our issue tracking system for further investigation and resolution. We will update you as soon as its resolved.

PDFNEWNET-35868: Caption/label of Radio button (Enhancement)
PDFNEWNET-35869: Radio button size issue (Bug)

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-35869) have been fixed in Aspose.Pdf for .NET 8.7.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi John,


Thanks for your patience. As mentioned above RadioButton size issue has been fixed and please check following code snippet for setting radio button size. Hopefully it will serve the purpose. Moreover, we will notify you via this forum thread as soon as PDFNEWNET-35868 is implemented.


FormEditor formEditor = new FormEditor();

formEditor.BindPdf(myDir + "helloworld.pdf");

//RadioHoriz is true by default for horizontal placement. Set it false to place radio buttons vertical.

//formEditor.RadioHoriz = false;

formEditor.Items = new string[] { "AAA", "BBB", "CCC" };

formEditor.Facade = new FormFieldFacade();

formEditor.Facade.Caption = "Group1";

formEditor.Facade.BorderWidth = 1;

formEditor.Facade.BorderColor = System.Drawing.Color.Black;

formEditor.Facade.BorderStyle = FormFieldFacade.BorderStyleInset;

formEditor.RadioButtonItemSize = 10;

formEditor.RadioGap = 20;

formEditor.AddField(FieldType.Radio, "AddedRadioButtonField", "BBB", 1, 110, 130, 300, 430);

formEditor.Items = new string[] { "DDD", "EEE", "FFF" };

formEditor.Facade = new FormFieldFacade();

formEditor.Facade.Caption = "Group2";

formEditor.Facade.BorderWidth = 1;

formEditor.Facade.BorderColor = System.Drawing.Color.Black;

formEditor.Facade.BorderStyle = FormFieldFacade.BorderStyleInset;

formEditor.RadioButtonItemSize = 20;

formEditor.RadioGap = 20;

formEditor.AddField(FieldType.Radio, "AddedRadioButtonField1", "EEE", 1, 110, 250, 210, 330);

//save updated file

formEditor.Save(myDir + "output_radiobutton.pdf");


Please feel free to contact us for any further assistance.


Best Regards,

Hi John,


Thanks for your inquiry. We have further investigated the issue(PDFNEWNET-35868) and would like to recommend to use new generator in order to provide captions for radio button items. Caption is specified by Caption property of RadioButtonOptionField. Please check following code snippet for details.

Document doc = new
Document();<o:p></o:p>

Aspose.Pdf.Page page = doc.Pages.Add();

Aspose.Pdf.Table table = new Aspose.Pdf.Table();

table.ColumnWidths = "120 120 120";

page.Paragraphs.Add(table);

Aspose.Pdf.Row r1 = table.Rows.Add();

Aspose.Pdf.Cell c1 = r1.Cells.Add();

Aspose.Pdf.Cell c2 = r1.Cells.Add();

Aspose.Pdf.Cell c3 = r1.Cells.Add();

RadioButtonField rf = new RadioButtonField(page);

rf.PartialName = "radio";

doc.Form.Add(rf, 1);

RadioButtonOptionField opt1 = new RadioButtonOptionField();

RadioButtonOptionField opt2 = new RadioButtonOptionField();

RadioButtonOptionField opt3 = new RadioButtonOptionField();

opt1.OptionName = "AAA";

opt2.OptionName = "BBB";

opt3.OptionName = "CCC";

opt1.Width = 15;

opt1.Height = 15;

opt2.Width = 15;

opt2.Height = 15;

opt3.Width = 15;

opt3.Height = 15;

rf.Add(opt1);

rf.Add(opt2);

rf.Add(opt3);

opt1.Border = new Border(opt1);

opt1.Border.Width = 1;

opt1.Border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;

opt1.Characteristics.Border = System.Drawing.Color.Black;

opt1.DefaultAppearance.TextColor = System.Drawing.Color.Red;

opt1.Caption = new TextFragment("Item1");

opt2.Border = new Border(opt1);

opt2.Border.Width = 1;

opt2.Border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;

opt2.Characteristics.Border = System.Drawing.Color.Black;

opt2.DefaultAppearance.TextColor = System.Drawing.Color.Red;

opt2.Caption = new TextFragment("Item2");

opt3.Border = new Border(opt1);

opt3.Border.Width = 1;

opt3.Border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;

opt3.Characteristics.Border = System.Drawing.Color.Black;

opt3.DefaultAppearance.TextColor = System.Drawing.Color.Red;

opt3.Caption = new TextFragment("Item3");

c1.Paragraphs.Add(opt1);

c2.Paragraphs.Add(opt2);

c3.Paragraphs.Add(opt3);

doc.Save(outFile);


Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan