Printing without print dialog

Evren,

     Grant Edwards recently posted some python code that might address your need. Apparently there is an executable called "lpr.exe" that manages printing. Within Python, you can treat this as a file, and thus 'write to a printer' in the same way you can write to a file. Below, I will type out a code snippet originally provided by Grant. By the way, Grant, you're invited to Christmas dinner.

f = popen(("lpr -P %s" % queuename), "w")
f.write("This shows up on the printer.")
f.write("And this does too.")
f.close()

Brian L. Danielsen
Senior Control Engineer

···

-----Original Message-----
From: Evren Esat OZKAN [mailto:sleytr@gmail.com]
Sent: Wednesday, April 19, 2006 6:15 AM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] Printing without print dialog

Hi,

I'm new to Python and wxwidgets. I want to directly print some simple
lines of text to default (dot-matrix) printer *without print dialog*.
I searched web and lists and read some things about wxHtmlPrintout.
But I can't found or write a working code. How can I do this job
platform independently?

Thanks,

--
Evren Esat ÖZKAN
sLeytr.net

I'm new to Python and wxwidgets. I want to directly print some
simple lines of text to default (dot-matrix) printer *without
print dialog*. I searched web and lists and read some things
about wxHtmlPrintout. But I can't found or write a working
code. How can I do this job platform independently?

Grant Edwards recently posted some python code that might
address your need.

Disclaimer: I can only vouch for the snippet under Unix/Linux.

Apparently there is an executable called "lpr.exe" that
manages printing.

The "lpr.exe" that I see on my Win98 installation is part of
Cygwin. The snippet _ought_ to work under windows using the
Cygwin lpr.exe, but I've never tried it.

I don't know if vanilla Windows installations have an lpr.exe
that accepts input from stdin or not.

Within Python, you can treat this as a file, and thus 'write
to a printer' in the same way you can write to a file. Below,
I will type out a code snippet originally provided by Grant.
By the way, Grant, you're invited to Christmas dinner.

Thanks!

···

On 2006-04-19, <Danielsen.external@infineon.com> <Danielsen.external@infineon.com> wrote:

f = popen(("lpr -P %s" % queuename), "w")
f.write("This shows up on the printer.")
f.write("And this does too.")
f.close()

--
Grant Edwards grante Yow! It's a lot of fun
                                  at being alive... I wonder if
                               visi.com my bed is made?!?

Thanks for your replies. Although I prefer pure platform independted
coding but I quickly searched on google and it seems lpr.exe is
available on all WinNTs. Tomorrow I'll try it and if it works I can
add some extra lines of code to my app for WinXP :slight_smile:

···

On 4/19/06, Grant Edwards <grante@visi.com> wrote:

On 2006-04-19, <Danielsen.external@infineon.com> <Danielsen.external@infineon.com> wrote:

>> I'm new to Python and wxwidgets. I want to directly print some
>> simple lines of text to default (dot-matrix) printer *without
>> print dialog*. I searched web and lists and read some things
>> about wxHtmlPrintout. But I can't found or write a working
>> code. How can I do this job platform independently?

> Grant Edwards recently posted some python code that might
> address your need.

Disclaimer: I can only vouch for the snippet under Unix/Linux.

> Apparently there is an executable called "lpr.exe" that
> manages printing.

The "lpr.exe" that I see on my Win98 installation is part of
Cygwin. The snippet _ought_ to work under windows using the
Cygwin lpr.exe, but I've never tried it.

I don't know if vanilla Windows installations have an lpr.exe
that accepts input from stdin or not.

> Within Python, you can treat this as a file, and thus 'write
> to a printer' in the same way you can write to a file. Below,
> I will type out a code snippet originally provided by Grant.
> By the way, Grant, you're invited to Christmas dinner.

Thanks!

> f = popen(("lpr -P %s" % queuename), "w")
> f.write("This shows up on the printer.")
> f.write("And this does too.")
> f.close()

--
Grant Edwards grante Yow! It's a lot of fun
                                  at being alive... I wonder if
                               visi.com my bed is made?!?

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--

Evren Esat ÖZKAN
sleytr@gmail.com
sLeytr.net

There was a note added by someone that the lpr that comes with Win2kXP will not print to the local machine but only a remote one that is running lpd. Or perhaps the local machine would have to be running a service that emulates lpd. If you are able to make it work, or not, I'd like to hear about it.

Michael

Evren Esat OZKAN wrote:

···

Thanks for your replies. Although I prefer pure platform independted
coding but I quickly searched on google and it seems lpr.exe is
available on all WinNTs. Tomorrow I'll try it and if it works I can
add some extra lines of code to my app for WinXP :slight_smile:

On 4/19/06, Grant Edwards <grante@visi.com> wrote:

On 2006-04-19, <Danielsen.external@infineon.com> <Danielsen.external@infineon.com> wrote:

I'm new to Python and wxwidgets. I want to directly print some
simple lines of text to default (dot-matrix) printer *without
print dialog*. I searched web and lists and read some things
about wxHtmlPrintout. But I can't found or write a working
code. How can I do this job platform independently?

Grant Edwards recently posted some python code that might
address your need.

Disclaimer: I can only vouch for the snippet under Unix/Linux.

Apparently there is an executable called "lpr.exe" that
manages printing.

The "lpr.exe" that I see on my Win98 installation is part of
Cygwin. The snippet _ought_ to work under windows using the
Cygwin lpr.exe, but I've never tried it.

I don't know if vanilla Windows installations have an lpr.exe
that accepts input from stdin or not.

Within Python, you can treat this as a file, and thus 'write
to a printer' in the same way you can write to a file. Below,
I will type out a code snippet originally provided by Grant.
By the way, Grant, you're invited to Christmas dinner.

Thanks!

f = popen(("lpr -P %s" % queuename), "w")
f.write("This shows up on the printer.")
f.write("And this does too.")
f.close()

--
Grant Edwards grante Yow! It's a lot of fun
                                  at being alive... I wonder if
                               visi.com my bed is made?!?

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--

Evren Esat ÖZKAN
sleytr@gmail.com
sLeytr.net