Skip to main content
All docs
V25.1
  • PdfAcroFormRadioGroupField.AddButton(String, PdfRectangle, String) Method

    Adds a radio button to the radio group field.

    Namespace: DevExpress.Pdf

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

    NuGet Package: DevExpress.Pdf.Core

    Declaration

    public void AddButton(
        string name,
        PdfRectangle rect,
        string toolTip = null
    )

    Parameters

    Name Type Description
    name String

    The radio button mane.

    rect PdfRectangle

    A page area where the radio button should be located.

    Optional Parameters

    Name Type Default Description
    toolTip String null

    The tooltip text.

    Remarks

    Tip

    Add buttons with the same name on different pages so they are selected and unselected simultaneously.

    The following code snippet creates a radio group form field with four buttons - two on the first page, and two on the second page:

    button

    using DevExpress.Pdf;
    
    using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    {
        // Load a document
        processor.LoadDocument("..\\..\\Document.pdf");
    
        // Create a radio group field
        PdfAcroFormRadioGroupField radioGroup =
           new PdfAcroFormRadioGroupField("Contact Group", 1);
    
        // Add the first radio button to the group
        radioGroup.AddButton("button1", new PdfRectangle(230, 635, 250, 655));
    
        // Add the same radio button on the second page
        radioGroup.AddButton("button1", 2, new PdfRectangle(230, 635, 250, 655));
    
        // Add the second radio button to the group
        radioGroup.AddButton("button2", new PdfRectangle(310, 635, 330, 655));
    
        // Add the same button on the second page
        radioGroup.AddButton("button2", 2, new PdfRectangle(310, 635, 330, 655));
    
        // Specify radio group selected index and appearance
        radioGroup.SelectedIndex = 0;
        radioGroup.Appearance.BorderAppearance = new PdfAcroFormBorderAppearance() 
        { 
            Color = new PdfRGBColor(0.8, 0.5, 0.3), 
            Width = 3 
        };
    
        // Add a form field to the page
        processor.AddFormFields(textBox, radioGroup);
    
        // Save the result
        processor.SaveDocument("..\\..\\Result.pdf");
    }
    
    See Also