list of printers?

11 views
Skip to first unread message

T

unread,
Jun 28, 2021, 2:03:31 AMJun 28
to
Hi All,

Is there a system call that will return a list
of all the printers or should I just read the
registry?

Many thanks,
-T

JJ

unread,
Jun 28, 2021, 7:27:04 AMJun 28
to
Printer API has it.

T

unread,
Jun 28, 2021, 11:15:31 AMJun 28
to

R.Wieser

unread,
Jun 28, 2021, 4:22:43 PMJun 28
to
T,

> This one?
>
> https://docs.microsoft.com/en-us/windows/win32/printdocs/enumprinters

Thats one of them. It could not hurt to take a peek at the other functions
in that group ("see also", "Print Spooler API Functions") though.

Depending on what exactly you are looking for - all currently usable
printers, or just a list of possible ones (with drivers installed for them)
or something other - the function(s) you need might differ.

Regards,
Rudy Wieser


T

unread,
Jun 28, 2021, 5:01:23 PMJun 28
to
Hi Rudy,

Under Windows 10, I have found the Devices and Printers
does not always list all the printers -- very frustrating
at times.

I find the missing printers by going into any program
with a print dialog and finding them in the pull down.

So I wanted to write a program that would give me a
quick list of printers, so I can see what is missing
from Devices and Printers.

This is what I wrote for Linux:

$ ListPrinters.pl6
nCount <5>
$i = <0> printer: <B4350>
$i = <1> printer: <Cups-PDF>
$i = <2> printer: <Cups_PDF_rn6>
$i = <3> printer: <Oki_B4350_on_dev_lp0_rn6>
$i = <4> printer: <Virtual_PDF_Printer>

I wanted to add an OS check to the above program
so it would give me Windows as well as Linux
printers.

-T

R.Wieser

unread,
Jun 29, 2021, 4:14:20 AMJun 29
to
T,

> Under Windows 10, I have found the Devices and Printers
> does not always list all the printers -- very frustrating
> at times.
>
> I find the missing printers by going into any program
> with a print dialog and finding them in the pull down.

Thats pretty-much what I'm talking about : the first might be showing the
physical printers you can actually print to and the second a list of
/possible/ printers.

Alas, I've got no idea which of the functions returns which group though.

Regards,
Rudy Wieser


T

unread,
Jun 29, 2021, 4:54:27 AMJun 29
to
but, but, but ...

R.Wieser

unread,
Jun 29, 2021, 9:04:42 AMJun 29
to
T,

> but, but, but ...

:-)

Something I would try is to see if I could, from such "any program with a
print dialog" list all the functions from DLLs it uses, filter out the ones
in the "spool" DLL, and see if I could figure out which one is the dialog
showing those "missing printers" - and from there see if MSDN has some more
info on what it actually does (where it gets it printers from).

Regards,
Rudy Wieser


JJ

unread,
Jun 29, 2021, 5:07:59 PMJun 29
to
On Mon, 28 Jun 2021 14:01:19 -0700, T wrote:
>
> I wanted to add an OS check to the above program
> so it would give me Windows as well as Linux
> printers.

Linux printers must be made recognizable and accessible by Windows systems
from the Linux itself, either as SMB shares, UPnP devices, or Internet
Printers.

T

unread,
Jun 29, 2021, 6:00:51 PMJun 29
to
CUPS (Common Unix Printing System) is pretty good
at find everything, including your surroundings.

Now I want to add Windows support to my program
as well

T

unread,
Jun 30, 2021, 7:38:49 AMJun 30
to

R.Wieser

unread,
Jun 30, 2021, 8:09:55 AMJun 30
to
T,

> Found it!
>
> https://docs.microsoft.com/en-us/dotnet/api/system.drawing.printing.printersettings.installedprinters?redirectedfrom=MSDN&view=net-5.0#System_Drawing_Printing_PrinterSettings_InstalledPrinters

I hope you do realize that is .NET specific/dependant ...

I'm fairly sure you can get the same results using the "spool" group of
(simple) functions though.

Regards,
Rudy Wieser


T

unread,
Jun 30, 2021, 12:12:08 PMJun 30
to
Missed that. Damn.
Reply all
Reply to author
Forward
0 new messages