Class PdfRadioButtonItemCollection
Represents collection of radio buttons items.
Implements
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfRadioButtonItemCollection : PdfCollection, IEnumerable, IPdfWrapper
Remarks
This PdfRadioButtonItemCollection class is used to . 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
PdfRadioButtonItemCollection(PdfRadioButtonListField)
Initializes a new instance of the PdfRadioButtonItemCollection class with the specific PdfRadioButtonListField.
Declaration
public PdfRadioButtonItemCollection(PdfRadioButtonListField field)
Parameters
Type | Name | Description |
---|---|---|
PdfRadioButtonListField | field | The field. |
Properties
Item[Int32]
Gets the PdfRadioButtonListItem at the specified index.
Declaration
public PdfRadioButtonListItem this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
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.
Declaration
public int Add(PdfRadioButtonListItem item)
Parameters
Type | Name | Description |
---|---|---|
PdfRadioButtonListItem | item | The PdfRadioButtonListItem object to be added to collection. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the added field. |
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();
//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)
See Also
Clear()
Clears the item collection.
Declaration
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.
Declaration
public bool Contains(PdfRadioButtonListItem item)
Parameters
Type | Name | Description |
---|---|---|
PdfRadioButtonListItem | item | Check whether PdfRadioButtonListItem object is exists in the collection or not. |
Returns
Type | Description |
---|---|
System.Boolean |
|
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.
Declaration
public int IndexOf(PdfRadioButtonListItem item)
Parameters
Type | Name | Description |
---|---|---|
PdfRadioButtonListItem | item | A PdfRadioButtonListItem object whose index is requested. |
Returns
Type | Description |
---|---|
System.Int32 | 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(Int32, PdfRadioButtonListItem)
Inserts an item at the specified index.
Declaration
public void Insert(int index, PdfRadioButtonListItem item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index where to insert the new item.. |
PdfRadioButtonListItem | item | 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.
Declaration
public void Remove(PdfRadioButtonListItem item)
Parameters
Type | Name | Description |
---|---|---|
PdfRadioButtonListItem | item | 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(Int32)
Removes the item at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | 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)