I tried to create radio button using the code from http://www.aspose.com/docs/display/pdfnet/Add+Form+Field+in+a+PDF+Document , but I am getting this error:
Hi Sung,
string outFile = myDir + “Form_out.pdf”;<o:p></o:p>
Document doc = new Document();
Page page = doc.Pages.Add();
//Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
//Add the table in paragraphs collection of the desired section
page.Paragraphs.Add(tab1);
//Set with column widths of the table
tab1.ColumnWidths = "100 100";
//Create rows in the table and then cells in the rows
RadioButtonField rf = new RadioButtonField(page);
rf.PartialName = "radio";
doc.Form.Add(rf, 1);
RadioButtonOptionField opt1 = new RadioButtonOptionField();
RadioButtonOptionField opt2 = new RadioButtonOptionField();
opt1.OptionName = "Item1";
opt2.OptionName = "Item2";
opt1.Width = 12;
opt1.Height = 12;
opt2.Width = 12;
opt2.Height = 12;
rf.Add(opt1);
rf.Add(opt2);
opt1.Caption = new TextFragment("Item10");
opt1.Border = new Border(opt1);
opt1.Border.Width = 1;
opt1.Border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;
opt1.Characteristics.Border = System.Drawing.Color.Yellow;
opt1.DefaultAppearance.TextColor = System.Drawing.Color.Red;
opt2.Caption = new TextFragment("Item11");
opt2.Border = new Border(opt1);
opt2.Border.Width = 1;
opt2.Border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;
opt2.Characteristics.Border = System.Drawing.Color.Yellow;
opt2.DefaultAppearance.TextColor = System.Drawing.Color.Red;
Aspose.Pdf.Row row = tab1.Rows.Add();
Aspose.Pdf.Cell c1 = row.Cells.Add();
c1.Paragraphs.Add(opt1);
Aspose.Pdf.Cell c2 = row.Cells.Add();
c2.Paragraphs.Add(opt2);
doc.Save(outFile);
Please feel free to contact us for any further assistance.
Best Regards,