![macOS:尝试通过 lpadmin 添加 Zebra 打印机](https://linux22.com/image/1598930/macOS%EF%BC%9A%E5%B0%9D%E8%AF%95%E9%80%9A%E8%BF%87%20lpadmin%20%E6%B7%BB%E5%8A%A0%20Zebra%20%E6%89%93%E5%8D%B0%E6%9C%BA.png)
To automate things I usually install printers by way of lpadmin with a short one-liner similar to
sudo /usr/sbin/lpadmin -o printer-is-shared=false -o KMSection=true -p bizhub_C224e -E -v lpd://10.8.4.230/ -P /Library/Printers/PPDs/Contents/Resources/KONICAMINOLTAC224e.gz -D "Bizhub C224e" -L Squamish
Doing it this way works really well in my environments however one of my users just got a Zebra label printer which requires a socket connection. In addition the printer driver is built-in to CUPS, well on the Mac it is anyways. I cannot figure out how to state in the command that I want to use a specific Zebra ZPL printer driver on a socket connection.
Anyone else had any experience with this?
J
答案1
You need to specify the printer-port in a different way:
For USB printers it is usb://Zebra/Model
or something to that effect.
Use lpinfo -v |grep usb:
to get a list of available USB ports. (You can ignore a ?location=XXXXX
part if that is shown in the lpinfo output.)
For socket connections use socket://<ip-addres>:<portnumber>
. E.g. for a JetDirect printers (port 9100) on ip-addres 192.168.1.2 you can use socket://192.168.1.2:9100
.
Obviously using the DNS name instead of the ip-address will work too.
至于型号本身。
首先检查 CUPS 网络界面以查看哪些型号可用。首先将正确的型号设置为虚拟型号(通过网络界面),然后我们lpinfo
查看它在那里的显示方式。然后您可以使用该名称通过命令行进行后续添加。或者使用lpinfo -m | grep Zebra
获取所有可用型号的列表。
只有少数变体,因为所有具有给定打印机语言(EPL、ZPL、EPL2 等)的 Zebra 型号都使用相同的命令集。密度、DPI、标签尺寸和其他作业设置只需在每个打印作业中使用命令即可设置。