- Command-Line Printer Administration
- How to add and configure printers through the CUPS web interface?
- Command-Line Printing and Options
- How to Install and Configure Cups Print Server on Centos 7
事情的起因是读了这篇 Bye CUPS: Printing with Netcat,因此打算对几种常见的打印方法做个收集。
最简单的方法
网络打印机支持多种协议,其中套接字协议一般使用 9100 端口。
套接字 是指将纯文本打印数据直接发送到 TCP 套接字的连接。一些常用的套接字端口号包括
9100或35。设备 URI(统一资源标识符)的语法为socket://打印机 IP:端口,例如socket://192.168.2.202:9100/。
大多数系统都携带了 netcat 工具,可以用来发送文件。
如果需要打印包含中文字符的文本文件,可以转换为 PostScript 文件。在 macOS 上可以使用 paps。
使用 --font 参数指定字体字号。
一种查看本机字体的方法是使用 fc-list。
双面打印
在安装了 CUPS 的系统上可以通过 lpstat -p -d 查看系统连接了哪些打印机。
默认打印机可以通过 lpoptions -d [打印机名称] 设置。
双面打印只要修改 sides 参数(前提是打印机支持)。