フィルターのクリア

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

4 ビュー (過去 30 日間)
Jan Keij
Jan Keij 2020 年 6 月 23 日
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.

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by