Wednesday, April 20

How to disable Print and Print Preview options in Applet / Application level menu across the application?

I got this requirement to work and found that its quiet simple so I want to share it with you guys,you can post comments on this and provide other ways of achieving this task if any.


The Printing functions are controlled by the vanilla “PrintListService” Business Service .
With the following script in PreCanInvokeMethod event of “PrintListService” Business Service and could disable Print / Print Preview options from Application Menu and Applet Menus across the application:


function Service_PreCanInvokeMethod (MethodName, &CanInvoke)
{
if ((MethodName == 'QuickPrintApplicationMenu') || (MethodName =='QuickPrintCustomAppletMenu') || (MethodName == 'QuickPrintCustomApplicationMenu') || (MethodName == 'QuickPrintPreviewApplicationMenu') || (MethodName == 'QuickPrintPreviewCustomAppletMenu'))
{
CanInvoke = false;
return (CancelOperation);
}
return (ContinueOperation);
}


Printing option was disabled for the following:
- File > Print... (Method - 'QuickPrintCustomApplicationMenu')
- File > Print Preview... (Method - 'QuickPrintPreviewApplicationMenu')
- Menu > Print... (Method - 'QuickPrintCustomAppletMenu')
- Menu > Print Preview... (Method - 'QuickPrintPreviewCustomAppletMenu')
- QuickPrint button (Method - 'QuickPrintApplicationMenu')

Its pretty simple to achieve,try it and see

1 comments:

Anonymous said...

dint work for me. :/

Blogger Widgets