0

I'm currently printing to a variety of printer models/drivers using GDI, and whilst any font size changes etc don't show up on text only printers, they otherwise work fine with the same Graphics object.

However, I'm now looking to print images, but in this case I want to fall back to a different approach if the printer is a text only printer.

I had a look in the PrinterSettings class but unfortunately I found nothing that would indicate whether I was printing to a text-only or image capable printer.

Is there something else I can call to determine this?

Clinton
  • 22,361
  • 15
  • 67
  • 163
  • Im not sure this is entirely doable. Printers only give the operating system limited information. i mean, some printers staple, some make coffees, future printers have features that haven't even been thought of yet, even if the printer did tell everything to the operating system of what it does, it would be up to the manufacture of to describe it, which would be hit and miss. Now on saying that, you might be able to make a best guess using the information from a WMI query, but i think you will have limited success working this out – TheGeneral Mar 20 '20 at 04:56
  • Doesn’t Windows need to work out a good chuck of info to work out what to translate the GDI commands into? – Clinton Mar 20 '20 at 04:59
  • Not really, there is a driver between the printer and the user mode apis. You are right there is some historical dark magic going on here, and halfbaked support for bits and pieces. but once again, i am not sure the operating system really cares if the printer supports something or not. anyway i could be wrong, and id be interested in an authoritative answer. – TheGeneral Mar 20 '20 at 05:04
  • You can use the [Win32_Printer](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-printer) class `Capabilities`. But you'll have to make some *suppositions* anyway. The `MarkingTechnology` property could be useful, if printers did specify it. They don't. Or, you cannot rely on it. I'm not sure what you consider a *Text-Only Printer*. A tractor-feed printer? These can print graphics, too. – Jimi Mar 20 '20 at 05:21
  • BTW, maybe this can be interesting: [Drawing a Long String on to a Bitmap results in Drawing Issues](https://stackoverflow.com/a/49953353/7444103) (to print Text as Bitmaps or Bitmaps as Text). – Jimi Mar 20 '20 at 05:28
  • You may have to employ a UI fix rather than a technical one. Let whoever is selecting the printer also indicate whether you should do text only output. – Damien_The_Unbeliever Mar 20 '20 at 08:15

0 Answers0