当我运行时,lpr <filename>.jpg
文件打印出无边框(这就是我想要的)。
subprocess.call("/usr/bin/lpr " + tmp.name, shell=True)
当我从 Python 程序运行时,它会打印出带有边框的内容。
输出lpoptions
显示如下(我认为StpBorderless=True
应该StpiShrinkOutput=Expand
使其无边界)。
如何lpr
从 Python 脚本执行以使用与从命令行执行它完全相同的选项?
auth-info-required=none
copies=1
device-uri=usb://Canon/CP800?serial=DH00071100000840
finishings=3
job-hold-until=no-hold
job-priority=50
job-sheets=none,none
marker-change-time=0
number-up=1
printer-commands=none
printer-info='Canon CP800'
printer-is-accepting-jobs=true
printer-is-shared=false
printer-location printer-make-and-model='Canon SELPHY-CP770 - CUPS+Gutenprint v5.2.9'
printer-state=3
printer-state-change-time=1433298534
printer-state-reasons=none printer-type=2134028
printer-uri-supported=ipp://localhost:631/printers/Canon_CP800
StpBorderless=True
StpiShrinkOutput=Expand