Wednesday, August 5, 2009

Programatically setting default printer using lotusscript

I had a particular issue of printing problem on Lotus Notes client version below 7.0.2. I want to set a pdfCreator printer driver as default printer for print operation as the uidoc.print() will not accept a printer name as parameter.

I tried setting the pdfcreator as default printer using lotusscript code and tried printing. But what i noticed is whatever we do, Lotus Notes client will not recognize the default printer settings made programaticallyuntil you have restarted the Lotus Notes Client.

I searched several forums and also in IBM technical forum also they have made it very clear.

Changed default printer setting not used by Notes

But I found several good articles which will help to set a printer programatically using lotusscript.

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/b6a12c5af0975f65852571380061c261?OpenDocument

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/737998b4fb2386018525754a0052684f?OpenDocument

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/bc361293e222d12e852575d800646d90?OpenDocument

From my own experience what ever the case to get the progrmatically printer settings to get effect on Lotus Notes Client below 7.0.2 , you have to close and open notes client again.

Below is also a small snippet of code , whihc will programatically set a default printer.

Dim WshNetwork As Variant
Dim WshPrinters As Variant
Set WshNetwork = CreateObject("WScript.Network")
Set WshPrinters = WshNetwork.EnumPrinterConnections()
PrinterPath = "PDF Writer"
WshNetwork.SetDefaultPrinter Cstr(PrinterPath)

No comments:

Post a Comment