在哪里可以找到用于 CUPS 打印的 pycups 模块的文档?

问题描述 投票:0回答:4

我正在使用 python cups 模块来列出可用的目的地。一切都很完美。我已经使用

pycups
安装了
sudo apt-get install pycups

import cups

conn = cups.Connection()
printers = conn.getPrinters()
for p in printers:
    print(p)
    print(printers[p],["device-uri"])

问题是我没有找到该模块的文档,以及可以使用哪些方法来实现其他功能。

您知道在哪里可以找到文档吗?

python documentation cups
4个回答
1
投票

我遇到了同样的问题。他们的 github 中有一个example,这就是我能找到的全部。您可能应该使用 python 调试器来了解该库的工作原理。


1
投票

您可以在Python解释器中使用内置的

help
函数:

>>> import cups
>>> help(cups)
# shows auto-generated documentation for cups module

1
投票

您可以使用上面答案中提到的内置帮助功能。 这是使用 pycups 打印文件的示例

 |  printFile(...)
 |      printFile(printer, filename, title, options) -> integer
 |      
 |      Print a file.
 |      
 |      @type printer: string
 |      @param printer: queue name
 |      @type filename: string
 |      @param filename: local file path to the document
 |      @type title: string
 |      @param title: title of the print job
 |      @type options: dict
 |      @param options: dict of options
 |      @return: job ID
 |      @raise IPPError: IPP problem

printFile需要4个参数。 我传递了一本空字典,因为这是必要的,而且我正在使用第一台可用的打印机

import cups
conn = cups.Connection ()
printers = conn.getPrinters ()
# printers is a dictionary containing information about all the printers available

emptyDict = {}
AvailablePrinters = list(printers.keys())
PrinterUsing = AvailablePrinters[0]
conn.printFile(PrinterUsing, "./FileName", "title", emptyDict)

0
投票

pycups-1.9.51 的文档:

http://nagyak.eastron.hu/doc/system-config-printer-libs-1.2.4/pycups-1.9.51/html/

© www.soinside.com 2019 - 2024. All rights reserved.