Skip to main content
A newer version of this page is available. .

PdfAcroFormRadioGroupField Class

Represents a radio group field.

Namespace: DevExpress.Pdf

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

Declaration

public class PdfAcroFormRadioGroupField :
    PdfAcroFormVisualField

The following members return PdfAcroFormRadioGroupField objects:

Remarks

To create a radio group field, call the PdfAcroFormField.CreateRadioGroup method with the specified the field name, and page number.

To add a button to the radio group field, call the PdfAcroFormRadioGroupField.AddButton method.

Use members of the PdfAcroFormRadioGroupField class to specify the radio group field properties. For example, to specify the radio group field’s selected index, and button style, use PdfAcroFormRadioGroupField.SelectedIndex, and PdfAcroFormRadioGroupField.ButtonStyle properties.

To specify the radio group field name, tooltip and appearance, use the PdfAcroFormField.Name, PdfAcroFormField.ToolTip, and PdfAcroFormVisualField.Appearance properties.

To add radio group fields to a document, pass an array of PdfAcroFormRadioGroupField objects as a parameter to the PdfDocumentProcessor.AddFormFields method.

To delete a form field from a document using a field name, call the PdfDocumentProcessor.RemoveFormField method.

To delete all interactive elements from a document, call the PdfDocumentProcessor.RemoveForm method.

Example

This example shows how to create interactive form fields (e.g., text box and radio button group fields) and add them to a document.

Imports DevExpress.Pdf

Namespace AddFormFieldsToExistingDocument
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            Using processor As New PdfDocumentProcessor()

                ' Load a document.
                processor.LoadDocument("..\..\Document.pdf")

                ' Create a text box field specifying the field name, page number, and field location on the page.
                Dim textBox As New PdfAcroFormTextBoxField("text box", 1, New PdfRectangle(230, 690, 280, 710))

                ' Specify text box text, and appearance.
                textBox.Text = "Text Box"
                textBox.Appearance.BackgroundColor = New PdfRGBColor(0.8, 0.5, 0.3)
                textBox.Appearance.FontSize = 12

                ' Create a radio group field specifying its name and the page number.
                Dim radioGroup As New PdfAcroFormRadioGroupField("Gender Group", 1)

                ' Add the first radio button to the group and specify its location using a PdfRectangle object.
                radioGroup.AddButton("button1", New PdfRectangle(230, 635, 250, 655))

                ' Add the second radio button to the group.
                radioGroup.AddButton("button2", New PdfRectangle(310, 635, 330, 655))

                ' Specify radio group selected index, and appearance. 
                radioGroup.SelectedIndex = 0
                radioGroup.Appearance.BorderAppearance = New PdfAcroFormBorderAppearance() With {.Color = New PdfRGBColor(0.8, 0.5, 0.3), .Width = 3}

                ' Add form fields to the page.
                processor.AddFormFields(textBox, radioGroup)

                ' Save the result document.
                processor.SaveDocument("..\..\Result.pdf")
            End Using
        End Sub
    End Class
End Namespace

Inheritance

See Also