原文地址:https://lujun9972.github.io/blog/2020/04/11/爲linux安裝虛擬pdf打印機/index.html
今天發現一個 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