I have used WMInterface to do this, but it is not setting the paper
size.(below is the code)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_PrinterConfiguration",,48)
For Each objItem in colItems
Wscript.Echo "PaperSize: " & objItem.PaperSize
objItem.PaperSize = 8
Wscript.Echo "PaperSize: " & objItem.PaperSize
Next
It is outputting paper size as 8(A3) but, it does not printout in A3.
Can anyone suggest the correct way of setting the papersize or printer
properties?
thanks
1. you need to download Windows resource kit tools. This is freely
downloadable.
Have a look at the help file also, in Allprograms-->windows resource kit
tools->Windows resource kit tools help.html
2. One of the tools in this took kit is, Setprinter.exe, spooler
configuration tool
3. Then I used the following code in VBS to achieve this.
Dim Wshshell, setpnra3, myprinter
Set Wshshell= CreateObject("WScript.Shell")
myprinter = "printer name"
setpnra3 = "setprinter " &_
"""" & myprinter & """" & " 2 " & """" & "pdevmode=dmpapersize=8" & """"
' size = 8 for A3, size 9 for A4 etc.
intRC = WshShell.Run(setpnra3, 0, TRUE)
if intRC <> 0 then
WScript.Echo "Error returned from Setting the Printer " & intRC
WScript.Quit
End If
4. Setprinter.exe can set printer settings to different levels. I have
used level "2" which has most of the printer settings, in pDevmode.
Remember, this sets "myprinter" to this new settings.
5. For the remote printers, if the access is denied, then you can not set
using this command. Work around to this is, Install the Remote pritner
locally, to a new local port( there is a procedure in Microsoft web site) and
then change the settings to this local printer. I have done this way, it
works fine.
6. Using this setprinter, you can set most of the printer settings(this is
not application based, will change the printer settings globally).
The following can be set:- in pdevmode
dmorientation = 1 (P) or 2 (L)
dmpapersize=9(a4), 8(a3)etc
dmcopies=1
dmdefaultsource=7
dmprintquality=600
dmcolor=1monochrome 2 color
dmduplex=1no.2 yes
dmyresolution=600
dmTToption=2 (True type fonts)
dmcollate=1 on 2 off
dmbitsperpel =4
dmICMmethod =1
dmICMintent=3
dmMediatype=1 plain
Hope this helps. If you have any issues, I will be glad to help, If I know.
regards
Please shorten / refine it a little.
Then go through the pain to provide an alternative scripting language.
E.g. javascript.
----------------------------------------------
"Subbu" <Su...@discussions.microsoft.com> wrote in message
news:4FDA2E39-8752-4094...@microsoft.com...
i was very happy to find that good explanation. it works finw for the most
of my settings. but when i want to change "nup" (number of virtual pages on
physical page), i got the message of success but when i look into the printer
settings nothing is changed..? do you know why? i checked every level (0-9 )
and tried it with many different printers...
thanky and greats
gallus