0

How to determine if printer is xps? I found way to get property "Published" from wmi (it set to false if device is not physical), but i want to determine if printer is xps writer. Thanks

seza
  • 60
  • 5
  • Unless the user changes the name of the printer (unlikely), could you not just go on the name? It is called "XPS Writer", after all. – Arran Sep 16 '13 at 11:16
  • I can use any printer identifiers or info that can be retrived from wmi or registry etc. – seza Sep 16 '13 at 11:27
  • 2
    Are you trying to determine if the printer is the "Xps Document Writer", or just any XPS print driver? Why do you need this information? There may be a simpler way to achieve your goal. – Jon Sep 16 '13 at 13:17

2 Answers2

0

Printers are defined by the driver they use, not their name, so an XPS printer will use the driver Microsoft XPS Document Writer. This will be a reliable test until a third party creates another XPS print driver with a different name, which I don't expect to happen anytime soon, if ever.

Carey Gregory
  • 6,836
  • 2
  • 26
  • 47
  • 1
    I created an XPS print driver with a different name. Also the Microsoft Enhanced Point and Print driver is an XPS driver. Finally Windows 8 comes with XPS Mono and XPS Color generic drivers. – Tony Edgecombe Dec 20 '13 at 18:32
  • I stand corrected, but it's still the only reliable way to determine if a printer is XPS. – Carey Gregory Dec 20 '13 at 18:47
0

If you detect from CPrintInfo class, printing to XPS file returns following values -

CPrintInfo::m_pPD->GetDriverName() returns "winspool"
CPrintInfo::m_pPD->GetDeviceName() returns "Microsoft XPS Document Writer"
CPrintInfo::m_pPD->GetPortName() returns "XPSPort:"

So, it might be safe enough to assume if it is XPS or not by checking device name and port name.

Shwe Khine
  • 115
  • 1
  • 5