PdfRadioButtonListField Class
Represents radio button field in the PDF form.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfRadioButtonListField : PdfField, IPdfWrapper, INotifyPropertyChanged
Remarks
Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-forms#adding-the-radio-button-field for more details.
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics g = page.Graphics;
//Create a Radiobutton
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add to document
document.Form.Fields.Add(employeesRadioList);
//Create radiobutton items
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("1-9");
radioItem1.Bounds = new RectangleF(100, 140, 20, 20);
g.DrawString("1-9", font, brush, new RectangleF(150, 145, 180, 20));
PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("10-49");
radioItem2.Bounds = new RectangleF(100, 170, 20, 20);
g.DrawString("10-49", font, brush, new RectangleF(150, 175, 180, 20));
PdfRadioButtonListItem radioItem3 = new PdfRadioButtonListItem("50-99");
radioItem3.Bounds = new RectangleF(100, 200, 20, 20);
g.DrawString("50-99", font, brush, new RectangleF(150, 205, 180, 20));
PdfRadioButtonListItem radioItem4 = new PdfRadioButtonListItem("100-499");
radioItem4.Bounds = new RectangleF(100, 230, 20, 20);
g.DrawString("100-499", font, brush, new RectangleF(150, 235, 180, 20));
PdfRadioButtonListItem radioItem5 = new PdfRadioButtonListItem("500-more");
radioItem5.Bounds = new RectangleF(100, 260, 20, 20);
g.DrawString("500-more", font, brush, new RectangleF(150, 265, 180, 20));
//add the items to radio button group
employeesRadioList.Items.Add(radioItem1);
employeesRadioList.Items.Add(radioItem2);
employeesRadioList.Items.Add(radioItem3);
employeesRadioList.Items.Add(radioItem4);
employeesRadioList.Items.Add(radioItem5);
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim g As PdfGraphics = page.Graphics
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'Create radiobutton items
Dim radioItem1 As PdfRadioButtonListItem = New PdfRadioButtonListItem("1-9")
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
g.DrawString("1-9", font, brush, New RectangleF(150, 145, 180, 20))
Dim radioItem2 As PdfRadioButtonListItem = New PdfRadioButtonListItem("10-49")
radioItem2.Bounds = New RectangleF(100, 170, 20, 20)
g.DrawString("10-49", font, brush, New RectangleF(150, 175, 180, 20))
Dim radioItem3 As PdfRadioButtonListItem = New PdfRadioButtonListItem("50-99")
radioItem3.Bounds = New RectangleF(100, 200, 20, 20)
g.DrawString("50-99", font, brush, New RectangleF(150, 205, 180, 20))
Dim radioItem4 As PdfRadioButtonListItem = New PdfRadioButtonListItem("100-499")
radioItem4.Bounds = New RectangleF(100, 230, 20, 20)
g.DrawString("100-499", font, brush, New RectangleF(150, 235, 180, 20))
Dim radioItem5 As PdfRadioButtonListItem = New PdfRadioButtonListItem("500-more")
radioItem5.Bounds = New RectangleF(100, 260, 20, 20)
g.DrawString("500-more", font, brush, New RectangleF(150, 265, 180, 20))
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
employeesRadioList.Items.Add(radioItem2)
employeesRadioList.Items.Add(radioItem3)
employeesRadioList.Items.Add(radioItem4)
employeesRadioList.Items.Add(radioItem5)
document.Save("Form.pdf")
document.Close(True)
Constructors
PdfRadioButtonListField(PdfPageBase, String)
Initializes a new instance of the PdfRadioButtonListField class with the specific page and name.
Declaration
public PdfRadioButtonListField(PdfPageBase page, string name)
Parameters
Type | Name | Description |
---|---|---|
PdfPageBase | page | Page which the field to be placed on. |
System.String | name | The name of the field. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics g = page.Graphics;
//Create a Radiobutton
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add to document
document.Form.Fields.Add(employeesRadioList);
//Create radiobutton items
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("1-9");
radioItem1.Bounds = new RectangleF(100, 140, 20, 20);
g.DrawString("1-9", font, brush, new RectangleF(150, 145, 180, 20));
PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("10-49");
radioItem2.Bounds = new RectangleF(100, 170, 20, 20);
g.DrawString("10-49", font, brush, new RectangleF(150, 175, 180, 20));
PdfRadioButtonListItem radioItem3 = new PdfRadioButtonListItem("50-99");
radioItem3.Bounds = new RectangleF(100, 200, 20, 20);
g.DrawString("50-99", font, brush, new RectangleF(150, 205, 180, 20));
PdfRadioButtonListItem radioItem4 = new PdfRadioButtonListItem("100-499");
radioItem4.Bounds = new RectangleF(100, 230, 20, 20);
g.DrawString("100-499", font, brush, new RectangleF(150, 235, 180, 20));
PdfRadioButtonListItem radioItem5 = new PdfRadioButtonListItem("500-more");
radioItem5.Bounds = new RectangleF(100, 260, 20, 20);
g.DrawString("500-more", font, brush, new RectangleF(150, 265, 180, 20));
//add the items to radio button group
employeesRadioList.Items.Add(radioItem1);
employeesRadioList.Items.Add(radioItem2);
employeesRadioList.Items.Add(radioItem3);
employeesRadioList.Items.Add(radioItem4);
employeesRadioList.Items.Add(radioItem5);
document.Save("Form.pdf");
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim g As PdfGraphics = page.Graphics
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'Create radiobutton items
Dim radioItem1 As PdfRadioButtonListItem = New PdfRadioButtonListItem("1-9")
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
g.DrawString("1-9", font, brush, New RectangleF(150, 145, 180, 20))
Dim radioItem2 As PdfRadioButtonListItem = New PdfRadioButtonListItem("10-49")
radioItem2.Bounds = New RectangleF(100, 170, 20, 20)
g.DrawString("10-49", font, brush, New RectangleF(150, 175, 180, 20))
Dim radioItem3 As PdfRadioButtonListItem = New PdfRadioButtonListItem("50-99")
radioItem3.Bounds = New RectangleF(100, 200, 20, 20)
g.DrawString("50-99", font, brush, New RectangleF(150, 205, 180, 20))
Dim radioItem4 As PdfRadioButtonListItem = New PdfRadioButtonListItem("100-499")
radioItem4.Bounds = New RectangleF(100, 230, 20, 20)
g.DrawString("100-499", font, brush, New RectangleF(150, 235, 180, 20))
Dim radioItem5 As PdfRadioButtonListItem = New PdfRadioButtonListItem("500-more")
radioItem5.Bounds = New RectangleF(100, 260, 20, 20)
g.DrawString("500-more", font, brush, New RectangleF(150, 265, 180, 20))
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
employeesRadioList.Items.Add(radioItem2)
employeesRadioList.Items.Add(radioItem3)
employeesRadioList.Items.Add(radioItem4)
employeesRadioList.Items.Add(radioItem5)
document.Save("Form.pdf")
See Also
Properties
Items
Gets the items of the radio button field.[Read-Only]
Declaration
public PdfRadioButtonItemCollection Items { get; }
Property Value
Type | Description |
---|---|
PdfRadioButtonItemCollection | The radio button field item collection. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics g = page.Graphics;
//Create a Radiobutton
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add to document
document.Form.Fields.Add(employeesRadioList);
//Create radiobutton items
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("1-9");
radioItem1.Bounds = new RectangleF(100, 140, 20, 20);
g.DrawString("1-9", font, brush, new RectangleF(150, 145, 180, 20));
//add the items to radio button group
employeesRadioList.Items.Add(radioItem1);
PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("10-49");
radioItem2.Bounds = new RectangleF(100, 170, 20, 20);
// Insert the item as first item
employeesRadioList.Items.Add(radioItem2);
// Set the selected item value
employeesRadioList.SelectedValue = "1-9";
// Getting item collection
PdfRadioButtonItemCollection itemCollection = employeesRadioList.Items;
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim g As PdfGraphics = page.Graphics
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'Create radiobutton items
Dim radioItem1 As PdfRadioButtonListItem = New PdfRadioButtonListItem("1-9")
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
g.DrawString("1-9", font, brush, New RectangleF(150, 145, 180, 20))
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
Dim radioItem2 As PdfRadioButtonListItem = New PdfRadioButtonListItem("10-49")
radioItem2.Bounds = New RectangleF(100, 170, 20, 20)
' Insert the item as first item employeesRadioList.Items.Add(radioItem2)
' Set the selected item value
employeesRadioList.SelectedValue = "1-9"
' Getting item collection
Dim itemCollection As PdfRadioButtonItemCollection = employeesRadioList.Items
document.Save("Form.pdf");
document.Close(True)
See Also
SelectedIndex
Gets or sets the first selected item in the list.
Declaration
public int SelectedIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The index of the selected item. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics g = page.Graphics;
//Create a Radiobutton
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add to document
document.Form.Fields.Add(employeesRadioList);
//Create radiobutton items
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("1-9");
radioItem1.Bounds = new RectangleF(100, 140, 20, 20);
g.DrawString("1-9", font, brush, new RectangleF(150, 145, 180, 20));
//add the items to radio button group
employeesRadioList.Items.Add(radioItem1);
// Set the selected item index index
employeesRadioList.SelectedIndex = 0;
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim g As PdfGraphics = page.Graphics
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'Create radiobutton items
Dim radioItem1 As PdfRadioButtonListItem = New PdfRadioButtonListItem("1-9")
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
g.DrawString("1-9", font, brush, New RectangleF(150, 145, 180, 20))
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
' Set the selected item index index
employeesRadioList.SelectedIndex = 0
document.Save("Form.pdf")
document.Close(True)
See Also
SelectedItem
Gets the first selected item in the list.[Read-Only]
Declaration
public PdfRadioButtonListItem SelectedItem { get; }
Property Value
Type | Description |
---|---|
PdfRadioButtonListItem | The selected item of the field. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics g = page.Graphics;
//Create a Radiobutton
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add to document
document.Form.Fields.Add(employeesRadioList);
//Create radiobutton items
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("1-9");
radioItem1.Bounds = new RectangleF(100, 140, 20, 20);
g.DrawString("1-9", font, brush, new RectangleF(150, 145, 180, 20));
//add the items to radio button group
employeesRadioList.Items.Add(radioItem1);
PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("10-49");
radioItem2.Bounds = new RectangleF(100, 170, 20, 20);
// Insert the item as first item
employeesRadioList.Items.Add(radioItem2);
// Set the selected item
employeesRadioList.SelectedItem = radioItem1;
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim g As PdfGraphics = page.Graphics
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'Create radiobutton items
Dim radioItem1 As PdfRadioButtonListItem = New PdfRadioButtonListItem("1-9")
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
g.DrawString("1-9", font, brush, New RectangleF(150, 145, 180, 20))
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
Dim radioItem2 As PdfRadioButtonListItem = New PdfRadioButtonListItem("10-49")
radioItem2.Bounds = New RectangleF(100, 170, 20, 20)
' Insert the item as first item
employeesRadioList.Items.Add(radioItem2)
' Set the selected item
employeesRadioList.SelectedItem = radioItem1
document.Save("Form.pdf")
document.Close(True)
See Also
SelectedValue
Gets or sets the value of the first selected item in the list.
Declaration
public string SelectedValue { get; set; }
Property Value
Type | Description |
---|---|
System.String | The selected value of the list field. |
Examples
//Create a new PDf document
PdfDocument document = new PdfDocument();
//Creates a new page and adds it as the last page of the document
PdfPage page = document.Pages.Add();
PdfFont font = new PdfStandardFont(PdfFontFamily.Courier, 12f);
PdfBrush brush = PdfBrushes.Black;
PdfGraphics g = page.Graphics;
//Create a Radiobutton
PdfRadioButtonListField employeesRadioList = new PdfRadioButtonListField(page, "employeesRadioList");
//Add to document
document.Form.Fields.Add(employeesRadioList);
//Create radiobutton items
PdfRadioButtonListItem radioItem1 = new PdfRadioButtonListItem("1-9");
radioItem1.Bounds = new RectangleF(100, 140, 20, 20);
g.DrawString("1-9", font, brush, new RectangleF(150, 145, 180, 20));
//add the items to radio button group
employeesRadioList.Items.Add(radioItem1);
PdfRadioButtonListItem radioItem2 = new PdfRadioButtonListItem("10-49");
radioItem2.Bounds = new RectangleF(100, 170, 20, 20);
// Insert the item as first item
employeesRadioList.Items.Add(radioItem2);
// Set the selected item value
employeesRadioList.SelectedValue = "1-9";
document.Save("Form.pdf");
document.Close(true);
'Create a new PDf document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Courier, 12f)
Dim brush As PdfBrush = PdfBrushes.Black
Dim g As PdfGraphics = page.Graphics
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'Create radiobutton items
Dim radioItem1 As PdfRadioButtonListItem = New PdfRadioButtonListItem("1-9")
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
g.DrawString("1-9", font, brush, New RectangleF(150, 145, 180, 20))
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
Dim radioItem2 As PdfRadioButtonListItem = New PdfRadioButtonListItem("10-49")
radioItem2.Bounds = New RectangleF(100, 170, 20, 20)
' Insert the item as first item
employeesRadioList.Items.Add(radioItem2)
' Set the selected item value
employeesRadioList.SelectedValue = "1-9"
document.Save("Form.pdf")
document.Close(True)
See Also
Implements
System.ComponentModel.INotifyPropertyChanged