[python-win32] Problem with win32print.SetPrinter

Tim Roberts timr at probo.com
Wed Mar 2 00:30:54 CET 2011


Roger Upole wrote:
> "Tefnet Developers" <developers at tefnet.pl> wrote in message 
> news:1298974742.7642.1.camel at cacko...
>>
>> The driver used is the generic postscript driver (MS Publisher
>> Imagesetter) provided with Windows.
>>
>> My problem is that changing paper size in the default printer
>> preferences UI changes both members of devmode.
>>
>> Changing the way I do it (as shown before) does not change the paper
>> size in preferences UI - and that's exactly what I need to change.
>>
>> I guess that if both fields are affected by the UI then I should also
>> change both to achieve the desired effect, right?
>>
>> bye,
>> Filip Zyzniewski
>> Tefnet
> Try adding a second GetPrinter immediately after the SetPrinter,
> and see if the returned devmode has the expected values.

This kind of thing is very tricky in Windows -- much trickier than it
should be -- and I've been doing Windows programming for a very, very
long time.  I have a wxPython application that I use to print envelopes
through my Dell 3100 laser printer.  The printer has a "multi-purpose
tray" that I keep stocked with #10 envelopes.  It's very convenient, and
since my handwriting it terrible, the people I write to appreciate it as
well.

Recently, I upgraded from Python 2.5 to Python 2.7, and suddenly my
envelope application stopped working.  It would print in portrait mode
on the normal paper stock, instead of selecting the envelopes in the
multi-purpose tray.  It required two or three hours of fairly intense
hacking before I figured out a recipe to make it work again.  If I had
not previously been a GDI driver developer, I doubt that I could have
figured out the DEVMODE magic that was required.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list