Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
The radion buttons provide a way to show different options. The Form class allows you to get all the button option values for a particular radio button. You can get these values using GetButtonOptionValues method. This method requires the name of the radio button as input parameter and returns a Hashtable. You can iterate through this Hashtable to get the option values. The following code snippet shows you how to get button option values from existing PDF file.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.Pdf-for-.NET
private static void GetButtonOptions()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms();
using (var pdfForm = new Aspose.Pdf.Facades.Form())
{
// Bind PDF document
pdfForm.BindPdf(dataDir + "FormField.pdf");
// Get button option values
var optionValues = pdfForm.GetButtonOptionValues("Gender");
IDictionaryEnumerator optionValueEnumerator = optionValues.GetEnumerator();
while (optionValueEnumerator.MoveNext())
{
Console.WriteLine("Key : {0} , Value : {1} ", optionValueEnumerator.Key, optionValueEnumerator.Value);
}
}
}
Radio buttons provide a way to set option values, however one of them can be selected at a time. If you want to get the currently selected option value then you can use [GetButtonOptionCurrentValue** method. Form class provides this method. The GetButtonOptionCurrentValue method requires radio button name as input parameter and returns the value as string. The following code snippet shows you how to get current button option value from an existing PDF file.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.Pdf-for-.NET
private static void GetCurremtButtonOptionValue()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms();
using (var pdfForm = new Aspose.Pdf.Facades.Form())
{
// Bind PDF document
pdfForm.BindPdf(dataDir + "FormField.pdf");
// Get button option values
string optionValue = pdfForm.GetButtonOptionCurrentValue("Gender");
Console.WriteLine("Current Value : {0} ", optionValue);
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.