Class PdfRadioButtonListItem
Represents an item of a radio button list.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfRadioButtonListItem : PdfCheckFieldBase, INotifyPropertyChanged, IPdfWrapper
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
PdfRadioButtonListItem()
Initializes a new instance of the PdfRadioButtonListItem class.
Declaration
public PdfRadioButtonListItem()
PdfRadioButtonListItem(String)
Initializes a new instance of the PdfRadioButtonListItem class with the specific value.
Declaration
public PdfRadioButtonListItem(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Properties
Bounds
Gets or sets the bounds.
Declaration
public override RectangleF Bounds { get; set; }
Property Value
Type |
---|
RectangleF |
Overrides
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);
//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)
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
document.Save("Form.pdf")
document.Close(True)
See Also
Form
Gets the form of the field.[Read-Only]
Declaration
public override PdfForm Form { get; }
Property Value
Type | Description |
---|---|
PdfForm | The PdfForm object of the field. |
Overrides
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);
// Gets the form
PdfForm form = employeesRadioList.Form;
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)
' Gets the form
Dim form As PdfForm = employeesRadioList.Form
document.Save("Form.pdf")
document.Close(True)
See Also
Value
Gets or sets the value.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | The value. |
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();
radioItem1.Value = "1-9";
radioItem1.Bounds = new RectangleF(100, 140, 20, 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()
radioItem1.Value = "1-9"
radioItem1.Bounds = New RectangleF(100, 140, 20, 20)
'add the items to radio button group
employeesRadioList.Items.Add(radioItem1)
document.Save("Form.pdf")
document.Close(True)
See Also
Methods
DrawAppearance()
Draws the appearance.
Declaration
protected override void DrawAppearance()
Overrides
Initialize()
Initializes instance.
Declaration
protected override void Initialize()
Overrides
Implements
System.ComponentModel.INotifyPropertyChanged