HiraokaHyperTools.iTextSharp-LGPL  0.2.5
iTextSharp.text.pdf.RadioCheckField Class Reference
Inheritance diagram for iTextSharp.text.pdf.RadioCheckField:
iTextSharp.text.pdf.BaseField

Public Member Functions

 RadioCheckField (PdfWriter writer, Rectangle box, String fieldName, String onValue)
 
PdfAppearance GetAppearance (bool isRadio, bool on)
 
PdfAppearance GetAppearanceRadioCircle (bool on)
 
PdfFormField GetRadioGroup (bool noToggleToOff, bool radiosInUnison)
 
- Public Member Functions inherited from iTextSharp.text.pdf.BaseField
 BaseField (PdfWriter writer, Rectangle box, String fieldName)
 
void SetRotationFromPage (Rectangle page)
 

Static Public Attributes

const int TYPE_CHECK = 1
 
const int TYPE_CIRCLE = 2
 
const int TYPE_CROSS = 3
 
const int TYPE_DIAMOND = 4
 
const int TYPE_SQUARE = 5
 
const int TYPE_STAR = 6
 
- Static Public Attributes inherited from iTextSharp.text.pdf.BaseField
const float BORDER_WIDTH_THIN = 1
 
const float BORDER_WIDTH_MEDIUM = 2
 
const float BORDER_WIDTH_THICK = 3
 
const int VISIBLE = 0
 
const int HIDDEN = 1
 
const int VISIBLE_BUT_DOES_NOT_PRINT = 2
 
const int HIDDEN_BUT_PRINTABLE = 3
 
const int READ_ONLY = PdfFormField.FF_READ_ONLY
 
const int REQUIRED = PdfFormField.FF_REQUIRED
 
const int MULTILINE = PdfFormField.FF_MULTILINE
 
const int DO_NOT_SCROLL = PdfFormField.FF_DONOTSCROLL
 
const int PASSWORD = PdfFormField.FF_PASSWORD
 
const int FILE_SELECTION = PdfFormField.FF_FILESELECT
 
const int DO_NOT_SPELL_CHECK = PdfFormField.FF_DONOTSPELLCHECK
 
const int EDIT = PdfFormField.FF_EDIT
 
const int COMB = PdfFormField.FF_COMB
 

Protected Member Functions

PdfFormField GetField (bool isRadio)
 
- Protected Member Functions inherited from iTextSharp.text.pdf.BaseField
PdfAppearance GetBorderAppearance ()
 

Properties

int CheckType [get, set]
 
string OnValue [get, set]
 
bool Checked [get, set]
 
PdfFormField RadioField [get]
 
PdfFormField CheckField [get]
 
- Properties inherited from iTextSharp.text.pdf.BaseField
BaseFont RealFont [get]
 
float BorderWidth [get, set]
 
int BorderStyle [get, set]
 
Color BorderColor [get, set]
 
Color BackgroundColor [get, set]
 
Color TextColor [get, set]
 
BaseFont Font [get, set]
 
float FontSize [get, set]
 
int Alignment [get, set]
 
string Text [get, set]
 
Rectangle Box [get, set]
 
int Rotation [get, set]
 
int Visibility [get, set]
 
string FieldName [get, set]
 
int Options [get, set]
 
int MaxCharacterLength [get, set]
 
PdfWriter Writer [get, set]
 

Additional Inherited Members

- Static Public Member Functions inherited from iTextSharp.text.pdf.BaseField
static void MoveFields (PdfDictionary from, PdfDictionary to)
 
- Static Protected Member Functions inherited from iTextSharp.text.pdf.BaseField
static ArrayList GetHardBreaks (String text)
 
static void TrimRight (StringBuilder buf)
 
static ArrayList BreakLines (ArrayList breaks, BaseFont font, float fontSize, float width)
 
- Protected Attributes inherited from iTextSharp.text.pdf.BaseField
float borderWidth = BORDER_WIDTH_THIN
 
int borderStyle = PdfBorderDictionary.STYLE_SOLID
 
Color borderColor
 
Color backgroundColor
 
Color textColor
 
BaseFont font
 
float fontSize = 0
 
int alignment = Element.ALIGN_LEFT
 
PdfWriter writer
 
String text
 
Rectangle box
 
int rotation = 0
 
int visibility
 
String fieldName
 
int options
 
int maxCharacterLength
 

Detailed Description

Creates a radio or a check field.

Example usage:

Document document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfWriter writer = PdfWriter.GetInstance(document, new FileOutputStream("output.pdf"));
document.Open();
PdfContentByte cb = writer.GetDirectContent();
RadioCheckField bt = new RadioCheckField(writer, new Rectangle(100, 100, 200, 200), "radio", "v1");
bt.SetCheckType(RadioCheckField.TYPE_CIRCLE);
bt.SetBackgroundColor(Color.CYAN);
bt.SetBorderStyle(PdfBorderDictionary.STYLE_SOLID);
bt.SetBorderColor(Color.red);
bt.SetTextColor(Color.yellow);
bt.SetBorderWidth(BaseField.BORDER_WIDTH_THICK);
bt.SetChecked(false);
PdfFormField f1 = bt.GetRadioField();
bt.SetOnValue("v2");
bt.SetChecked(true);
bt.SetBox(new Rectangle(100, 300, 200, 400));
PdfFormField f2 = bt.GetRadioField();
bt.SetChecked(false);
PdfFormField top = bt.GetRadioGroup(true, false);
bt.SetOnValue("v3");
bt.SetBox(new Rectangle(100, 500, 200, 600));
PdfFormField f3 = bt.GetRadioField();
top.AddKid(f1);
top.AddKid(f2);
top.AddKid(f3);
writer.AddAnnotation(top);
bt = new RadioCheckField(writer, new Rectangle(300, 300, 400, 400), "check1", "Yes");
bt.SetCheckType(RadioCheckField.TYPE_CHECK);
bt.SetBorderWidth(BaseField.BORDER_WIDTH_THIN);
bt.SetBorderColor(Color.black);
bt.SetBackgroundColor(Color.white);
PdfFormField ck = bt.GetCheckField();
writer.AddAnnotation(ck);
document.Close();
Author
Paulo Soares (psoar.nosp@m.es@c.nosp@m.onsis.nosp@m.te.p.nosp@m.t)

Constructor & Destructor Documentation

◆ RadioCheckField()

iTextSharp.text.pdf.RadioCheckField.RadioCheckField ( PdfWriter  writer,
Rectangle  box,
String  fieldName,
String  onValue 
)

Creates a new instance of RadioCheckField

Parameters
writerthe document PdfWriter
boxthe field location and dimensions
fieldNamethe field name. It must not be null
onValuethe value when the field is checked

Member Function Documentation

◆ GetAppearance()

PdfAppearance iTextSharp.text.pdf.RadioCheckField.GetAppearance ( bool  isRadio,
bool  on 
)

Gets the field appearance.

Parameters
isRadiotrue for a radio field and false for a check field
ontrue for the checked state, false otherwise
Exceptions
IOExceptionon error
DocumentExceptionon error
Returns
the appearance

◆ GetAppearanceRadioCircle()

PdfAppearance iTextSharp.text.pdf.RadioCheckField.GetAppearanceRadioCircle ( bool  on)

Gets the special field appearance for the radio circle.

Parameters
ontrue for the checked state, false otherwise
Returns
the appearance

◆ GetField()

PdfFormField iTextSharp.text.pdf.RadioCheckField.GetField ( bool  isRadio)
protected

Gets a radio or check field.

Parameters
isRadiotrue to get a radio field, false to get a check field
Exceptions
IOExceptionon error
DocumentExceptionon error
Returns
the field

◆ GetRadioGroup()

PdfFormField iTextSharp.text.pdf.RadioCheckField.GetRadioGroup ( bool  noToggleToOff,
bool  radiosInUnison 
)

Gets a radio group. It's composed of the field specific keys, without the widget ones. This field is to be used as a field aggregator with AddKid().

Parameters
noToggleToOffif true, exactly one radio button must be selected at all times; clicking the currently selected button has no effect. If false, clicking the selected button deselects it, leaving no button selected.
radiosInUnisonif true, a group of radio buttons within a radio button field that use the same value for the on state will turn on and off in unison; that is if one is checked, they are all checked. If false, the buttons are mutually exclusive (the same behavior as HTML radio buttons)
Returns
the radio group

Member Data Documentation

◆ TYPE_CHECK

const int iTextSharp.text.pdf.RadioCheckField.TYPE_CHECK = 1
static

A field with the symbol check

◆ TYPE_CIRCLE

const int iTextSharp.text.pdf.RadioCheckField.TYPE_CIRCLE = 2
static

A field with the symbol circle

◆ TYPE_CROSS

const int iTextSharp.text.pdf.RadioCheckField.TYPE_CROSS = 3
static

A field with the symbol cross

◆ TYPE_DIAMOND

const int iTextSharp.text.pdf.RadioCheckField.TYPE_DIAMOND = 4
static

A field with the symbol diamond

◆ TYPE_SQUARE

const int iTextSharp.text.pdf.RadioCheckField.TYPE_SQUARE = 5
static

A field with the symbol square

◆ TYPE_STAR

const int iTextSharp.text.pdf.RadioCheckField.TYPE_STAR = 6
static

A field with the symbol star

Property Documentation

◆ Checked

bool iTextSharp.text.pdf.RadioCheckField.Checked
getset

Sets the state of the field to checked or unchecked.

Parameters
checkedthe state of the field, true for checked and false for unchecked

◆ CheckField

PdfFormField iTextSharp.text.pdf.RadioCheckField.CheckField
get

Gets the check field.

Returns
the check field
Exceptions
IOExceptionon error
DocumentExceptionon error

◆ CheckType

int iTextSharp.text.pdf.RadioCheckField.CheckType
getset

Sets the checked symbol. It can be TYPE_CHECK, TYPE_CIRCLE, TYPE_CROSS, TYPE_DIAMOND, TYPE_SQUARE and TYPE_STAR.

Parameters
checkTypethe checked symbol

◆ OnValue

string iTextSharp.text.pdf.RadioCheckField.OnValue
getset

Sets the value when the field is checked.

Parameters
onValuethe value when the field is checked

◆ RadioField

PdfFormField iTextSharp.text.pdf.RadioCheckField.RadioField
get

Gets the radio field. It's only composed of the widget keys and must be used with getRadioGroup(bool,bool).

Returns
the radio field
Exceptions
IOExceptionon error
DocumentExceptionon error

The documentation for this class was generated from the following file: