hbar
Posts: 1
Joined: Sun May 19, 2019 8:18 pm

Using pycups without saving file to disk

Sun May 19, 2019 8:39 pm

Hi all,

after dozens of succesful visits to our forum I got stuck with a solution for our printserver.

I'm running a print server at our lab using pycups to print picture or better graph files via python 2.7 after some post processing on a rpi.

Now I'm stuck with the idea to send a 'virtual' processed file via stringIO or byteIO to pycups conn.printfile

Code: Select all

conn.printFile(printer_name, PrintProcessedFile, str(PrintNameInCups), {})
works fine but I want to skip saving an extra file before printing.

Code: Select all

tempfile = StringIO()
            ProcessedFile.save(temppic, format="JPEG", quality=99)
            contents = temppic.getvalue()
            conn.printFile(printer_name, contents, str(PrintNameInCups), {})
doesn't say a word or my python skill are to weak ;)

Can you please help me to understand StingIO oder ByteIO in combination with pycups. Does pycups really need a file saved to disk before printing?

Thank you so much
hbar

Return to “Python”