Radio Button Group Across Multiple Pages


#1

Is it possible for one group of radio buttons to span multiple pages – for example, the first option on the bottom of page one and the second option on the top of page two? I am not able to figure out how to do this, if it is possible.


#2

@asymthe90

Thank you for contacting support.

We have devised below code snippet as per your requirements. It adds radiobutton on different pages with the help of Table wrapper. We have also attached generated PDF document for your kind reference.

RadioButtonWithOptions_19.7.pdf

Document doc = new Document();
Page page1 = doc.Pages.Add();
Aspose.Pdf.Table table1 = new Aspose.Pdf.Table();
table1.ColumnWidths = "120";
table1.Top = (float)(page1.PageInfo.Height - 100);
page1.Paragraphs.Add(table1);

Page page2 = doc.Pages.Add();
Aspose.Pdf.Table table2 = new Aspose.Pdf.Table();
table2.ColumnWidths = "120";
page2.Paragraphs.Add(table2);


Aspose.Pdf.Row r1 = table1.Rows.Add();
Aspose.Pdf.Row r2 = table2.Rows.Add();

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

RadioButtonField rf = new RadioButtonField(page1);
rf.PartialName = "radio";
doc.Form.Add(rf);

RadioButtonOptionField opt1 = new RadioButtonOptionField();
RadioButtonOptionField opt2 = new RadioButtonOptionField();

opt1.OptionName = "Item1";
opt2.OptionName = "Item2";

opt1.Width = 15;
opt1.Height = 15;
opt2.Width = 15;
opt2.Height = 15;

rf.Add(opt1);
rf.Add(opt2);

opt1.Border = new Border(opt1);
opt1.Border.Width = 1;
opt1.Border.Style = 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 = BorderStyle.Solid;
opt2.Characteristics.Border = System.Drawing.Color.Black;
opt2.DefaultAppearance.TextColor = System.Drawing.Color.Red;
opt2.Caption = new TextFragment("Item2");
c1.Paragraphs.Add(opt1);
c2.Paragraphs.Add(opt2);

dataDir = dataDir + "RadioButtonWithOptions_19.7.pdf";
// Save the PDF file
doc.Save(dataDir);

You may visit Get and Set Form Field for further information.