Hello! I am currently looking for some help or ideas in a specific area of Python programming.

The project I am having problems with pertains to python print drivers, and printing in a Linux OS.

I had originally wanted to find a way (if possible) to write a python print driver for a Linux box I have; but the main issue I have is how to get the code to communicate with the kernel.

Is it possible to write a piece of code that upon kernel start up, be able to translate a USB print driver written in python to C? OR is it possible to just skip the notion of having to load the specific driver in the kernel, and just use a print driver written in python?

OR


Is there a way to send data (whether it is text, file, or strings) directly to the printer itself via python code?

How would I go about doing something of this nature? I have searched high and low and have found very little to go by to accomplish this task. I have always thought python was a very flexible and versatile language but I am having trouble finding information that would pertain to this subject.

The printer normally uses CUPS printing, if that would help at all.


I greatly appreciate any input on the matter.

Thank you,


Page

lpr is the print spooler on Linux so you should be able to do something similar to

import subprocess
subprocess.call("lpr "+filename.txt, shell=True)

"man lpr" will give you all of the print options that lpr supports.

Thank you, I'll check it out. I appreciate the input.

If there is any other methods, I would like to know. I just like to gather as much information on the topic as possible, and then make a decision on how to go about it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.