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 IdentityProperties |
getIdentityProperties()
Returns a static object that identifies the current user of the application.
|
static IJavaScriptEnabler |
getJSEnabler()
Get the JavaScriptEnabler.
|
static boolean |
isAllowPopups()
Returns true if popups are allowed.
|
static boolean |
isMailDocWarn()
Returns true if the user will have the option to proceed with emailing the document when mailDoc() is called.
|
static boolean |
isSilenceErrors()
Returns true if errors will be silenced instead of displaying an alert.
|
static boolean |
isSubmitFormWarn()
Returns true if the user will have the option to proceed with connecting to a URL and submitting the form when submitForm() is called.
|
static void |
setAllowPopups(boolean allowPopups)
Set to true to allow pop ups for alerts.
|
static void |
setIdentityProperties(IdentityProperties identity)
Sets a static object that identifies the current user of the application.
|
static void |
setJSEnabler(IJavaScriptEnabler enabler)
Set the JavaScriptEnabler.
|
static void |
setMailDocWarn(boolean mailDocWarn)
Set to true to warn/ask the user before emailing the document when mailDoc() is called.
|
static void |
setSilenceErrors(boolean silenceErrors)
Set to true to silence errors.
|
static void |
setSubmitFormWarn(boolean submitFormWarn)
Set to true to warn/ask the user before connecting to a URL and submitting the form when submitForm() is called.
|
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.public static void setIdentityProperties(IdentityProperties identity)
public static IdentityProperties getIdentityProperties()
public static boolean isSubmitFormWarn()
public static void setSubmitFormWarn(boolean submitFormWarn)
submitFormWarn
- Set to true to warn/ask the user before connecting to a URL.public static boolean isMailDocWarn()
public static void setMailDocWarn(boolean mailDocWarn)
mailDocWarn
- Set to true to warn/ask the user before emailing the document.