JavaScriptAction

Represents a JavaScript action.

public class JavaScriptAction : OutlineAnnotationAction
Public Class JavaScriptAction
    Inherits OutlineAnnotationAction

Inheritance: ObjectActionOutlineAnnotationActionJavaScriptAction

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;

public class Example 
{
    public static void CreatePDF(string outputPath)
    {
        // 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( outputPath );
    }
}

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.

Properties

NextActionGets or sets next action for the current action.
(Inherited from OutlineAnnotationAction)

Methods

Draw(DocumentWriter)Draws the action to the specified DocumentWriter 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

ceTe.DynamicPDF

In this topic