Borrar filtros
Borrar filtros

how do I limit "findprinters" output to actual printers on Windows

4 visualizaciones (últimos 30 días)
Jan Keij
Jan Keij el 23 de Jun. de 2020
For a to-be deployed program, I need to build a list of available printers. Using [~, p] = findprinters; on my Windows box, yields 'OneNote for Windows 10', 'Microsoft XPS Document Writer', 'Microsoft Print to PDF', 'HP ENVY 4520 series', and 'Fax'. To remove the non-printers, I used the follwing code, and that did the trick:
forbidden_fruits = {'OneNote', 'Microsoft', 'Fax'};
for n = length(p):-1:1, if contains(p{n}, forbidden_fruits), p(n) = []; end, end
However, recently I downloaded a pdf reader, and now Matlab also finds 'PDF-XChange Lite' among the available printers. I added 'PDF' to the forbidden_fruits, but clearly my filtering will fail in the future as I have no control of what the end users have on their PC.
Is there a more printer-specific command or printer filter, as in a way to 'ping' each "printer" to confirm it is an actual printer.
Thanks.

Respuestas (0)

Categorías

Más información sobre MATLAB Report Generator en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by