public class JavaScript extends Object
Represents a JavaScript in Pdf document.
[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 |
---|
JavaScript()
Initializes a new instance of the
JavaScript class. |
JavaScript(String script)
Initializes a new instance of the
JavaScript class from a script string. |
Modifier and Type | Method and Description |
---|---|
String |
getID()
Gets or sets a string that indicates the ID of the JavaScript.
|
int |
getObjectID()
The object ID in the pdf like "8 0 obj"
|
String |
getScriptContent()
Gets or sets a string that indicates the JavaScript.
|
void |
setID(String value) |
void |
setObjectID(int value) |
void |
setScriptContent(String value) |
public JavaScript()
Initializes a new instance of the JavaScript
class.
public JavaScript(String script)
Initializes a new instance of the JavaScript
class from a script string.
script
- The script string.public String getScriptContent()
Gets or sets a string that indicates the JavaScript.
public void setScriptContent(String value)
public String getID()
Gets or sets a string that indicates the ID of the JavaScript.
public void setID(String value)
public int getObjectID()
The object ID in the pdf like "8 0 obj"
public void setObjectID(int value)
Copyright © 2016 Aspose. All Rights Reserved.