Class CheckboxField

CheckboxField class

Class representing checkbox field

public class CheckboxField : Field

Constructors

NameDescription
CheckboxField()Create instance of CheckboxField.
CheckboxField(Document)Constructor to use with Generator.
CheckboxField(Document, Rectangle)Constructor for CheckboxField class.
CheckboxField(Page, Rectangle)Constructor for CheckboxField class.

Properties

NameDescription
Actions { get; }Gets the annotation actions. (2 properties)
override ActiveState { get; set; }Gets or sets current annotation appearance state.
AllowedStates { get; }Returns list of allowed states.
AlternateName { get; set; }Gets or sets alternate name of the field (An alternate field name that shall be used in place of the actual field name wherever the field shall be identified in the user interface). Alternate name is used as field tooltip in Adobe Acrobat.
AnnotationIndex { get; set; }Gets or sets index of this anotation on the page.
override AnnotationType { get; }Gets type of annotation.
Appearance { get; }Gets appearance dictionary of the annotation.
Border { get; set; }Gets or sets annotation border characteristics. Border
Characteristics { get; }Gets annotation characteristics.
Checked { get; set; }Gets or sets state of check box.
Color { get; set; }Gets or sets annotation color.
Contents { get; set; }Gets or sets annotation text.
Count { get; }Gets number of subfields in this field. (For example number of items in radio button field).
DefaultAppearance { get; set; }Gets or sets default appearance of the field.
Exportable { get; set; }Gets or sets exportable flag of the field.
ExportValue { get; set; }Gets or sets export value of CheckBox field.
Flags { get; set; }Flags of the annotation.
FullName { get; }Gets full qualified name of the annotation.
virtual Height { get; set; }Gets or sets height of the annotation.
Highlighting { get; set; }Annotation highlighting mode.
virtual Hyperlink { get; set; }Gets or sets the fragment hyperlink(for pdf generator).
IsFirstParagraphInColumn { get; set; }Gets or sets a bool value that indicates whether this paragraph will be at next column. Default is false.(for pdf generation)
IsGroup { get; }Gets or sets boolean value which indicates is this field non-terminal field i.e. group of fields.
IsInLineParagraph { get; set; }Gets or sets a paragraph is inline. Default is false.(for pdf generation)
IsInNewPage { get; set; }Gets or sets a bool value that force this paragraph generates at new page. Default is false.(for pdf generation)
IsKeptWithNext { get; set; }Gets or sets a bool value that indicates whether current paragraph remains in the same page along with next paragraph. Default is false.(for pdf generation)
IsSharedField { get; set; }Property for Generator support. Used when field is added to header or footer. If true, this field will created once and it’s appearance will be visible on all pages of the document. If false, separated field will be created for every document page.
IsSynchronized { get; }Returns true if dictionary is synchronized.
Item { get; }Gets subfield contained in this field by name of the subfield. (2 indexers)
MappingName { get; set; }Gets or sets mapping name of the field that shall be used when exporting interactive form field data from the document.
Margin { get; set; }Gets or sets a outer margin for paragraph (for pdf generation)
Modified { get; set; }Gets or sets date and time when annotation was recently modified.
Name { get; set; }Gets or sets annotation name on the page.
OnActivated { get; set; }An action which shall be performed when the annotation is activated.
override PageIndex { get; }Gets index of page which contains this field.
Parent { get; }Gets annotation parent.
PartialName { get; set; }Gets or sets partial name of the field.
ReadOnly { get; set; }Gets or sets read only status of the field.
override Rect { get; set; }Gets or sets the field rectangle.
Required { get; set; }Gets or sets required status of the field.
States { get; }Gets appearance dictionary of annotation.
Style { get; set; }Gets or sets style of check box.
SyncRoot { get; }Synchronization object.
TabOrder { get; set; }Gets or sets tab order of the field.
TextHorizontalAlignment { get; set; }Gets or sets text alignment for annotation.
override Value { get; set; }Gets or sets value of check box field.
virtual VerticalAlignment { get; set; }Gets or sets a vertical alignment of paragraph
virtual Width { get; set; }Gets or sets width of the annotation.
ZIndex { get; set; }Gets or sets a int value that indicates the Z-order of the graph. A graph with larger ZIndex will be placed over the graph with smaller ZIndex. ZIndex can be negative. Graph with negative ZIndex will be placed behind the text in the page.

Methods

NameDescription
override Accept(AnnotationSelector)Accepts visitor.
AddOption(string)Adds new checkbox into a checkbox group, in which at most one of the checkboxes may be checked at any time. The new checkbox is added to the bottom of the group.
AddOption(string, Rectangle)Adds new checkbox into a checkbox group, in which at most one of the checkboxes may be checked at any time.
AddOption(string, int, Rectangle)Adds new checkbox into a checkbox group, in which at most one of the checkboxes may be checked at any time.
virtual ChangeAfterResize(Matrix)Update parameters and appearance, according to the matrix transform.
override Clone()Clone the checkbox.
CopyTo(WidgetAnnotation[], int)Copies subfields of this field into array starting from specified index.
ExecuteFieldJavaScript(JavascriptAction)Executes a specified JavaScript action for the field.
override Flatten()Removes this field and place its value directly on the page.
GetCheckedStateName()Returns name of “checked” state according to existing state names.
GetEnumerator()Returns enumerator of contained fields.
GetRectangle(bool)Returns rectangle of annotation taking into consideration page rotation.
Recalculate()Recaculates all calculated fields on the form.
virtual SetPosition(Point)Set position of the field.

Examples

The example demonstrates how to create multi-value checkbox field.

using (var document = new Document())
{
var page = document.Pages.Add();

var checkbox = new CheckboxField(page, new Rectangle(50, 50, 70, 70));

// Set the first checkbox group option value
checkbox.ExportValue = "option 1";

// Add new option right under existing ones
checkbox.AddOption("option 2");

// Add new option at the given rectangle
checkbox.AddOption("option 3", new Rectangle(100, 100, 120, 120));

document.Form.Add(checkbox);

// Select the added checkbox
checkbox.Value = "option 2";
document.Save("checkbox_group.pdf");
}

See Also