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.

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