Printing using IPP without drivers (IPP Client)

Deadly 提交于 2019-11-28 05:08:37

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 printfile.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
}

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

ipptool -tv -f mydoc.pdf ipp://192.168.2.207 printfile.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. Check RFC 3510 or your printers documentation for the appropriate printer-uri-scheme)

IPP Sample Software

Meanwhile the IPP Sample Software (which includes ipptool mentioned above) is a separate project on Github. It is now under the auspices of the Printer Working Group (PWG), the body which standardized IPP (Internet Printing Protocol).

While the software currently still is in beta, is already very functional. It ships two main command line tools:

  1. 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.

  2. 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. The software ships with a few prepared text files containing example IPP requests, all with a .test suffix for their filenames.

For your purpose, you could run these commands:

  1. 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. This should include an item telling about its supposed IPP versions support. For example reporting as 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. This command will run a complete validation suite against the printer to test for its real-world IPP-1.1 compliance.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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.


AppImage of the IPP Sample Software

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.

You can use it on (almost) any Linux system without having CUPS or ippsample installed!

The AppImage has embedded all the major executable command line tools of the IPP Sample Software project. These exacutables will run as 'sub-commands' of the 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):

    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:

    ./ippsample ippfind
    

    will yield 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

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):

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!