How To Add RadioButton To PDF Document In PDF Mosiac .NET SDK

This sample shows how to use radio buttons in your PDF document.
Use PDFRadioButton class to add a radio button.

PDF Radio button

 

using PDFMosaic;
using System;

namespace RadioButtons
{
    class RadioButtons
    {
        static void Main()
        {
            PDFDocument document = new PDFDocument();
            PDFPage page = new PDFPage(PDFPaperFormat.A4);

            PDFRadioButton radioBtn1 = new PDFRadioButton(20, 60, 15, 15, "group1", "english");
            PDFRadioButton radioBtn2 = new PDFRadioButton(20, 80, 15, 15, "group1", "russian");

            page.Annotations.Add(radioBtn1);
            page.Annotations.Add(radioBtn2);

            PDFFont fnt = new PDFFont(PDFStandardFont.Helvetica, 10);
            PDFSolidBrush br = new PDFSolidBrush();
            page.Canvas.DrawString("Select language", fnt, br, 20, 40);

            br.Color = new PDFColorRGB(255, 0, 0);
            page.Canvas.DrawString("English", fnt, br, 40, 60);
            page.Canvas.DrawString("Russian", fnt, br, 40, 80);

            document.Pages.Add(page);
            document.Save("RadioButtons.pdf", true);
        }
    }
}