您当前的位置:首页 > 计算机 > 系统应用 > Linux

为 Linux 安装虚拟 PDF 打印机

时间:12-14来源:作者:点击数:
CDSY,CDSY.XYZ

今天发现一个 CUPS-PDF( cups-pdf de/) 项目,可以为 CUPS( zh.wikipedia 组织网/wiki/CUPS)(Common Unix Printing System)添加 PDF 打印机。

步骤非常简单:

  1. 安装 CPUS-PDF
    sudo apt install -y cups-pdf
    
  2. 根据 CPUS-PDF的文档说明( cups-pdf de/documentation.shtml),需要设置 cups-pdf 的所有者为 root,且权限为 0700
    sudo chown root:root /usr/lib/cups/backend/cups-pdf
    sudo chmod 0700 /usr/lib/cups/backend/cups-pdf
    
  3. 重启 CUPS 服务
    sudo systemctl restart cups.service
    
  4. 可以通过修改 /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                                                              
    
  5. 然后在 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
    
  6. 使用 lpr 打印一个文件试试
    lp ~/dead.letter
    
    request id is PDF-5 (1 file(s))
    
    ls ~/PDF
    
    dead.letter__2_PDF-job_5.pdf
    
  7. 最后要注意的是,根据 README( cups-pdf de/cups-pdf-CURRENT/README) 的说明,客户端选择打印机时,供应商应该选择 Postscript,model选择 Color Printer
CDSY,CDSY.XYZ
方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门
本栏推荐