As described in ISO-32000-1, a check box is a field of type Button. If you define text for a button, you want to define the text that appears on the button. However: in the case of a flag, there is no such text! Instead, you have two views: one for the value Off and one for the value Yes .
An enthusiastic assumption made by an attentive reader will be that you do not want to add text (to the button), but want to add a shortcut (for the check box). Again, you should refer to ISO-32000-1, and you will find that the specification says nothing about the labels for the flags. The concept simply does not exist at the AcroForm level.
This does not mean that the concept does not exist at all. Many PDF tools let you check the boxes preceded by a label. When you look inside the PDF file, you will find that this shortcut is part of the content, and the checkbox is represented by the orientation of the widgets.
Let me take a look at the official documentation, and not to upset yourself anywhere on the Internet except the official website. In particular: take a look at the Buttons from chapter 7 of my book. You will see that you can set the text for the real button:
PushbuttonField button = new PushbuttonField(writer, rect, "Buttons"); button.setText("Push me");
This is not possible with flags (for the obvious reason that the appearance of the flag is completely different). If we want to add a label, we can add it, for example, as follows:
checkbox = new RadioCheckField(writer, rect, LANGUAGES[i], "Yes"); field = checkbox.getCheckField(); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Off", onOff[0]); field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL, "Yes", onOff[1]); writer.addAnnotation(field); ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, new Phrase(LANGUAGES[i], font), 210, 790 - i * 40, 0);
Here you can find the C # version of the following examples: http://tinyurl.com/itextsharpIIA2C07