Giter VIP home page Giter VIP logo

ipp-server's Introduction

A minimal IPP server

This is a small python script which pretends to be a printer.

It works well enough to print documents on my Linux box with CUPS 1.7.5, but it doesn't implement the entire IPP specification.

Add ipp-server as a printer

Start running the server:

python -m ippserver --port 1234 save /tmp/

The server listens to localhost by default. The well-known port of 631 is likely to already be in use by the web interface of CUPS, so I'm using port 1234 for this example.

Next, add the printer as you would normally on your computer (ie: the Gnome or KDE add printer dialogs). The printer location is ipp://localhost:1234/.

Doing things with print jobs

You can save print jobs as randomly named .ps files in a given directory:

python -m ippserver --port 1234 save /tmp/

Alternatively, you can send the postscript files to a command. The following command will run hexdump(1) for every print job received. hexdump reads the .ps file from stdin.

python -m ippserver --port 1234 run hexdump

Or why not email print jobs to yourself using mail(1):

python -m ippserver --port 1234 run \
	mail -E \
	-a "MIME-Version 1.0" -a "Content-Type: application/postscript" \
	-s 'A printed document' [email protected]

PDF files

The printer normally advertises itself as a postscript printer. Alternatively, the printer can advertise itself as a PDF printer. This changes the printer description (PPD), so you will need to re-add the printer (eg: with a different port).

Run the printer with save --pdf, and add a new printer:

python -m ippserver --port 7777 save --pdf /tmp/

ipp-server's People

Contributors

h2g2bob avatar devkral avatar

Stargazers

 avatar  avatar Tatyana BRuk avatar Christian Bø avatar Luis Daniel avatar Soumyani1 avatar Sam Foster avatar  avatar Stephen Early avatar Ernad Husremović avatar rong fengliang avatar John Taylor avatar Carl Sverre avatar Luis Gonzalez avatar  avatar Imad Abdou avatar Garfield Emmerich avatar Wang Chao avatar  avatar  avatar Angel Castillo avatar  avatar 0x7a6a avatar woodenrobot avatar Robin Tang avatar Tom Titherington avatar Jesper Andre Lyngesen Pedersen avatar TonySmith_2222 avatar Lee avatar Qinglin avatar polin_x avatar  avatar  avatar Roman Kharin avatar  avatar  avatar Horst avatar Armin Kazemi avatar  avatar Emanuele D'Osualdo avatar  avatar Mi-cc5ec avatar  avatar Jung Sang-jun avatar Caio Ariede avatar Alejandro Garcia avatar Jay Goel avatar Gerhard Muth avatar Evan Widloski avatar Niccolo Raspa avatar  avatar Sérgio Vasquez avatar Yanik Söltzer avatar  avatar Tiago Gomes avatar Hugh Pyle avatar Lorenzo Santina avatar Tejas Tank avatar wacker avatar  avatar  avatar Asynchronous Interruption #0 avatar Neo avatar

Watchers

James Cloos avatar  avatar Wazen Shbair avatar

ipp-server's Issues

Windows compatibility

Windows supports IPP (since a very long time), but this server is not accepted by Windows.
I've got a working implementation on my side, I'll send a pull request with the required changes:

  • pretend IPP 1.0 support,
  • fix some buffering issues.
    (The changes are simple, finding them required some debugging inside the spoolsrv process, fun but definitely not simple :) )

namedtuple instead recordclass

It seems that namedtuple has all functionality of recordclass and will reduce one dependency.
Can recordclass be replaced by namedtuple?

spaces instead tabs

Tabs are seldom used in python programming as they tend to break code (mixed tabs and spaces) and have a variable width.
Would it be ok if I transform your tabs into spaces?

"No section delimiter" exception raised when trying to add the printer to Windows 10

While the server is listening, I try to add the printer to Windows 10 using the printer configuration wizard. As soon as Windows tries to add the printer, the following exception is thrown:

Exception occurred during processing of request from ('127.0.0.1', 56230)
Traceback (most recent call last):
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\socketserver.py", line 747, in __init__
    self.handle()
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\http\server.py", line 432, in handle
    self.handle_one_request()
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\http\server.py", line 420, in handle_one_request
    method()
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\ippserver\server.py", line 101, in do_POST
    self.handle_ipp()
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\ippserver\server.py", line 130, in handle_ipp
    self.ipp_request = request.IppRequest.from_file(self.rfile)
  File "C:\Users\username\AppData\Local\Programs\Python\Python310\lib\site-packages\ippserver\request.py", line 56, in from_file
    raise Exception('No section delimiter')
Exception: No section delimiter
----------------------------------------

License

Sry for bothering you. What is the license of this project?

Do you want help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.