如何在Python脚本中为lpr命令设置打印选项?

2024-09-30 06:15:18 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行lpr <filename>.jpg时,该文件将输出无边界(这是我想要的)。在

当我从Python程序运行subprocess.call("/usr/bin/lpr " + tmp.name, shell=True)时,它会打印出带有边框的内容。在

我还试图用“lpr-ostpborderless=True-ostpishrinkoutput=Expand.jpg”来命名它,但仍在打印相同的边框。在

来自lpoptions的输出显示了以下内容(StpBorderless=True,而{}应该是无边界的)。在

如何从Python脚本中执行lpr以使用与从命令行执行完全相同的选项?在

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 

Tags: infononetruejoburiprinter边框边界

热门问题