Fw: Printing

Jim & Joanne Collins jjcollins at cableone.net
Wed Dec 22 03:58:13 CET 2004


 Thank you very much for your response.  I've interspersed my questions in
 your reply.

 If you have answers to my question I would be extremely gratefull for your


 Jim Collins

 ----- Original Message ----- 
> From: "Craig Ringer" <craig at postnewspapers.com.au>
> To: "Jim & Joanne Collins" <jjcollins at cableone.net>
> Cc: <python-list at python.org>
> Sent: Monday, December 20, 2004 11:34 PM
> Subject: Re: Printing
> > On Tue, 2004-12-21 at 06:45, Jim & Joanne Collins wrote:
 > > I've completed a semester of computer programming in Python and one
 > > thing we didn't learn was how to send data to a windows printer
 > > instead of the screen.
 > It would be helpful to know what graphical toolkit and canvas widget you
 > are using, as this may well be significant.

I'm not using any widget or any graphics.  I've done programs in Basic for
years and  they have all been strict data handling.  I want to convert some
to Python
as Windows XP doesn't like 16 bit Basic.

 If I have a line in basic that says "print "This is a test print"" how do I
direct that line to the printer
instead of the console?  And to send an escape sequence with it for printer
control in PCL
what is the syntax/format required?

 > > Any help would be greatly appreciated!
> >
> > My usual approach is actually to generate a PDF document using ReportLab
> > and send that to the printer. Under *nix this is easy - if available,
> > CUPS can handle PDF directly, or you use acroread -toPostScript to
> > generate postscript and send that. Under Windows, I expect you can use
> > COM to call acrobat if there isn't a simpler method.
> >
> > If you're using an existing canvas widget for your drawing, it depends
> > on the canvas widget. Some can be saved to a bitmap, some can save
> > vector data, etc.
> >
> > If you could explain how you're doing your screen drawing, that would
> > help a lot.

No screen drawing - no graphics - just data and printer controls.

> > Also, is there any way to send a shell command to access some function
> > of the basic windows operating system such as sort?
> >
> > import os

How does one use the operating system after importing it?  Syntax and

> > help(os.system)
> > help(os.popen)
> >
> > for more advanced use, COM is an option.

 What is the syntax for using COM?

> > > Or to do a DOS directory and send it directly to a file to be accessed
> > > as needed?
> >
> > I'm afraid I just don't understand that. "Do" a DOS directory?  If you
> > want to list the contents of a directory, see help(os.listdir) .

 In basic I write "shell"dir c:\temp\*.*>files.tem" and it does the same as
a dir command
at a DOS prompt and stores it in "files.tem" for me to access later.
> > Craig Ringer
> >

More information about the Python-list mailing list