cete.dynamicpdf.javascriptaction
JavaScriptAction
- Namespace: ceTe.DynamicPDF
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a JavaScript action.
public class JavaScriptAction : Action
Public Class JavaScriptAction
Inherits Action
Inheritance: Object → Action → JavaScriptAction
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 use the JavaScriptAction on a button.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements.Forms
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.Behavior = Behavior.CreatePush("downLabel", "rolloverLabel") MyButton.Label = "Push" ' 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;
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.Behavior = Behavior.CreatePush( "downLabel", "rolloverLabel" ); button.Label = "Push"; // 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 using the JavaScript action take a look at the JavaScript topic.
Constructors
JavaScriptAction(String)
Initializes a new instance of the JavaScriptAction class.
public JavaScriptAction(string javaScript)
Public Sub New (javaScript As String)
Parameters
- javaScript: String
The JavaScript code.
Methods
Draw(DocumentWriter)
Draws the action to the specified DocumentWriter object.
public void Draw(DocumentWriter writer)
Sub Draw(writer As DocumentWriter)
Parameters
- writer: DocumentWriter
The DocumentWriter object to receive the actions 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
- obj: Object
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 .