本文介绍了使用无驱动程序的 IPP 打印(IPP 客户端)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个您无法为其安装驱动程序的设备/电器.我想通过让用户添加 IP 地址来添加支持网络/IPP/AirPrint 打印机的能力.

I have a device/appliance that you cannot install drivers for. I would like to add the ability to support network/IPP/AirPrint printers by having the user add the IP Addresses.

由于我不是通过 Windows 打印(将使用 IPP),我如何自己使用 IPP?是否有允许您使用 IPP 协议与 IPP 打印机交互的 c# 客户端(或任何 Windows 库)?

Since I am not printing through windows (which would use the IPP), how do I use IPP myself? Is there a c# client (or any windows library) out there that allows you to interact with IPP printers with the IPP protocol?

推荐答案

有一些 IPP 客户端实现和 IPP 库可用于不同的编程语言 (java/php/python).一个实用的解决方案可能是使用 http://cups.org/上的 ipptool软件.php.创建一个名为 printjob.ipp 的 ipp-command-file代码>:

There are a few IPP client implementations and IPP libraries available for different programming languages (java/php/python). A practical solution could be to use the ipptool available at http://cups.org/software.php. Create an ipp-command-file called printjob.ipp:

{
 OPERATION Print-Job
 GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en
  ATTR uri printer-uri $uri
 FILE $filename
}

现在您应该可以使用这些选项打印 PDF 文件了:

Now you should be able to print a PDF file using these options:

ipptool -tv -f mydoc.pdf ipp://192.168.2.207 printjob.ipp

确保打印机(或打印服务器)支持您发送的文档格式.我假设您熟悉如何在应用程序中执行外部命令.

Make sure the printer (or print server) supports the document format you send. I assume you're familiar with how to execute an external command in your application.

即使 ipptool 由 CUPS 提供,它也可以完美地与任何 IPP 打印机配合使用.检查 RFC 3510 或您的打印机文档以获取适当的打印机 uri-方案或使用ippfind.

Even though the ipptool is provided by CUPS it works perfect with any IPP printer. Check RFC 3510 or your printers documentation for the appropriate printer-uri-scheme or use ippfind.

经验丰富的开发人员应该能够使用他们首选的编程语言和生态系统来实现打印作业操作.我已经用 100 行代码在 kotlin 中实现了上面的用例:https://github.com/gmuth/ipp-printjob-kotlin.

Experienced developers should be able to implement the print job operation in their preferred programming language and ecosystem. I have implemented the use case from above in kotlin with 100 lines of code: https://github.com/gmuth/ipp-printjob-kotlin.

这是我在 Java 中的最小 PrintJob 实现:https://github.com/gmuth/ipp-printjob-java

This is my minimal PrintJob implementation in Java: https://github.com/gmuth/ipp-printjob-java

这篇关于使用无驱动程序的 IPP 打印(IPP 客户端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-09 23:52