public final class JavaScriptSettings extends Object
JSEnabler - This object is called back when a document is loaded to determine if JavaScript will be enabled. The
default is to have this field null, which implies that JavaScript is disabled. There is a simple implementation
class provided to enable / disable JavaScript: JavaScriptEnabler.
AllowPopups - This flag determines if JavaScript alerts will pop up in a message box or be printed to the console.
Note that since some alerts require user input, an Exception will be thrown if this flag is set to false when an alert
contains more than one option. Default is false.
SilenceErrors - This flag determines if formatting errors generated from predefined formats will pop up in a message box
or if the system will beep. The default setting of true means the system will beep instead of popping up a message box.
Modifier and Type | Method and Description |
---|---|
static IJavaScriptEnabler |
getJSEnabler()
Get the JavaScriptEnabler.
|
static boolean |
isAllowPopups()
Returns true if popups are allowed.
|
static boolean |
isSilenceErrors()
Returns true if errors will be silenced instead of displaying an alert.
|
static void |
setAllowPopups(boolean allowPopups)
Set to true to allow pop ups for alerts.
|
static void |
setJSEnabler(IJavaScriptEnabler enabler)
Set the JavaScriptEnabler.
|
static void |
setSilenceErrors(boolean silenceErrors)
Set to true to silence errors.
|
static boolean |
shouldEnableJS(IPDFDocument doc)
Returns true if JavaScript should be enabled for the document.
|
public static boolean shouldEnableJS(IPDFDocument doc)
doc
- The PDF document that is being loaded. This is passed on to the IJavaScriptEnabler implementation.public static void setJSEnabler(IJavaScriptEnabler enabler)
enabler
- The implementation of JavaScriptEnabler.public static IJavaScriptEnabler getJSEnabler()
public static boolean isAllowPopups()
public static void setAllowPopups(boolean allowPopups)
allowPopups
- Set to true to allow pop ups for alerts. Set to false to print alerts to standard out.public static boolean isSilenceErrors()
public static void setSilenceErrors(boolean silenceErrors)
silenceErrors
- Set to true to silence errors. Set to false to display errors in an alert.