简体   繁体   English

使用无驱动程序的 IPP 打印(IPP 客户端)

[英]Printing using IPP without drivers (IPP Client)

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.我想通过让用户添加 IP 地址来添加支持网络/IPP/AirPrint 打印机的能力。

Since I am not printing through windows (which would use the IPP), how do I use IPP myself?由于我不是通过 Windows 打印(将使用 IPP),我如何自己使用 IPP? Is there ac# client (or any windows library) out there that allows you to interact with IPP printers with the IPP protocol?是否有 ac# 客户端(或任何 Windows 库)允许您使用 IPP 协议与 IPP 打印机进行交互?

There are a few IPP client implementations and IPP libraries available for different programming languages (java/php/python).有一些 IPP 客户端实现和 IPP 库可用于不同的编程语言 (java/php/python)。 A practical solution could be to use the ipptool available at http://cups.org/software.php .一个实用的解决方案是使用http://cups.org/software.php 上提供的ipptool Create an ipp-command-file called printjob.ipp :创建一个名为printjob.ippipp 命令文件

{
 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
}

Now you should be able to print a PDF file using these options:现在您应该能够使用以下选项打印 PDF 文件:

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.我假设您熟悉如何在应用程序中执行外部命令。

Even though the ipptool is provided by CUPS it works perfect with any IPP printer.即使ipptool是由 CUPS 提供的,它也可以完美地与任何 IPP 打印机配合使用。 Check RFC 3510 or your printers documentation for the appropriate printer-uri-scheme or use ippfind .检查RFC 3510或您的打印机文档以获取适当的打印机 uri-scheme 或使用ippfind

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 .我已经用 100 行代码在 kotlin 中实现了上面的用例: https : //github.com/gmuth/ipp-printjob-kotlin

This is my minimal PrintJob implementation in Java: https://github.com/gmuth/ipp-printjob-java这是我在 Java 中的最小 PrintJob 实现: https : //github.com/gmuth/ipp-printjob-java

IPP Sample Software IPP 示例软件

Meanwhile the IPP Sample Software (which includes ipptool mentioned above) is a separate project on Github.同时, IPP 示例软件(包括ipptool提到的ipptool )是 Github 上的一个单独项目。 It is now under the auspices of the Printer Working Group (PWG), the body which standardized IPP (Internet Printing Protocol).它现在由打印机工作组(PWG) 主持,该组织是标准化 IPP(互联网打印协议)的机构。

While the software currently still is in beta, is already very functional.虽然该软件目前仍处于测试阶段,但已经非常实用。 It ships two main command line tools:它提供了两个主要的命令行工具:

  1. ippserver . ippserver Start it (with the appropriate options) and you will have a fully-fledged IPP server instance on your network, serving as virtual IPP printer (or an IPP server hosting multiple virtual IPP queues) which you can use to test any (or your self-written) IPP client software against.启动它(使用适当的选项),您的网络上将拥有一个成熟的 IPP 服务器实例,充当虚拟 IPP 打印机(或托管多个虚拟 IPP 队列的 IPP 服务器),您可以使用它来测试任何(或您自己的) - 编写)IPP 客户端软件针对。

  2. ipptool . ipptool This is an IPP client program which can send any combination of IPP requests to any IPP instance on the network (CUPS server, ippserver , IPP-capable printer hardware) and validate its responses.这是一个 IPP 客户端程序,它可以将 IPP 请求的任意组合发送到网络上的任何 IPP 实例(CUPS 服务器、 ippserver 、支持 IPP 的打印机硬件)并验证其响应。 The software ships with a few prepared text files containing example IPP requests, all with a .test suffix for their filenames.该软件附带了一些包含示例 IPP 请求的准备好的文本文件,所有文件名都带有.test后缀。

For your purpose, you could run these commands:出于您的目的,您可以运行以下命令:

  1. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print get-printer-attributes.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print get-printer-attributes.test This command will query any IPP printer about its supported IPP attributes.此命令将查询任何 IPP 打印机有关其支持的 IPP 属性的信息。 This should include an item telling about its supposed IPP versions support.这应该包括一个说明其假定的IPP 版本支持的项目。 For example reporting as ipp-versions-supported (1setOf keyword) = 1.0,1.1,2.0 .例如报告为ipp-versions-supported (1setOf keyword) = 1.0,1.1,2.0

  2. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-1.1.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-1.1.test This command will run a complete validation suite against the printer to test for its real-world IPP-1.1 compliance.此命令将针对打印机运行完整的验证套件,以测试其真实世界的IPP-1.1 合规性。

  3. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.0.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.0.test This command will run a complete validation suite against the printer to test for its real-world IPP-2.0 compliance.此命令将针对打印机运行完整的验证套件,以测试其真实世界的IPP-2.0 合规性。

  4. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.0.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.0.test This command will run a complete validation suite against the printer to test for its real-world IPP-2.0 compliance.此命令将针对打印机运行完整的验证套件,以测试其真实世界的IPP-2.0 合规性。

  5. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.1.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.1.test This command will run a complete validation suite against the printer to test for its real-world IPP-2.2 compliance.此命令将针对打印机运行完整的验证套件,以测试其真实世界的IPP-2.2 合规性。

  6. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.2.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.2.test This command will run a complete validation suite against the printer to test for its real-world IPP-2.2 compliance.此命令将针对打印机运行完整的验证套件,以测试其真实世界的IPP-2.2 合规性。

  7. ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-everywhere.test . ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-everywhere.test This command will run a complete IPP Everywhere (which is the latest IPP Standard) validation suite against the printer to test for its real-world IPP Everywhere compliance.此命令将针对打印机运行完整的IPP Everywhere (这是最新的 IPP 标准)验证套件,以测试其真实世界的IPP Everywhere 合规性。


AppImage of the IPP Sample Software IPP 示例软件的 AppImage

To make this type of testing easy for you guys, I created a ready-made executable AppImage from the IPP Sample software that should be able to directly run (no "installation" needed!) on all x86_64 Linux distros.为了让你们轻松进行这种类型的测试,我从 IPP 示例软件创建了一个现成的可执行 AppImage,它应该能够在所有 x86_64 Linux 发行版上直接运行(无需“安装”!)。

You can use it on (almost) any Linux system without having CUPS or ippsample installed!您可以在(几乎)任何 Linux 系统上使用它,而无需安装 CUPS 或 ippsample!

The AppImage has embedded all the major executable command line tools of the IPP Sample Software project. AppImage 嵌入了 IPP 示例软件项目的所有主要可执行命令行工具。 These exacutables will run as 'sub-commands' of the AppImage.这些可执行文件将作为 AppImage 的“子命令”运行。 See further down for examples.有关示例,请参见进一步向下。

  1. Download:下载:

     wget https://github.com/KurtPfeifle/ippsample/releases/download/continuous/ippsample-x86_64.AppImage
  2. Make AppImage executable (and optionally rename it to ippsample ):使 AppImage 可执行(并可选择将其重命名为ippsample ):

     chmod a+x ippsample-x86_64.AppImage mv ippsample-x86_64.AppImage ippsample
  3. Have a look at its built-in help screen:看看它的内置帮助屏幕:

     ./ippsample --ai-usage
  4. Run it:运行它:

     ./ippsample ipptool -t -v ipp://xxx.xxx.xxx.xxx/ipp/print ipp-2.0.test
  5. Find all IPP-capable printers nearby:查找附近所有支持 IPP 的打印机:

     ./ippsample ippfind

    will yield s.th.将产生 s.th. like:像:

     ipp://HPA0B3CCF051B9.local:631/ipp/printer ipp://lenjessie2.local:8444/ipp/print ipp://mbp14.papercut-ipv4.local:631/printers/OJ6500 ipp://mbp14.papercut-ipv4.local:631/printers/libreoffice-pin-code-drucker
  6. Pick one printer, print a job:选择一台打印机,打印一份工作:

     ./ippsample ipptool \\ -tv \\ -f ./printjob.pdf \\ ipp://HPA0B3CCF051B9.local:631/ipp/printer \\ print-job.test

ASCIinema ASCIIcast ASCIinema ASCIIcast

Here is an (older) ASCIinema ascii-cast acting as an illustration of what I wrote about and how to use the IPP Sample Software (and its AppImage):这是一个(较旧的)ASCIinema ascii-cast 作为我所写内容以及如何使用 IPP 示例软件(及其 AppImage)的说明:

asciicast

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM