Discussion:
list of printers?
(too old to reply)
T
2021-06-28 06:03:29 UTC
Permalink
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
2021-06-28 11:26:46 UTC
Permalink
Post by T
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
Printer API has it.
T
2021-06-28 15:15:27 UTC
Permalink
Post by JJ
Post by T
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
Printer API has it.
This one?

https://docs.microsoft.com/en-us/windows/win32/printdocs/enumprinters
R.Wieser
2021-06-28 20:22:31 UTC
Permalink
T,
Post by 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
2021-06-28 21:01:19 UTC
Permalink
Post by R.Wieser
T,
Post by 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
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
2021-06-29 08:14:05 UTC
Permalink
T,
Post by 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
2021-06-29 08:54:22 UTC
Permalink
Post by R.Wieser
T,
Post by 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
but, but, but ...
R.Wieser
2021-06-29 13:04:32 UTC
Permalink
T,
Post by 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
2021-06-29 21:07:56 UTC
Permalink
Post by T
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
2021-06-29 22:00:48 UTC
Permalink
Post by JJ
Post by T
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.
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
2021-06-30 11:38:45 UTC
Permalink
Post by T
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
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
R.Wieser
2021-06-30 12:09:42 UTC
Permalink
T,
Post by 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
2021-06-30 16:12:05 UTC
Permalink
Post by R.Wieser
T,
Post by 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
Missed that. Damn.

Loading...