如果我使用cups.h以编程方式打印,我如何找出打印机可接受的格式?例如,HP 打印机可能接受 HPGL,但其他打印机可能不接受。一些常见的打印格式包括 EPS、Postscript、PDF、HPGL 和 PCL。如何查询打印机以了解它接受哪些打印机?
我也有兴趣知道如何从命令行执行此操作。
答案1
查看 lpinfo 联机帮助页(http://man7.org/linux/man-pages/man8/lpinfo.8.html):
#List drivers matching "HP LaserJet"
lpinfo --make-and-model "HP LaserJet" -m
我在服务器上输入命令并收到如下输出:
foomatic:HP-DeskJet_1000C-pnm2ppa.ppd HP DeskJet 1000C Foomatic/pnm2ppa
foomatic:HP-DeskJet_1100C-pcl3.ppd HP DeskJet 1100C Foomatic/pcl3
foomatic:HP-DeskJet_1120C-pcl3.ppd HP DeskJet 1120C Foomatic/pcl3
foomatic:HP-DeskJet_1200C-pjxl300.ppd HP DeskJet 1200C Foomatic/pjxl300
foomatic:HP-DeskJet_1220C-pcl3.ppd HP DeskJet 1220C Foomatic/pcl3
foomatic:HP-DeskJet_1600CM-Postscript.ppd HP DeskJet 1600CM Foomatic/Postscript
foomatic:HP-DeskJet-deskjet.ppd HP DeskJet Foomatic/deskjet
foomatic:HP-DeskJet-pcl3.ppd HP DeskJet Foomatic/pcl3
foomatic:HP-DeskJet_Plus-deskjet.ppd HP DeskJet Plus Foomatic/deskjet
foomatic:HP-DeskJet_Plus-pcl3.ppd HP DeskJet Plus Foomatic/pcl3
您会注意到每行末尾有 pcl、postscript 等。