Apitron.PDF.Kit library for .NET
Assembly: Apitron.PDF.Kit (in Apitron.PDF.Kit.dll) Version: 2.0.37.0 (2.0.37.0)
Initializes a new instance of the Object class.
Namespace: Apitron.PDF.Kit.Interactive.Forms
Assembly: Apitron.PDF.Kit (in Apitron.PDF.Kit.dll) Version: 2.0.37.0 (2.0.37.0)
Syntax
public ChoiceField( string fieldName, string toolTip, Dictionary<string, string> options, ChoiceFieldType choiceFieldType = ChoiceFieldType.ListBox )
Parameters
- fieldName
- Type: SystemString
Name of the field. - toolTip
- Type: SystemString
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 (such as in error or status messages referring to the field). This text is also useful when extracting the document’s contents in support of accessibility to users with disabilities or for other purposes. - options
- Type: System.Collections.GenericDictionaryString, String
The choices. This dictionary represents the option’s export value and the text that shall be displayed as the name of the option. Each entry should represents the following pair: (option name : export value). - choiceFieldType (Optional)
- Type: Apitron.PDF.Kit.Interactive.FormsChoiceFieldType
Type of the choice field.
Examples
C#
string[] stringViews = new string[] { "One", "Two", "Three", "Four", "Five", "Six", "Seven" }; Dictionary<string, string> options = new Dictionary<string, string>(); for (int i = 0; i < stringViews.Length; i++) { options.Add( i.ToString(), stringViews[i] ); } ChoiceField choice = new ChoiceField("Choice#1", "Combo box", options, ChoiceFieldType.ComboBox); choice.IsMultiSelect = true; choice.SelectItem("One"); choice.SelectItem("Two"); choice.TopIndex = 5; choice.Sort = true; choice.IsEditable = true; choice.TextColor = new double[] { 0, 1, 0 }; ChoiceFieldView choiceFieldView = new ChoiceFieldView(choice, new Boundary(100, 500, 200, 510)); document.AcroForm.Fields.Add(choice); page.Annotations.Add(choiceFieldView);
See Also