Skip to main content

Button

Version: 6.0

cete.dynamicpdf.pageelements.forms.button

Button​

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: Object → PageElement → TaggablePageElement → FormElement → Button

Implements: ISerializable

Licensing​

This class is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:

  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

Examples​

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 MyPage.Elements.Add(MyButton) ' Add pages to the document MyDocument.Pages.Add(MyPage)
' Save the PDF document MyDocument.Draw("C:\MyDocument.pdf") End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements.Forms;
using ceTe.DynamicPDF.Text;

class MyClass
{static void Main(){ // 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("fontname");
button.Font = myFont; button.Label = "Push"; button.TextColor = RgbColor.DarkGreen; button.ToolTip = "Click"; // Add the Button to the page page.Elements.Add( button ); // Add pages to the document document.Pages.Add( page ); // Save the PDF document document.Draw( @"C:\MyDocument.pdf" );}
}

Remarks​

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

NOTE: This page element cannot be used within a table cell, or tranformation group.

Constructors​

Button(String, Single, Single, Single, Single)​

Creates a new instance of Button class.

public Button(string name, float x, float y, float width, float height)
Public Sub New (name As String, x As Single, y As Single, width As Single, height As Single)

Parameters​

Name of a button.

X coordinate of a button.

Y coordinate of a button.

Width of a button.

Height of a button.

Properties​

Action​

Gets or Sets the action associated with this button.

public Action Action { get; set; }
Public Property Action As Action

Property Value​

Action

BackgroundColor​

Gets or Sets the fill/background color of a form field. (Inherited from FormElement)

public RgbColor BackgroundColor { get; set; }
Public Property BackgroundColor As RgbColor

Property Value​

RgbColor

Behavior​

Gets 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.

public Behavior Behavior { get; set; }
Public Property Behavior As Behavior

Property Value​

Behavior

BorderColor​

Gets or Sets the border color of a form field. (Inherited from FormElement)

public DeviceColor BorderColor { get; set; }
Public Property BorderColor As DeviceColor

Property Value​

DeviceColor

BorderStyle​

Gets or Sets the BorderStyle . (Inherited from FormElement)

public BorderStyle BorderStyle { get; set; }
Public Property BorderStyle As BorderStyle

Property Value​

BorderStyle

Font​

Gets or Sets the font for the field.

public Font Font { get; set; }
Public Property Font As Font

Property Value​

Font

FontSize​

Gets or Sets the font size for the field.

public float FontSize { get; set; }
Public Property FontSize As Single

Property Value​

Single

Height​

Gets or Sets the height of a form field. (Inherited from FormElement)

public float Height { get; set; }
Public Property Height As Single

Property Value​

Single

ID​

Gets or sets the ID of the page element. (Inherited from PageElement)

public string ID { get; set; }
Public Property ID As String

Property Value​

String

Label​

Gets or Sets the label/caption of a field.

public string Label { get; set; }
Public Property Label As String

Property Value​

String

MappingName​

Gets or Sets an mapping name, of a form field. (Inherited from FormElement)

public string MappingName { get; set; }
Public Property MappingName As String

Property Value​

String

Name​

Gets or Sets the name of a form field. (Inherited from FormElement)

public string Name { get; set; }
Public Property Name As String

Property Value​

String

Printable​

Gets or Sets the form field printable on pdf. By default its true. (Inherited from FormElement)

public bool Printable { get; set; }
Public Property Printable As Boolean

Property Value​

Boolean

ReadOnly​

Gets or Sets the read only property status of the form field. (Inherited from FormElement)

public bool ReadOnly { get; set; }
Public Property ReadOnly As Boolean

Property Value​

Boolean

Rotate​

Gets or Sets the angle of a form field. Rotation angle should be multiple of 90, default is 0. (Inherited from FormElement)

public int Rotate { get; set; }
Public Property Rotate As Int32

Property Value​

Int32

Tag​

Gets or sets the structure element of the form element. (Inherited from FormElement)

public Tag Tag { get; set; }
Public Property Tag As Tag

Property Value​

Tag

Licensing​

This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:

  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

TagOrder​

Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)

public int TagOrder { get; set; }
Public Property TagOrder As Int32

Property Value​

Int32

TextColor​

Gets or Sets the color of the text for the field. (Inherited from FormElement)

public DeviceColor TextColor { get; set; }
Public Property TextColor As DeviceColor

Property Value​

DeviceColor

ToolTip​

Gets or Sets an alternate field name, of a form field. (Inherited from FormElement)

public string ToolTip { get; set; }
Public Property ToolTip As String

Property Value​

String

Visible​

Gets or Sets the form field visible on pdf. By default its true. (Inherited from FormElement)

public bool Visible { get; set; }
Public Property Visible As Boolean

Property Value​

Boolean

Width​

Gets or Sets the width of a form field. (Inherited from FormElement)

public float Width { get; set; }
Public Property Width As Single

Property Value​

Single

X​

Gets or Sets the X coordinate of a form field. (Inherited from FormElement)

public float X { get; set; }
Public Property X As Single

Property Value​

Single

Y​

Gets or Sets the Y coordinate of a form field. (Inherited from FormElement)

public float Y { get; set; }
Public Property Y As Single

Property Value​

Single

Methods​

Draw(PageWriter)​

Draws the button to the given PageWriter object.

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the button's output.

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF.PageElements.Forms