I am hoping someone can help me. I am struggiling to create a PDF that has multiple radio button form fields on the same section (1 after the other) I am using the latest version of aspose PDF and starting with a blank PDF document that is created in code (PDF pdf = new PDF()
public override bool RenderOffline(Aspose.Pdf.Generator.Pdf pdf, ApplicationFormDocumentType documentType,Aspose.Pdf.Generator.Section section)
{
section.Paragraphs.Add(new Text(string.Format("{0} {1}", this.ShowName ? this.Name : “”, this.Details != string.Empty ? string.Format("
{0}", this.Details) : “”)));
Aspose.Pdf.Generator.Table tab1 = new Aspose.Pdf.Generator.Table();
// set the border for table objeect
tab1.Border = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 1F);
// set border to table cells
tab1.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 1F);
tab1.ColumnWidths = “120 120 120”;
section.Paragraphs.Add(tab1);
//Add a row to the table
Aspose.Pdf.Generator.Row r1 = tab1.Rows.Add();
foreach (var item in this.Items)
{
Aspose.Pdf.Generator.Cell c1 = r1.Cells.Add(item.Text);
c1.Padding.Left = 30;
c1.Paragraphs[0].ID = item.Text + this.ID.ToString();
}
Aspose.Pdf.Generator.FormField radio = new Aspose.Pdf.Generator.FormField();
radio.FormFieldType = Aspose.Pdf.Generator.FormFieldType.RadioButton;
radio.FieldName = this.ID.ToString();
radio.ButtonColor = System.Drawing.Color.FromName(“Red”);
radio.RadioButtonCheckedIndex = 0;
radio.IsBordered = false;
radio.BorderColor = System.Drawing.Color.FromName(“Red”);
foreach (var item in this.Items)
{
Aspose.Pdf.Generator.RadioButton bt1 = radio.RadioButtons.Add();
bt1.ButtonHeight = 12;
bt1.ButtonWidth = 12;
bt1.PositioningType = Aspose.Pdf.Generator.PositioningType.ParagraphRelative;
bt1.ReferenceParagraphID = item.Text + this.ID.ToString();
bt1.Left = -20;
bt1.Top = 0;
}
section.Paragraphs.Add(radio);
section.Paragraphs.Add(new Text(“test”));
return true;
}