Printing on Windows

Tim Golden tim.golden at
Mon Jul 19 17:40:37 CEST 2004

[Chris Gonnerman]
| >| What I want to know is, how do I specify what size paper I 
| >| want to print on?

OK, as far as I can see, what you would ideally do is to
call GetPrinter to pick up the current DEVMODE info, adjust
the field you wanted, and then call SetPrinter to fix that
in place before you call StartDoc to initialise the print job.

Unfortunately, in pywin32 the win32print.GetPrinter explicitly 
returns a NULL in place of the DEVMODE pointer (from looking at
the source), and even if it did return a DEVMODE structure, no 
corresponding SetPrinter method is exported.

I'm not grumbling: if I had the wherewithal, I'd send Mark H a
patch to add the functions in. It might be possible via
ctypes but the DEVMODE structure is not small, so there would
be a fair bit of messing about.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list