Back to Devexpress

PdfAcroFormFacade.GetRadioGroupFormField(String) Method

officefileapi-devexpress-dot-pdf-dot-pdfacroformfacade-dot-getradiogroupformfield-x28-system-dot-string-x29.md

latest5.6 KB
Original Source

PdfAcroFormFacade.GetRadioGroupFormField(String) Method

Gets a specific radio group form field’s properties.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfRadioGroupFormFieldFacade GetRadioGroupFormField(
    string fullName
)
vb
Public Function GetRadioGroupFormField(
    fullName As String
) As PdfRadioGroupFormFieldFacade

Parameters

NameTypeDescription
fullNameString

A form field’s name.

|

Returns

TypeDescription
PdfRadioGroupFormFieldFacade

An object that contains the form field’s properties.

|

Remarks

The PdfRadioGroupFormFieldFacade object contains form field and widget properties without access to the form field’s inner structure. Use the Widgets property to get the widget annotations’ settings associated with the form field.

The code sample below changes the radio group value and marker style:

csharp
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf");

    PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;
    PdfAcroFormFacade acroForm = documentFacade.AcroForm;

    //Set the radio group value:
    PdfRadioGroupFormFieldFacade genderField = acroForm.GetRadioGroupFormField("Gender");
    genderField.Value = genderField.Field.Items[2].Value;

    //Change marker style for all radio buttons:
    foreach (PdfRadioButtonWidgetFacade widget in genderField.Widgets)
    {
        widget.ButtonStyle = PdfAcroFormButtonStyle.Square;
    }
    pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf");
}
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
  pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf")

  Dim documentFacade As PdfDocumentFacade = pdfDocumentProcessor.DocumentFacade
  Dim acroForm As PdfAcroFormFacade = documentFacade.AcroForm

  'Set the radio group value:
  Dim genderField As PdfRadioGroupFormFieldFacade = acroForm.GetRadioGroupFormField("Gender")
  genderField.Value = genderField.Field.Items(2).Value

  'Change marker style for all radio buttons:
  For Each widget As PdfRadioButtonWidgetFacade In genderField.Widgets
    widget.ButtonStyle = PdfAcroFormButtonStyle.Square
  Next widget
  pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf")
End Using

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetRadioGroupFormField(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

pdf-document-api-get-checked-appearance-name-for-radio-button/CS/Program.cs#L20

csharp
// Specify a checked appearance name for the Female radio button:
PdfRadioGroupFormFieldFacade genderField = acroFormFacade.GetRadioGroupFormField("Gender");
foreach (PdfFormFieldItem item in genderField.Field.Items)

pdf-document-api-fill-interactive-form-fields/CS/PdfFormFilling/PdfFormFilling.cs#L65

csharp
PdfRadioGroupFormFieldFacade genderField = acroForm.GetRadioGroupFormField("Gender");
genderField.Value = genderField.Field.Items[0].Value;

pdf-document-api-get-checked-appearance-name-for-radio-button/VB/Program.vb#L15

vb
' Specify a checked appearance name for the Female radio button:
Dim genderField As PdfRadioGroupFormFieldFacade = acroFormFacade.GetRadioGroupFormField("Gender")
For Each item As PdfFormFieldItem In genderField.Field.Items

pdf-document-api-fill-interactive-form-fields/VB/PdfFormFilling/PdfFormFilling.vb#L59

vb
Dim genderField As PdfRadioGroupFormFieldFacade = acroForm.GetRadioGroupFormField("Gender")
genderField.Value = genderField.Field.Items(0).Value

See Also

PdfAcroFormFacade Class

PdfAcroFormFacade Members

DevExpress.Pdf Namespace