cete.dynamicpdf.documentjavascript
DocumentJavaScript
- Namespace: ceTe.DynamicPDF
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a PDF document's JavaScript entry.
public class DocumentJavaScript
Public Class DocumentJavaScript
Inheritance: Object → DocumentJavaScript
Licensing Info
This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
'Create a MyDocument and set it's properties
Dim MyDocument As ceTe.DynamicPDF.Document = New ceTe.DynamicPDF.Document
'Create a MyPage to add to the MyDocument
Dim MyPage As ceTe.DynamicPDF.Page = New ceTe.DynamicPDF.Page(PageSize.Letter, PageOrientation.Portrait, 54.0F)
'Create a label to add to the MyPage
Dim Text As String = "JavaScript Example"
Dim MyLabel As Label = New Label(Text, 0, 0, 504, 100, Font.Helvetica, 18, TextAlign.Center)
'Add the JavaScript Alert to the Document
MyDocument.JavaScripts.Add(New DocumentJavaScript("HelloWorld", "app.alert(""Hello World!!"")"))
'Add label to MyPage
MyPage.Elements.Add(MyLabel)
'Add MyPage to MyDocument
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;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a document and set it's properties
ceTe.DynamicPDF.Document document = new ceTe.DynamicPDF.Document();
// Create a page to add to the document
ceTe.DynamicPDF.Page page = new ceTe.DynamicPDF.Page( PageSize.Letter, PageOrientation.Portrait, 54.0f );
// Create a Label to add to the page
string text = "JavaScript Example";
Label label = new Label( text, 0, 0, 504, 100, Font.Helvetica, 18, TextAlign.Center );
// Add the JavaScript alert to the Document
document.JavaScripts.Add( new DocumentJavaScript( "HelloWorld", "app.alert(\"Hello World!!\")" ) );
// Add label to page
page.Elements.Add( label );
// Add page to document
document.Pages.Add( page );
// Save the PDF document
document.Draw( outputPath );
}
}
Remarks
For more details on using the document's JavaScript take a look at the JavaScript topic.
Constructors
DocumentJavaScript(String, String)
Initializes a new instance of the DocumentJavaScript class.
public DocumentJavaScript(string name, string javaScript)
Public Sub New (name As String, javaScript As String)
Parameters
- name: String
The name for the JavaScript.
- javaScript: String
The JavaScript.
Licensing Info
This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Properties
JavaScript
Gets the actual JavaScript.
public string JavaScript { get; set; }
Public Property JavaScript As String
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Name
Gets the name of the JavaScript entry.
public string Name { get; }
Public Property Name As String
Property Value
Licensing Info
This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Methods
DrawReference(DocumentWriter)
Draws a reference to the JavaScript indirect object.
public void DrawReference(DocumentWriter writer)
Sub DrawReference(writer As DocumentWriter)
Parameters
- writer: DocumentWriter
DocumentWriter object to receive the JavaScript indirect object.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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 .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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.
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
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 .
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.