|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
WMI - Accessing PrintJob
Is there a way to identify the Print preferences from print job. Say, the total number of copies of the document, the duplex property, number of pages per sheet etc.
Was able to retrieve only the total number of pages from Win32_PrintJob .Any help on these issues will be much helpful. Thanks in advance. |
|
#2
|
||||
|
||||
|
Quote:
__________________
Click the image if at any point you don't like my decision.Scripting problems? Windows questions? Ask the Windows Guru! |
|
#3
|
|||
|
|||
|
Quote:
Nope. Win32_PrinterConfiguration will not help. It just says the printer configuration of installed printers in your machine and not the print queue's job. Print queue's configuration need not be required to be same as that of printer configuration's. For example, try changing the printer configuration while u give print from PDF doc or so. Am in search of this for a long time, yet to get a soln ![]() |
|
#4
|
||||
|
||||
|
Printer settings (page orientation, background printing, etc.) are not associated with individual print jobs. They are global printer settings that can be changed between print jobs.
Now if you are referring to document settings (i.e. print margins, etc.), those need to be changed in the host app prior to printing and cannot be manipulated once a print job is queued. |
|
#5
|
|||
|
|||
|
Quote:
Lemme explain a bit more of what am trying to achieve. Say my printer settings is set to Duplex None. When I fire a print out from an application say Adobe Reader. I can very well change the printer configurations by clicking on the print properties. Say am changing the property to Flip on Long Edge. This printer setting is valid for this print job. Am doing a programmatic pause whenever a print job is created. I can now see(visually, when i open up the corresponding printer[right click printer-> Open]) for the configurations set in my pdf print properties. If there is a way to check this visually, can't this be retrieved programatically ?Am not interested in changing any of the settings, just a retrieval of the existing settings from print job. |
|
#6
|
||||
|
||||
|
Quote:
The Win32_PrinterConfiguration class does not return the default printer options. It returns the real-time settings at the time the query is executed. |
|
#7
|
|||
|
|||
|
Quote:
Hey Nilpo, Win32_PrinterConfiguration doesn't help. It gives us the default printer settings and not the print job's. I tried this with pausing the print job and then executing the printer configuration. Please find below the code snippet used for doing the same. Please lemme know if my understanding is correct. ' Print job is paused at this point Set objPrintersConfiguration = objWMIservice.ExecQuery("SELECT * FROM Win32_PrinterConfiguration") For Each objPrinterConfiguration in objPrintersConfiguration If printerName(0) = objPrinterConfiguration.Name Then Wscript.Echo "objPrinterConfiguration.Duplex " & objPrinterConfiguration.Duplex End If Next |
|
#8
|
||||
|
||||
|
I don't see any way to do this from WMI. It would seem that you are going to need to find a way to read the actual spooled job file. These can be found in %systemroot%\System32\spool\PRINTERS. These files differ for each printer (driver) in use so I can't really help any further unless I know what model printer, etc or have a sample print job to look at.
|
|
#9
|
|||
|
|||
|
Quote:
Thanks for your help Nilpo. Am really surprised that there is no way in reading the lay out properties of a print job while I could read the general properties of the same using Win32_PrintJob . I tried out for reading out the shadow files which gets created in the directory mentioned. But unfortunately, am getting a shared access violation for the same. Is there a way by which i can read these files. And how to do the same in case of network printers? Will these files gets created in print servers ? Further, is it advisable to read these files. |
|
#10
|
||||
|
||||
|
The problem is that each print driver uses a proprietary format for creating these files. And they are in use anytime the job is paused. As for network printers, these files should be located on whatever machine the job was spooled from.
|
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > WMI - Accessing PrintJob |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|