public class JavaScript extends XmlEntityWithInternals
Represents a JavaScript in Pdf document.
[Java] //Instantiate a PDF Object Pdf pdf = new Pdf(); //Instantiate a Aspose PDF JavaScript Object pdf.setJavaScripts ( new JavaScripts()); //Call the Add method and pass JavaScript statement as an argument, to show Print Dialog pdf.getJavaScripts().add("this.print(true);"); //Call the Add method and JavaScript statement as an argument, to show alert pdf.getJavaScripts().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>
Modifier and Type | Field and Description |
---|---|
String |
ID
Gets or sets a string that indicates the ID of the JavaScript.
|
String |
ScriptContent
Gets or sets a string that indicates the JavaScript.
|
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. |
public String ScriptContent
Gets or sets a string that indicates the JavaScript.
public String ID
Gets or sets a string that indicates the ID of the JavaScript.
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.Copyright © 2014 Aspose. All Rights Reserved.