【问题标题】:How to start/stop printer?如何启动/停止打印机?
【发布时间】:2013-07-23 04:22:44
【问题描述】:

如何使用 CUPS API 暂停/取消暂停打印队列?使用 CUPS API,我可以使用 cupsGetOption() 检查打印机状态。如果这返回值 5,我知道打印机已停止或暂停。在这种情况下,我想取消暂停打印机,有没有办法做到这一点?

【问题讨论】:

  • 无法抗拒:当我读到标题时,首先想到的是“使用锤子”。 :)
  • 这绝对可以阻止任何传入的工作..
  • 找不到任何可以执行此操作的库,但我发现我可以对 cupsenable 进行系统调用。

标签: macos operating-system cups systems-programming


【解决方案1】:

你可以使用cups的ipptool来执行ipp operations:

#!/usr/bin/env ipptool -tv ipp://localhost/printers/your_queue { OPERATION Resume-Printer GROUP operation-attributes-tag ATTR charset attributes-charset utf-8 ATTR language attributes-natural-language en ATTR uri printer-uri $uri }

您可能会被要求输入密码。

【讨论】:

    猜你喜欢
    • 2021-12-05
    • 1970-01-01
    • 2021-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多