public final class JSEngine
extends java.lang.Object
PDFViewer
.
This requires a JavaScript implementation, which means at least Java 1.6
or the use of Mozilla Rhino.
Although this class is public there is generally no reason to call the methods in this class directly, unless you're implementing your own PDF Viewer or modifying the JavaScript security permissions.
Constructor and Description |
---|
JSEngine(JSCoreMethods core)
Create a new JSEngine
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getImplementationDescription()
Get a human-readable description of the JavaScript implementation
|
java.lang.String |
getImplementationType()
Get a the type of JavaScript implementation
|
boolean |
runEvent(JSEvent event)
Raise and run the specified JavaScript event.
|
boolean |
runEvent(JSEvent event,
int index)
Raise and run the specified JavaScript event.
|
static void |
setPermissions(java.security.Permissions perms)
Set the Permissions that are allowed for any JavaScript run by the
PDF Library.
|
public JSEngine(JSCoreMethods core)
core
- the JSCoreMethods implementation to usepublic java.lang.String getImplementationDescription()
public java.lang.String getImplementationType()
public static void setPermissions(java.security.Permissions perms)
Set the Permissions that are allowed for any JavaScript run by the PDF Library. The JavaScript engines supplied with most Java 1.6 implementations and Mozilla Rhino both allow access to the full Java class hierarchy, so it's important to place restrictions on what actions JavaScript in a PDF can perform, otherwise simply setting a field value with the PDF library could run any Java commands on your system.
By default, a minimal set of the permissions are in place. Enforcing permissions
requires a SecurityManager
, and the JavaScript engine will install one
if none is set.
public boolean runEvent(JSEvent event)
event.rc
- true if the event succeeded, false otherwisepublic boolean runEvent(JSEvent event, int index)
PDFAction.getNext()
method), this method
allows you to run the later events in the chain.index
- the index into the chain for the action to run - 0 is the first action in the listevent.rc
- true if the event succeeded, false otherwiseCopyright © 2001-2021 Big Faceless Organization