Button Class | CheckBox Class | ComboBox Class | ListBox Class | RadioButton Class | TextField Class | ceTe.DynamicPDF.PageElements.Forms Namespace | JavaScriptAction Class | Programming with Generator for .NET

Language

Visual Basic

C#

Show All

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:


Button Form Field

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

[Visual Basic]
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"
[C#]
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";

Check Box Form Field

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

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

Combo Box Form Field

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

[Visual Basic]
Dim MyComboBox As ComboBox = New ComboBox( "Combo Box Name", 50, 75, 150, 25 )
MyComboBox.AddItem( "One" )
MyComboBox.AddItem( "Two" )
MyComboBox.AddItem( "Three" )
MyComboBox.BackgroundColor = RgbColor.AliceBlue
MyComboBox.BorderColor = RgbColor.DarkMagenta
MyComboBox.DefaultChoice = "One"
MyComboBox.Editable = True
MyComboBox.ToolTip = "Select"
[C#]
ComboBox comboBox = new ComboBox( "Combo Box Name", 50, 75, 150, 25 );
comboBox.AddItem( "One" );
comboBox.AddItem( "Two" );
comboBox.AddItem( "Three" );
comboBox.BackgroundColor = RgbColor.AliceBlue;
comboBox.BorderColor = RgbColor.DarkMagenta;
comboBox.DefaultChoice = "One";
comboBox.Editable = true;
comboBox.ToolTip = "Select";

List Box Form Field

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

[Visual Basic]
Dim MyListBox As ListBox = New ListBox( "List Box Name", 5, 2, 100, 150 )
MyListBox.AddItem( "One" )
MyListBox.AddItem( "Two" )
MyListBox.AddItem( "Three" )
MyListBox.BackgroundColor = RgbColor.AliceBlue
MyListBox.BorderColor = RgbColor.DarkMagenta
MyListBox.BorderStyle = BorderStyle.Dashed
MyListBox.DefaultChoice = "One"
MyListBox.Multiselect = True
MyListBox.ToolTip = "Select"
[C#]
ListBox listBox = new ListBox( "List Box Name", 5, 2, 100, 150 );
listBox.AddItem( "One" );
listBox.AddItem( "Two" );
listBox.AddItem( "Three" );
listBox.BackgroundColor = RgbColor.AliceBlue;
listBox.BorderColor = RgbColor.DarkMagenta;
listBox.BorderStyle = BorderStyle.Dashed;
listBox.DefaultChoice = "One";
listBox.Multiselect = true;
listBox.ToolTip = "Select";

Radio Button Form Field

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

[Visual Basic]
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"
[C#]
RadioButton radio1 = new RadioButton( "Radio Button Name", 50, 25, 100, 75 );
radio1.DefaultChecked = true;
radio2.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";

Text Form Field

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

[Visual Basic]
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"
[C#]
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";

See Also 

Button Class | CheckBox Class | ComboBox Class | ListBox Class | RadioButton Class | TextField Class | ceTe.DynamicPDF.PageElements.Forms Namespace | JavaScriptAction Class | Programming with Generator for .NET