Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing data from a virtual printer to python

I am trying to make a thing where in other applications you can print to a certain printer and python will get the data. How would I go about making this? It would have to work in all applications, so it would appear as a normal printer, and work on Linux and Windows, even if I have to rewrite it for both.

So to recap: One opens a program and hits the print button. It brings up the printer dialogue and they select the python printer, like any other printer. After they accept, the python program which loaded the module (this will probably be a module) gets the data that the other application printed.

like image 965
Exitus Avatar asked Aug 28 '26 00:08

Exitus


1 Answers

Most Linux distros (and OS X) and use CUPS to do printing these days. A CUPS backends for a specific printer is ultimately just an executable, which you can make do anything you want. The CUPS project provides filter/backend API documentation. There also exists at least one open-source CUPS virtual printer in the form of CUPS-PDF, which might make for a useful example to consult.

On the Windows side I'm afraid I can't help you.

like image 112
llasram Avatar answered Aug 29 '26 13:08

llasram



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!