Class PdfLoadedRadioButtonItem
Represents radio button field of an existing PDF document.
Inherited Members
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfLoadedRadioButtonItem : PdfLoadedStateItem
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Getting the 'Gender' radio button field
PdfLoadedRadioButtonListField radiobuttonField = doc.Form.Fields["Gender"] as PdfLoadedRadioButtonListField;
// Radio button field collection
PdfLoadedRadioButtonItemCollection radiobuttonFieldCollection = radiobuttonField.Items;
// Radio button field item
PdfLoadedRadioButtonItem radiobuttonItem = radiobuttonFieldCollection[0];
radiobuttonItem.Checked = true;
doc.Save("LoadedForm.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Getting the 'Gender' radio button field
Dim radiobuttonField As PdfLoadedRadioButtonListField = TryCast(doc.Form.Fields("Gender"), PdfLoadedRadioButtonListField)
' Radio button field collection
Dim radiobuttonFieldCollection As PdfLoadedRadioButtonItemCollection = radiobuttonField.Items
' Radio button field item
Dim radiobuttonItem As PdfLoadedRadioButtonItem = radiobuttonFieldCollection(0)
radiobuttonItem.Checked = True
doc.Save("LoadedForm.pdf")
doc.Close(True)
Properties
OptionValue
Gets an option value of the radio button.
Declaration
public string OptionValue { get; }
Property Value
Type | Description |
---|---|
System.String | The option value of the radio button field item |
Examples
// Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Gets the loaded form
PdfLoadedForm form = doc.Form;
//Set default appearance as false
form.SetDefaultAppearance(false);
// Gets the 'Gender' radio button field
PdfLoadedRadioButtonListField radioButtonField = form.Fields["Gender"] as PdfLoadedRadioButtonListField;
// Select the item which contains option value as "Male"
foreach (PdfLoadedRadioButtonItem item in radioButtonField.Items)
{
// Gets an option value of the item
if (item.OptionValue == "Male")
{
item.Selected = true;
}
}
// Save and close the PDF document
doc.Save("Form.pdf");
doc.Close(true);
' Load an existing document
Dim doc As New PdfLoadedDocument("SourceForm.pdf")
' Gets the loaded form
Dim form As PdfLoadedForm = doc.Form
'Set default appearance as false
form.SetDefaultAppearance(False)
' Gets the 'Gender' radio button field
Dim radioButtonField As PdfLoadedRadioButtonListField = TryCast(form.Fields("Gender"), PdfLoadedRadioButtonListField)
' Select the item which contains option value as "Male"
For Each item As PdfLoadedRadioButtonItem In radioButtonField.Items
' Gets an option value of the item
If item.OptionValue = "Male" Then
item.Selected = True
End If
Next
' Save and close the PDF document
doc.Save("Form.pdf")
doc.Close(True)
See Also
Selected
Gets or sets a value indicating whether this PdfLoadedRadioButtonItem is selected.
Declaration
public bool Selected { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Getting the 'Gender' radio button field
PdfLoadedRadioButtonListField radiobuttonField = doc.Form.Fields["Gender"] as PdfLoadedRadioButtonListField;
// Radio button field collection
PdfLoadedRadioButtonItemCollection radiobuttonFieldCollection = radiobuttonField.Items;
// Radio button field item
PdfLoadedRadioButtonItem radiobuttonItem = radiobuttonFieldCollection[0];
// Set the first item as selected item
radiobuttonItem.Selected = true;
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Getting the 'Gender' radio button field
Dim radiobuttonField As PdfLoadedRadioButtonListField = TryCast(doc.Form.Fields("Gender"), PdfLoadedRadioButtonListField)
' Radio button field collection
Dim radiobuttonFieldCollection As PdfLoadedRadioButtonItemCollection = radiobuttonField.Items
' Radio button field item
Dim radiobuttonItem As PdfLoadedRadioButtonItem = radiobuttonFieldCollection(0)
' Set the first item as selected item
radiobuttonItem.Selected = True
doc.Save("Form.pdf")
doc.Close(True)
See Also
Value
Gets or sets the value of the radio button.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | The value of the radio button item. |
Examples
//Load an existing document
PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
// Getting the 'Gender' radio button field
PdfLoadedRadioButtonListField radiobuttonField = doc.Form.Fields["Gender"] as PdfLoadedRadioButtonListField;
// Radio button field collection
PdfLoadedRadioButtonItemCollection radiobuttonFieldCollection = radiobuttonField.Items;
// Radio button field item
PdfLoadedRadioButtonItem radiobuttonItem = radiobuttonFieldCollection[0];
// Set the value of the item
radiobuttonItem.Value = "Male";
doc.Save("Form.pdf");
doc.Close(true);
'Load an existing document
Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
' Getting the 'Gender' radio button field
Dim radiobuttonField As PdfLoadedRadioButtonListField = TryCast(doc.Form.Fields("Gender"), PdfLoadedRadioButtonListField)
' Radio button field collection
Dim radiobuttonFieldCollection As PdfLoadedRadioButtonItemCollection = radiobuttonField.Items
' Radio button field item
Dim radiobuttonItem As PdfLoadedRadioButtonItem = radiobuttonFieldCollection(0)
' Set the value of the item
radiobuttonItem.Value = "Male"
doc.Save("Form.pdf")
doc.Close(True)