Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
Jan Keij
Jan Keij le 23 Juin 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.

Réponses (0)

Catégories

En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange

Tags

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by