473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Re: cups.Connection.printFile

On 2008-09-16, Graham Jenkins <gr****@vpac.orgwrote:
>
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","My Title","MyOptions")
What about systems that don't use cups for printing?

--
Antoon Pardon
Sep 26 '08 #1
3 2430
On Sep 19, 9:01*am, Antoon Pardon <apar...@forel.vub.ac.bewrote:
On 2008-09-16, Graham Jenkins <gra...@vpac.orgwrote:
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","My Title","MyOptions")

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

--
Antoon Pardon
For Windows, there's a few different ways to print. Tim Golden has a
list on his website:

http://timgolden.me.uk/python/win32_how_do_i/print.html

Mike
Sep 26 '08 #2
On 2008-09-26, Mike Driscoll <ky******@gmail.comwrote:
On Sep 19, 9:01*am, Antoon Pardon <apar...@forel.vub.ac.bewrote:
>On 2008-09-16, Graham Jenkins <gra...@vpac.orgwrote:
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","My Title","MyOptions")

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

--
Antoon Pardon

For Windows, there's a few different ways to print. Tim Golden has a
list on his website:

http://timgolden.me.uk/python/win32_how_do_i/print.html
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.

--
Antoon Pardon
Sep 29 '08 #3
Antoon Pardon wrote:
On 2008-09-26, Mike Driscoll <ky******@gmail.comwrote:
>On Sep 19, 9:01 am, Antoon Pardon <apar...@forel.vub.ac.bewrote:
>>On 2008-09-16, Graham Jenkins <gra...@vpac.orgwrote:

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?

--
Antoon Pardon
For Windows, there's a few different ways to print. Tim Golden has a
list on his website:

http://timgolden.me.uk/python/win32_how_do_i/print.html

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
Sep 29 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Eduardo Hercos Rodrigues | last post by:
Hi, How to print directly from PHP code using CUPS? Thanks, "Eduardo Hercos Rodrigues"
3
by: G-Fit | last post by:
Hello group, I have several servers hosting SQL databases. On each of them, I have several databases. All those databases have the same structure (even those on different servers), only the data...
5
by: Mike Tammerman | last post by:
Hi, I want to get the printer list from CUPS. I found some ways using lpstat -p and http://localhost:631/printers but, these ways require some parsing and I am not sure, if the parsing...
11
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
6
by: Chris Szabo | last post by:
I've created a data access layer for a .NET web application. I'm using C# and framework 1.1. I'm getting an error from time to time when I close a connection saying: ...
18
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
35
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing...
0
by: freefly_xml | last post by:
I am creating a pdf file with fop. When I open the PDF in Adobe reader and print it the quality is much better than when I print the pdf directly from Linux using the lp command. Is there a way...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.