474,047 Members | 41,517 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing From Python

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
4 2795
mi*****@foord.n et (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\lexmar kps 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
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
> 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
Thomas Heller <th*****@python .net> wrote in message news:<7j******* ***@python.net> ...
mi*****@foord.n et (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\lexmar kps 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3150
by: Kamilche | last post by:
I'm pretty desperate to get color syntax printing. I just tried out the evaluation version of 'Komodo', which several people in here suggested, and its print features are terrible. The text is coming out huge when I print at 8 point, tiny when I'm printing at 14 point (so tiny that it looks like subscripts), the margins are reset at random, and so on. Plus it doesn't recognize all my fonts. I don't care if the pretty printer is in an...
2
3048
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation of the printing, I arranged the graphic elements on the page the way it should be. When I got to printing text, it went across the page, not down as I need it to go. I tried to use the hDC.SetWorldTransform(0, -1, 1, 0, 0, 0) command to rotate...
1
2616
by: uri bushey | last post by:
So I have a tkinter based little program in Python that has a canvas loaded with a WaveSurfer (http://www.speech.kth.se/wavesurfer/) widget. I am trying to print the contents of the WaveSurfer canvas. Is there an easy way to do this in Python? Also, I can pretty easily use the WaveSurfer "print" function in my program, but taht only prints to a PostScript printer or prints out a PostScript file. I would like to automate the process of...
5
3355
by: Donnal Walter | last post by:
We want to be able to print HTML or PDF files to a given printer from Python in a kind of batch mode (without opening a preview window or printer dialog for each file). The printer is on a network, but for testing purposes I have connected it to my desktop via LPT1. I can easily print a text file from Python using: os.system("copy some.txt LPT1") And as expected, using this function with "some.html" simply prints the html source. (But...
2
2070
by: David Isaac | last post by:
I'd like to try personal financial management using Python. I just found PyCheckbook, but it does not support check printing. Is there a Python check printing application kicking around? Thanks, Alan Isaac
8
2444
by: David Isaac | last post by:
"Alan Isaac" <aisaac0@verizon.net> wrote in message news:_A34e.2207$1r6.248@trnddc02... > I'd like to try personal financial management using Python. > I just found PyCheckbook, but it does not support check printing. > Is there a Python check printing application kicking around? OK, I'll assume silence means "no", so new question: What is the current best practice for cross platform printing of PostScript files from Python?
19
3241
by: dcrespo | last post by:
Hi all... Is there a way to print a PDF file directly from Python without having Acrobat installed? I know about ReportLab. It's a python module that lets you create almost any PDF document, but I still don't know if it supports printing, so I'm looking for a Python module that could do it. I want to print a PDF file just like if I were doing it from Acrobat. Daniel.
3
2096
by: defcon8 | last post by:
How can I print html documents in Python on Windows?
2
1621
by: David | last post by:
Hi list. I've never used unicode in a Python script before, but I need to now. I'm not sure where to start. I'm hoping that a kind soul can help me out here. My current (almost non-existant) knowledge of unicode: string types. What I don't understand yet is what encodings are and when you'd want/need to use them. What I'd like is to just be able to
0
10548
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11604
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
11145
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10316
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
4947
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.