سؤال

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

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top