The checkPrintJobAccess()
method of the SecurityManager
class
is used to determine whether or not printing is allowed.
public void checkPrintJobAccess()
For example,
try {
SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPrintJobAccess();
// print...
}
catch (SecurityException e) {
System.err.println("Sorry. Printing is not allowed.");
}