cups.Connection.printFile

G

Graham Jenkins

I'm trying to print a file from within a Python program.

The quick-and-dirty solution is to use something like:

fd = os.popen("lp -d MyPrinter", "wb")
fd.write(MyFileContents)

But it seems to me that there should be a clean solution like:

import cups
stat =
cups.Connection.printFile("MyFile","MyPrinter","MyTitle","MyOptions")

Unfortunately, I can't get this to work; not sure of the syntax and have
no idea of what to put for "MyOptions".

So, can anybody help with an example please?

Also .. does anybody know of a way to print a String in this fashion
rather than a File?

Regards ..
 
A

Antoon Pardon

I'm trying to print a file from within a Python program.

The quick-and-dirty solution is to use something like:

fd = os.popen("lp -d MyPrinter", "wb")
fd.write(MyFileContents)

But it seems to me that there should be a clean solution like:

import cups
stat =
cups.Connection.printFile("MyFile","MyPrinter","MyTitle","MyOptions")

What about systems that don't use cups for printing?
 
T

Tim Golden

Antoon said:
I have a linux system that doesn't use cups for printing.
So his "clean" solution won't work on my box. Unless
of course his cups.Connection.printFile is just a wrapper
around os.popen("lp -d MyPrinter", "wb") or something
similar.


Well I certainly don't pretend to offer any solutions on
my "Win32 How do I?" pages except for how to do things
on Win32 ;) .

TJG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top