title: How to create pdfformfields using iTextSharp?
body: <p>I am using iTextSharp and CSharp for creating the pdf. I need to add formfields like checkbox, radiobutton and dropdown which can not be edited.</p>
  
  <p>I used this..</p>
  
  <pre><code>FileStream pdffile = new FileStream(path + "/Pdf/tes.pdf",FileMode.Create);
  PdfWriter writer = PdfWriter.GetInstance(doc, pdffile);
  doc.Open(); 
  Rectangle rect = new Rectangle(100, 100, 100, 100);
  RadioCheckField checkbox = new RadioCheckField(writer, rect, "bhjabsdf", "on");
  checkbox.CheckType = RadioCheckField.TYPE_CHECK;
  PdfFormField field = checkbox.CheckField;
  writer.AddAnnotation(field);
  doc.Close();
  </code></pre>
  
  <p>But it's not working. I also read about <code>PdfStamper</code>. But I am creating a new pdf, not changing the existing one.So I don't know whether I can use <code>PdfStamper</code>?</p>
  
  <p>Thanks..</p>
  
  <p>Edit:</p>
  
  <pre><code>private void CreateRadioButton(PdfWriter writer, PdfContentByte cb,Font font)
      {
          Rectangle rect;
          PdfFormField field;
          PdfFormField radiogroup = PdfFormField.CreateRadioButton(writer, true);
          radiogroup.FieldName = "language";
          RadioCheckField radio;
          int x = 20;
          for (int i = 0; i &lt; Petrol.Length; i++)
          {
              rect = new Rectangle(440 + i * x, 692, 450 + i * x, 682);
              radio = new RadioCheckField(writer, rect, null, LANGUAGES[i]);
              radio.BorderColor = GrayColor.GRAYBLACK;
              radio.BackgroundColor = BaseColor.WHITE;
              radio.CheckType = RadioCheckField.TYPE_CIRCLE; 
  
              if (Petrol[i] == "F")
                  radio.Checked = true;
              field = radio.RadioField;
              //Here i am setting readonly..
  
              field.SetFieldFlags(PdfFormField.FF_READ_ONLY);
              radiogroup.AddKid(field);                
              ColumnText.ShowTextAligned(cb, Element.ALIGN_LEFT,
                new Phrase(Petrol[i], font), 451 + i * x, 684, 0);
              if (i &gt;= 1) x = 25;
          }
          writer.AddAnnotation(radiogroup);
      }
  </code></pre>