printing with Python/Windows

Roger Burnham roger.burnham at gte.net
Tue Jul 20 21:27:06 EDT 1999


On Tue, 20 Jul 1999 15:34:34 -0700, "Sasha Voynow" <svoynow at yahoo.com> wrote:

>What's the simplest way to print a file (in this case an image)
>from Python on WinNT. I'm not really versed in the win32api
>or MFC. But as a stopgap measure I've got to get this to work on a win32
>platform. I scoured the Pywin / win32 extensions docs, but to no avail.
>
>Thanks,
>
>Sasha Voynow
>
>

Being MFC, its not exactly simple, but I've posted a script that will allow you to
select an image with a file dialog, display it, and then print it at a specified
magnification (uses the print item in the standard PythonWin file menu).

This was taken from a larger app, but shows how to print textual info after the
image and how to handle mutliple pages.  No checking for the image spilling off
the right edge or bottom of the page.

It requires PIL and at least PythonWin build 125 (I believe).  The script must be
run from PythonWin to work...

You can get the script at

http://starship.python.net/crew/roger/

Cheers,

Roger Burnham   
Cambridge Research & Instrumentation   
rburnham at cri-inc.com   
http://www.cri-inc.com/   
http://starship.python.net/crew/roger/   
PGP Key: http://www.nai.com/default_pgp.asp   
PGP Fingerprint: 5372 729A 9557 5F36 177F  084A 6C64 BE27 0BC4 CF2D   




More information about the Python-list mailing list