为 Linux 安装虚拟 PDF 打印机
今天发现一个 CUPS-PDF 项目,可以为 CUPS(Common Unix Printing System)添加 PDF 打印机。
步骤非常简单:
安装
CPUS-PDF
sudo apt install -y cups-pdf
根据 CPUS-PDF的文档说明,需要设置
cups-pdf
的所有者为root
,且权限为0700
sudo chown root:root /usr/lib/cups/backend/cups-pdf sudo chmod 0700 /usr/lib/cups/backend/cups-pdf
重启 CUPS 服务
sudo systemctl restart cups.service
可以通过修改
/etc/cups/cups-pdf.conf
的OUT
参数来设置 pdf 的输出位置### Key: Out (config) ## CUPS-PDF output directory ## special qualifiers: ## ${HOME} will be expanded to the user's home directory ## ${USER} will be expanded to the user name ## in case it is an NFS export make sure it is exported without ## root_squash! ## on Ubuntu, the cupsd AppArmor profile needs to be updated ## to match the output path as per instructions in LP:147551 ### Default: /var/spool/cups-pdf/${USER} Out ${HOME}/PDF
然后在 CUPS 的 admin 页面中就能看到一个 PDF 打印机了,或者用
lpstat
来查看:lpstat -p -d
printer PDF is idle. enabled since Sat 11 Apr 2020 09:52:10 PM HKT system default destination: PDF
使用
lpr
打印一个文件试试lp ~/dead.letter
request id is PDF-5 (1 file(s))
ls ~/PDF
dead.letter__2_PDF-job_5.pdf
- 最后要注意的是,根据 README 的说明,客户端选择打印机时,供应商应该选择
Postscript
,model选择Color Printer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论