By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,114 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,114 IT Pros & Developers. It's quick & easy.

Printing From Python

P: n/a
I looked through the manual, I looked on the web and could find very
little on this subject....

The closest I could find was :
http://www.faqts.com/knowledge_base/view.phtml/aid/4549.

Saying that printing (to a printer :-) wasn't easy (at least on
windows - let alone *cross* platform) - and that was dated 2000.

Oh and - http://mail.python.org/pipermail/pyt...er/121462.html
from 2002 giving two different methods for Unix and Windows... the
windows one doesn't work across our network........

Any 'print' modules out there - that implement cross platform printing
interfaces ?

Fuzzy

--

http://www.Voidspace.org.uk The Place where headspace meets
cyberspace. Online resource site - covering science, technology,
computing, cyberpunk, psychology, spirituality, fiction and more.

---

http://www.voidspace.org.uk/atlantib...thonutils.html
Pythonutils - home of dateutils, ConfigObj, StandOut etc.....
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
mi*****@foord.net (Fuzzyman) writes:
I looked through the manual, I looked on the web and could find very
little on this subject....

The closest I could find was :
http://www.faqts.com/knowledge_base/view.phtml/aid/4549.

Saying that printing (to a printer :-) wasn't easy (at least on
windows - let alone *cross* platform) - and that was dated 2000.

Oh and - http://mail.python.org/pipermail/pyt...er/121462.html
from 2002 giving two different methods for Unix and Windows... the
windows one doesn't work across our network........


Although I am connected to a network printer, I have no problems opening
lpt1:, write some data to it, and the printer prints it:

C:\>net use
Neue Verbindungen werden gespeichert.
Status Lokal Remote Netzwerk

-------------------------------------------------------------------------------
[...]
Getrennt LPT1 \\server\lexmarkps Microsoft Windows-Netzwerk
Der Befehl wurde erfolgreich ausgeführt.
C:\>copy con: lpt1:
hello, world
^Z
1 Datei(en) kopiert.

C:\>
Another thing that comes to mind is something like 'notepad /p x.txt'.

If you want to print other things than simple text files, it gets more
complicated IMO.

Thomas
Jul 18 '05 #2

P: n/a
Fuzzyman wrote:
Any 'print' modules out there - that implement cross platform printing
interfaces ?


Well, this solution isn't cross platform, it isn't written in Python,
and it isn't free, but I have used it quite a bit and it works great (on
Windows, at least).

Rpv (http://www.rpvreport.com) is a report generator that is totally
unlike Crystal Reports or other products. To me, it fills a great niche
between complex, gui-designer report writers like Crystal, and the other
end of the spectrum such as trying to format text as an html document
and then doing an external call to your web browser.

Basically, Rpv is a program that will read a text file that your program
creates that will have all of the data that you want to print. It then
reads a template file (another text file) that you create beforehand,
which tells it how to format the report, where to place the data from
the text file, where the headers go, etc.

So, basically the steps I use in a program to let the user print data are:

1). Create the text file containing the data.
2). Do an external call to Rpv, passing it the name of the text file
and the name of the template file.
3). Rpv then opens up a nice print preview window that shows the user
what the report will look like with all of the data included.
4). The user can then press the print button in the preview window and
print the report.

Combined with pygtk (or wxPython), it makes your application look
professional.

And Rpv is pretty cheap. I think I paid something like $40 for an
royalty free version that lets me use it and distribute the runtime to
all my customers.

Also, I have absolutely no connection to the makers of Rpv, I just
really like their product.

Hope this helps.

Jamey
Jul 18 '05 #3

P: n/a
> Saying that printing (to a printer :-) wasn't easy (at least on
windows - let alone *cross* platform) - and that was dated 2000.


Printing is not easy, it is a complicated matter.

You can find 4 simplifications:

1) wxPython has a print-framework, wxPython is cross platform (alas, I only
used it in win32)

2) print postscript. Ghostscript is available on "every" platform.
(printing on PDAs and watches is really different). Postscript is
documented

3) create PDF. PDF viewers & printers are available on "every" platform.
PDF can be created by (free) ReportLab toolkit, and I'm sure there are more
PDF-Classes

4) create XHTML & a Print.CSS. HTML viewers are available on every
Plattform, .CSS allows fairly good styling of printouts.
Harald
Jul 18 '05 #4

P: n/a
Thomas Heller <th*****@python.net> wrote in message news:<7j**********@python.net>...
mi*****@foord.net (Fuzzyman) writes:
I looked through the manual, I looked on the web and could find very
little on this subject....

The closest I could find was :
http://www.faqts.com/knowledge_base/view.phtml/aid/4549.

Saying that printing (to a printer :-) wasn't easy (at least on
windows - let alone *cross* platform) - and that was dated 2000.

Oh and - http://mail.python.org/pipermail/pyt...er/121462.html
from 2002 giving two different methods for Unix and Windows... the
windows one doesn't work across our network........


Although I am connected to a network printer, I have no problems opening
lpt1:, write some data to it, and the printer prints it:

C:\>net use
Neue Verbindungen werden gespeichert.
Status Lokal Remote Netzwerk

-------------------------------------------------------------------------------
[...]
Getrennt LPT1 \\server\lexmarkps Microsoft Windows-Netzwerk
Der Befehl wurde erfolgreich ausgeführt.
C:\>copy con: lpt1:
hello, world
^Z
1 Datei(en) kopiert.

C:\>
Another thing that comes to mind is something like 'notepad /p x.txt'.

If you want to print other things than simple text files, it gets more
complicated IMO.

Thomas

You mean python isn't capable of it ?

Fuzzy
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.