public class JavaScripts
extends com.aspose.ms.System.Collections.CollectionBase
Represents a collection of JavaScript
objects.
[c#] //Instantiate a PDF Object Pdf pdf = new Pdf(); //Instantiate a Aspose PDF JavaScript Object pdf.JavaScripts = new JavaScripts(); //Call the Add method and pass JavaScript statement as an argument, to show Print Dialog pdf.JavaScripts.Add("this.print(true);"); //Call the Add method and JavaScript statement as an argument, to show alert pdf.JavaScripts.Add("app.alert(\"hello world\");"); //Save Pdf Document pdf.Save(@"d:\test\test.pdf"); [VB.Net] 'Instantiate a PDF Object Dim pdf As Pdf = New Pdf() 'Instantiate a Aspose PDF JavaScript Object pdf.JavaScripts = New JavaScripts() 'Call the Add method and pass JavaScript statement as an argument, to show Print Dialog pdf.JavaScripts.Add("this.print(true);") 'Call the Add method and JavaScript statement as an argument, to show alert pdf.JavaScripts.Add("app.alert(\"hello world\");") 'Save Pdf Document pdf.Save("d:\test\test.pdf") [XML] <Pdf xmlns="Aspose.Pdf"> <JavaScript ID="js1">this.print(true);</JavaScript> <JavaScript>app.alert("hello world");</JavaScript> </Pdf>
Constructor and Description |
---|
JavaScripts() |
Modifier and Type | Method and Description |
---|---|
JavaScript |
add()
Initializes a new instance of the
JavaScript class and add
it to the JavaScripts collection. |
void |
add(JavaScript script)
Adds a new
JavaScript object into the collection. |
JavaScript |
add(String script)
Initializes a new instance of the
JavaScript class and add
it to the JavaScripts collection. |
JavaScript |
get_Item(int index)
Gets or sets a
JavaScript object from the collection according to JavaScript index. |
JavaScript |
get_Item(String jsID)
Gets or sets a
JavaScript object from the collection according to JavaScript ID. |
int |
indexOf(JavaScript js)
Gets the index of a specified JavaScript in the collection.
|
void |
insert(int index,
JavaScript js)
Inserts a new
JavaScript object into the collection at specified position. |
void |
remove(Cell jsToRemove)
Removes a
JavaScript object from the collection. |
void |
set_Item(int index,
JavaScript value) |
void |
set_Item(String jsID,
JavaScript value) |
public JavaScript add()
Initializes a new instance of the JavaScript
class and add
it to the JavaScripts collection.
JavaScript
object that is created.public void add(JavaScript script)
Adds a new JavaScript
object into the collection.
script
- The JavaScript
object to be added.public JavaScript add(String script)
Initializes a new instance of the JavaScript
class and add
it to the JavaScripts collection.
script
- The content of the script.JavaScript
object that is created.public JavaScript get_Item(int index)
Gets or sets a JavaScript
object from the collection according to JavaScript index.
get_Item
in interface com.aspose.ms.System.Collections.IList
get_Item
in class com.aspose.ms.System.Collections.CollectionBase
public void set_Item(int index, JavaScript value)
public JavaScript get_Item(String jsID)
Gets or sets a JavaScript
object from the collection according to JavaScript ID.
public void set_Item(String jsID, JavaScript value)
public void insert(int index, JavaScript js)
Inserts a new JavaScript
object into the collection at specified position.
index
- The zero-based index at which JavaScript
object should be
inserted.js
- The JavaScript
object to be inserted.public void remove(Cell jsToRemove)
Removes a JavaScript
object from the collection.
jsToRemove
- The JavaScript
object to be romoved.public int indexOf(JavaScript js)
Gets the index of a specified JavaScript in the collection.
js
- The specified JavaScript
object.Copyright © 2016 Aspose. All Rights Reserved.