Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to: simulate an (IPP) printer

I'd like to test out some features that IPP should have (namely, monitoring the number of impressions made; see this question) but I haven't got the hardware yet. How can I simulate such a printer? Is there code for a dummy IPP printer?

I'll be working in either Linux or Windows.

like image 221
Yuval Avatar asked Apr 12 '12 00:04

Yuval


People also ask

How do I test my printer IPP?

For your purpose, you could run these commands: 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.

Do all printers support IPP?

IPP is supported by all modern network Printers and supercedes all legacy network protocols including port 9100 printing and LPD/lpr. IPP is widely implemented in software as well, including the following open source projects: C-based: CUPS and PWG IPP Sample Code.


3 Answers

A fully-fledged, open source, IPP-2.2 and IPP Everywhere compliant printer simulator is the IPP Sample Software on Github. It is provided by the Printer Working Group (PWG), the body which standardized the IPP (Internet Printing Protocol).

The IPP Sample software can be compiled on any major platform: Linux, Windows, macOS.

The software is currently still in beta, but already very functional. One of the commandline tools it ships is ippserver. This is the simulated printer you are looking for. It's much more powerful than Apples Printer Simulator -- but it does not have a GUI. You need to be familiar with running command line tools.

Once you can start ippserver (with the appropriate options) you'll have a fully-fledged virtual IPP printer instance on your network. You can use to test any (or your self-written) IPP client software against it.

IPP Sample ships a second important tool, ipptool. This can serve as an IPP client. You can play with both to test each other. See how that works in this ASCII-cast:

asciicast

If you want to try it yourself and you are on Linux, you do not even need to build it yourself. Simply use my read-made AppImage of the software (consisting of one single executable file), which can directly run without an "install" step. Here's how:

  1. Download it:

    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
    

    (This would run a test suite to validate complete IPP-2.0 compliance of the IPP printer on IP address xxx.xxx.xxx.xxx.)

More test examples:

  1. Print a job:
    ./ippsample ipptool -t -v \ -f my.pdf \ ipp://xxx.xxx.xxx.xxx/ipp/print \ print-job.test (This would print send my.pdf as a print job to the printer.)

  2. Validate printer's print-uri support:
    ./ippsample ipptool -t -v \ -o document-uri=https://ftp.pwg.org/pub/pwg/candidates/cs-ippeve10-20130128-5100.14.pdf \ ipp://xxx.xxx.xxx.xxx/ipp/print \ print-uri.test

    (This would tell the printer to fetch named PDF from document-uri and print it.)

like image 174
Kurt Pfeifle Avatar answered Oct 22 '22 22:10

Kurt Pfeifle


A very good IPP simulator is Apples Printer Simulator. Look for Hardware IO Tools at https://developer.apple.com/download/more/ (see this question)

Even though it's only available for OS X you can still test from Linux or Windows against this network service. Printed pages can pop up in Preview for review. The simulator also supports the required IPP attribute job-impressions-completed. The tool saves a lot of paper.

CUPS is not a good simulator. In order to work properly it needs a real printer it can print to. You might pause a queue and test printing to it. You won't get any impressions-completed > 0 unless you release the queue. This will result in real -not simulated- printing.

like image 39
IPP Nerd Avatar answered Oct 22 '22 22:10

IPP Nerd


CUPS provides an IPP interface for printers. Using Java and jspi (as mentioned in this question; it's a bit outdated and needs some fixing, e.g. to accommodate resolution syntax for attributes) you may have the following code to access a local printer as an IPP printer:

IppPrintService service = new IppPrintService(URI.create("ipp://localhost:631/printers/HL2240D-local"));

Also available is CUPS4J which I think does the same thing, but through its own interfaces and not through javax.print.

like image 25
Yuval Avatar answered Oct 22 '22 22:10

Yuval