Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

PdfAcroFormRadioGroupField.AddButton(String, PdfRectangle) Method

Adds a radio button to the radio group field. The button is added to the page where the form field is located.

Namespace: DevExpress.Pdf

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

NuGet Package: DevExpress.Pdf.Core

Declaration

public void AddButton(
    string name,
    PdfRectangle rect
)

Parameters

Name Type Description
name String

The name of a radio button.

rect PdfRectangle

A page area where the radio button should be located.

Example

This example creates a text box and radio button group fields, and adds them to a document.

added fields

using DevExpress.Pdf;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document:
    processor.LoadDocument("..\\..\\Document.pdf");

    // Create a text box field:
    PdfAcroFormTextBoxField textBox =
         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:
    PdfAcroFormRadioGroupField radioGroup =
         PdfAcroFormField.CreateRadioGroup("Gender Group", 1);


    // Add the first radio button to the group and specify its location:
    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's selected index and appearance:
    radioGroup.SelectedIndex = 0;
    radioGroup.Appearance.BorderAppearance = new PdfAcroFormBorderAppearance()
    { Color = new PdfRGBColor(0.8, 0.5, 0.3), Width = 3 };

    // Add form fields to the page:
    processor.AddFormFields(textBox, radioGroup);

    // Save the resulting document:
    processor.SaveDocument("..\\..\\Result.pdf");
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddButton(String, PdfRectangle) 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.

See Also