Interactive Forms

An interactive form, sometimes referred to as an AcroForm, is a collection of fields for gathering information interactively from the user. A PDF document may contain any number of fields, appearing on any combination of pages, all of which make up a single, global interactive form spanning the entire document.

Field Types

Interactive forms support the following field types.

Field Description
Button fields Button fields represent interactive controls on the screen a user can click. They include push buttons, check boxes, and radio buttons.
Text fields Text fields are boxes or spaces in which the user can enter text from the keyboard.
Check Box fields Check Box fields are interactive controls that a user can toggle between.
Radio Button fields Radio Button fields are a set of related toggles that at most one can be selected.
Choice fields Choice fields contain several text items; only one value may be selected at a time. They include scrollable list boxes and combo boxes.
Signature fields Signature fields are boxes or spaces in which a digital signature can be placed.

Form field content can be validated for formatting or for auto filling values with JavaScript using AnnotationReaderEvents. Please refer to the JavaScript topic for more information.

Button Form Field

This example shows how to create a Button and add it to the page.

Button button = new Button( "Button Name", 50, 50, 100, 50 );
button.Action = new JavaScriptAction( "app.alert('Hello');" );
button.BackgroundColor = RgbColor.AliceBlue;
button.Behavior = Behavior.CreatePush( "downLabel", "rolloverLabel" );
button.BorderColor = RgbColor.BlueViolet;
button.BorderStyle = BorderStyle.Beveled;
button.Label = "Push";
button.TextColor = RgbColor.DarkGreen;
button.ToolTip = "Click";       
Dim MyButton As Button = New Button("Button Name", 50, 50, 100, 50)
MyButton.Action = New JavaScriptAction( "app.alert('Hello');" )
MyButton.BackgroundColor = RgbColor.AliceBlue
MyButton.Behavior = Behavior.CreatePush( "downLabel", "rolloverLabel" )
MyButton.BorderColor = RgbColor.BlueViolet
MyButton.BorderStyle = BorderStyle.Beveled
MyButton.Label = "Push"
MyButton.TextColor = RgbColor.DarkGreen
MyButton.ToolTip = "Click"

Check Box Form Field

This example shows how to create an Check Box and add it to the page.

CheckBox checkBox = new CheckBox( "Check Box Name", 5, 7, 50, 50 );
checkBox.DefaultChecked = true;
checkBox.ToolTip = "Check it";        
Dim MyCheckBox As CheckBox = New CheckBox( "Check Box Name", 5, 7, 50, 50 )
MyCheckBox.DefaultChecked = true
MyCheckBox.ToolTip = "Check it" 

Combo Box Form Field

This example shows how to create a Combo Box and add it to the page.

ComboBox comboBox = new ComboBox( "Combo Box Name", 50, 75, 150, 25 );
comboBox.Items.Add( "One", true );
comboBox.Items.Add( "Two" );
comboBox.Items.Add( "Three" );
comboBox.BackgroundColor = RgbColor.AliceBlue;
comboBox.BorderColor = RgbColor.DarkMagenta;
comboBox.Editable = true;
comboBox.ToolTip = "Select";        
Dim MyComboBox As ComboBox = New ComboBox( "Combo Box Name", 50, 75, 150, 25 )
MyComboBox.Items.Add( "One",true )
MyComboBox.Items.Add( "Two" )
MyComboBox.Items.Add( "Three" )
MyComboBox.BackgroundColor = RgbColor.AliceBlue
MyComboBox.BorderColor = RgbColor.DarkMagenta
MyComboBox.Editable = True
MyComboBox.ToolTip = "Select"  

List Box Form Field

This example shows how to create a List Box and add it to the page.

ListBox listBox = new ListBox( "List Box Name", 5, 2, 100, 150 );
listBox.Items.Add( "One",true );
listBox.Items.Add( "Two",true );
listBox.Items.Add( "Three" );
listBox.BackgroundColor = RgbColor.AliceBlue;
listBox.BorderColor = RgbColor.DarkMagenta;
listBox.BorderStyle = BorderStyle.Dashed;
listBox.Multiselect = true;
listBox.ToolTip = "Select";        
Dim MyListBox As ListBox = New ListBox( "List Box Name", 5, 2, 100, 150 )
MyListBox.Items.Add( "One",true )
MyListBox.Items.Add( "Two",true )
MyListBox.Items.Add( "Three" )
MyListBox.BackgroundColor = RgbColor.AliceBlue
MyListBox.BorderColor = RgbColor.DarkMagenta
MyListBox.BorderStyle = BorderStyle.Dashed
MyListBox.Multiselect = True
MyListBox.ToolTip = "Select"   

Radio Button Form Field

This example shows how to create a Radio Button and add it to the page.

RadioButton radio1 = new RadioButton( "Radio Button Name", 50, 25, 100, 75 );
radio1.DefaultChecked = true;
radio1.ExportValue = "abc";
radio1.ToolTip = "first";
RadioButton radio2 = new RadioButton( "Radio Button Name", 50, 140, 100, 75 );
radio2.ExportValue = "def";
radio2.ToolTip = "second";
RadioButton radio3 = new RadioButton( "Radio Button Name", 50, 250, 100, 75 );
radio3.ExportValue = "ghi";
radio3.ToolTip = "third";        
Dim MyRadio1 As RadioButton = New RadioButton( "Radio Button Name", 50, 25, 100, 75 )
MyRadio1.DefaultChecked = true
MyRadio1.ExportValue = "abc"
MyRadio1.ToolTip = "first"
Dim MyRadio2 As RadioButton = New RadioButton( "Radio Button Name", 50, 140, 100, 75 )
MyRadio2.ExportValue = "def"
MyRadio2.ToolTip = "second"
Dim MyRadio3 As RadioButton = New RadioButton( "Radio Button Name", 50, 250, 100, 75 )
MyRadio3.ExportValue = "ghi"
MyRadio3.ToolTip = "third"  

Text Form Field

This example shows how to create a Text Field and add it to the page.

TextField textField = new TextField( "Text Field Name", 50, 75, 150, 100 );
textField.TextAlign = Align.Center;
textField.BackgroundColor = RgbColor.AliceBlue;
textField.BorderColor = RgbColor.DeepPink;
textField.Font = Font.TimesItalic;
textField.FontSize = 16.0f;
textField.TextColor = RgbColor.Brown;
textField.DefaultValue = "ceTe Software";
textField.MultiLine = true;
textField.ToolTip = "Text";        
Dim MyTextField As TextField = New TextField( "Text Field Name", 50, 75, 150, 100 )
MyTextField.TextAlign = Align.Center
MyTextField.BackgroundColor = RgbColor.AliceBlue
MyTextField.BorderColor = RgbColor.DeepPink
MyTextField.Font = Font.TimesItalic
MyTextField.FontSize = 16.0f
MyTextField.TextColor = RgbColor.Brown
MyTextField.DefaultValue = "ceTe Software"
MyTextField.MultiLine = true
MyTextField.ToolTip = "Text" 

Signature Form Field

This example shows how to create a Signature and add it to the page.

Signature signature = new Signature("MySigField", 10, 10, 300, 100);
OpenTypeFont font  = new OpenTypeFont("fontname");
signature.Font = font;
signature.FullPanel.SetImage(@"C:\MyImage.gif");
signature.LeftPanel.TextColor = RgbColor.Red;        
Dim MySignature As Signature = New Signature("MySigField", 10, 10, 300, 100)
Dim MyFont As OpenTypeFont = New OpenTypeFont("fontname")
MySignature.Font = MyFont
MySignature.FullPanel.SetImage("C:\MyImage.gif")

MySignature.LeftPanel.TextColor = RgbColor.Red

In this topic