Represents the button field of a interactive forms. A button is a purely interactive control that responds immediately to user input without retaining a permanent value.

public class Button : FormElement, ISerializable
Public Class Button
    Inherits FormElement
    Implements ISerializable

Inheritance: ObjectPageElementTaggablePageElementFormElementButton

Implements: ISerializable

Licensing Info

This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:


This example shows how to create an Button and Add it to the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.Forms
Imports ceTe.DynamicPDF.Text
Module MyModule
    Sub Main()
        ' Create a PDF Document
        Dim MyDocument As Document = New Document
        ' Create a PDF Page
        Dim MyPage As Page = New Page(PageSize.Letter)
        ' Create an Button
        Dim MyButton As Button = New Button("btn", 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
        Dim MyFont As OpenTypeFont = new OpenTypeFont("fontname")
        MyButton.Font = MyFont
        MyButton.Label = "Push"
        MyButton.TextColor = RgbColor.DarkGreen
        MyButton.ToolTip = "Click"
        ' Add the Button to the page
        ' Add pages to the document
        ' Save the PDF document
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.PageElements.Forms;
using ceTe.DynamicPDF.Text;

public class Example
    public static void CreatePDF(string outputPath, string fontPath)
        // Create a PDF Document
        Document document = new Document();

        // Create a PDF Page
        Page page = new Page(PageSize.Letter);

        // Create an Button
        Button button = new Button("btn", 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;
        OpenTypeFont myFont = new OpenTypeFont(fontPath);
        button.Font = myFont;
        button.Label = "Push";
        button.TextColor = RgbColor.DarkGreen;
        button.ToolTip = "Click";

        // Add the Button to the page

        // Add pages to the document

        // Save the PDF document


For more details on button fields take a look at the Interactive Forms topic.


Button(String, Single, Single, Single, Single)Creates a new instance of Button class.


ActionGets or Sets the action associated with this button.
BackgroundColorGets or Sets the fill/background color of a form field.
(Inherited from FormElement)
BehaviorGets or Sets the field’s highlighting mode, the visual effect to be used when the mouse button is pressed or held down inside its active area.
BorderColorGets or Sets the border color of a form field.
(Inherited from FormElement)
BorderStyleGets or Sets the BorderStyle .
(Inherited from FormElement)
FontGets or Sets the font for the field.
FontSizeGets or Sets the font size for the field.
HeightGets or Sets the height of a form field.
(Inherited from FormElement)
IDGets or sets the ID of the page element.
(Inherited from PageElement)
IgnoreMarginsGets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property.
(Inherited from PageElement)
ImageGets or Sets the image for the field.
ImageAppearanceGets or Sets the image appearance for the field. It is applicable to normal, down and rollover appearances.
LabelGets or Sets the label/caption of a field.
LabelImageLayoutGets or Sets the font for the field.
MappingNameGets or Sets an mapping name, of a form field.
(Inherited from FormElement)
NameGets or Sets the name of a form field.
(Inherited from FormElement)
OutputGets or sets output options for the field.
(Inherited from FormElement)
PrintableGets or Sets the form field printable on Pdf. By default its true.
(Inherited from FormElement)
ReaderEventsGets the reader events of the annotation.
(Inherited from FormElement)
ReadOnlyGets or Sets the read only property status of the form field.
(Inherited from FormElement)
RelativeToGets and sets placement of the page element on the page.
(Inherited from PageElement)
RotateGets or Sets the angle of a form field. Rotation angle should be multiple of 90, default is 0.
(Inherited from FormElement)
TagGets or sets the structure element of the form element.
(Inherited from FormElement)
TagOrderGets or sets the tag order of the taggable element.
(Inherited from TaggablePageElement)
TextColorGets or Sets the color of the text for the field.
(Inherited from FormElement)
ToolTipGets or Sets an alternate field name, of a form field.
(Inherited from FormElement)
VisibleGets or Sets the form field visible on Pdf. By default its true.
(Inherited from FormElement)
WidthGets or Sets the width of a form field.
(Inherited from FormElement)
XGets or Sets the X coordinate of a form field.
(Inherited from FormElement)
YGets or Sets the Y coordinate of a form field.
(Inherited from FormElement)


Draw(PageWriter)Draws the button to the given PageWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also


In this topic