Table of Contents

Class PdfRadioButtonItemCollection

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents collection of radio buttons items.

public class PdfRadioButtonItemCollection : PdfCollection, IEnumerable
Inheritance
PdfRadioButtonItemCollection
Implements
Inherited Members

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)

Remarks

This PdfRadioButtonItemCollection class is used to . Please refer the UG docuemntation link for more details.

Constructors

PdfRadioButtonItemCollection(PdfRadioButtonListField)

Initializes a new instance of the PdfRadioButtonItemCollection class with the specific PdfRadioButtonListField.

public PdfRadioButtonItemCollection(PdfRadioButtonListField field)

Parameters

field PdfRadioButtonListField

The field.

See Also

Properties

this[int]

Gets the PdfRadioButtonListItem at the specified index.

public PdfRadioButtonListItem this[int index] { get; }

Parameters

index int

Property Value

PdfRadioButtonListItem

Returns item at the specified position.

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();
//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);
// Gets the first item from the collection
PdfRadioButtonListItem item = employeesRadioList.Items[0];
document.Save("Form.pdf");
document.Close(true);
'Create a Radiobutton
Dim employeesRadioList As PdfRadioButtonListField = New PdfRadioButtonListField(page, "employeesRadioList")
'Add to document
document.Form.Fields.Add(employeesRadioList)
'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)
' Gets the first item from the collection
Dim item As PdfRadioButtonListItem = employeesRadioList.Items(0)
document.Save("Form.pdf")
document.Close(True)
See Also

Methods

Add(PdfRadioButtonListItem)

Adds the specified item.

public int Add(PdfRadioButtonListItem item)

Parameters

item PdfRadioButtonListItem

The PdfRadioButtonListItem object to be added to collection.

Returns

int

The index of the added 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();
//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);
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()
'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)
document.Save("Form.pdf")
document.Close(True)

Remarks

Please refer the UG docuemntation link for more details.

See Also

Clear()

Clears the item collection.

public void Clear()

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();
//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);
// Clears the item
employeesRadioList.Items.Clear();
document.Save("Form.pdf");
document.Close(true);
'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)
' Clears the item
employeesRadioList.Items.Clear()
document.Save("Form.pdf")
document.Close(True)
See Also

Contains(PdfRadioButtonListItem)

Determines whether the collection contains the specified item.

public bool Contains(PdfRadioButtonListItem item)

Parameters

item PdfRadioButtonListItem

Check whether PdfRadioButtonListItem object is exists in the collection or not.

Returns

bool

true if collection contains specified item; otherwise, false.

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();
//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);
// Check whether the specified item is in Collection
if (employeesRadioList.Items.Contains(radioItem1))
 MessageBox.Show("Item already added in the collection");
else
 //add the items to radio button group
 employeesRadioList.Items.Add(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()
'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)
' Check whether the specified item is in Collection
If employeesRadioList.Items.Contains(radioItem1) Then
 MessageBox.Show("Item already added in the collection")
Else
  'add the items to radio button group
  employeesRadioList.Items.Add(radioItem1)
End If
document.Save("Form.pdf")
document.Close(True)
See Also

IndexOf(PdfRadioButtonListItem)

Gets the index of the item within the collection.

public int IndexOf(PdfRadioButtonListItem item)

Parameters

item PdfRadioButtonListItem

A PdfRadioButtonListItem object whose index is requested.

Returns

int

Index of the item with the 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();
//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);
// Find the index
int index = employeesRadioList.Items.IndexOf(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()
'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)
' Find the index
Dim index As Integer = employeesRadioList.Items.IndexOf(radioItem1)
document.Save("Form.pdf")
document.Close(True)
See Also

Insert(int, PdfRadioButtonListItem)

Inserts an item at the specified index.

public void Insert(int index, PdfRadioButtonListItem item)

Parameters

index int

The index where to insert the new item..

item PdfRadioButtonListItem

A PdfRadioButtonListItem object to be added to 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();
//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.Insert(0, radioItem2);
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()
'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.Insert(0, radioItem2)
document.Save("Form.pdf")
document.Close(True)
See Also

Remove(PdfRadioButtonListItem)

Removes the specified item from the collection.

public void Remove(PdfRadioButtonListItem item)

Parameters

item PdfRadioButtonListItem

The PdfRadioButtonListItem object which is to be removed from the 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();
//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);
// Remove the item
employeesRadioList.Items.Remove(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()
'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)
' Remove the item
employeesRadioList.Items.Remove(radioItem1)
document.Save("Form.pdf")
document.Close(True)
See Also

RemoveAt(int)

Removes the item at the specified index.

public void RemoveAt(int index)

Parameters

index int

The index where to remove the 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();
//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);
// Remove the item
employeesRadioList.Items.RemoveAt(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()
'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)
' Remove the item
employeesRadioList.Items.RemoveAt(0)
document.Save("Form.pdf")
document.Close(True)
See Also

See Also