how do I limit "findprinters" output to actual printers on Windows
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!