[python-win32] how to change paper size while printing

McPacino mcpacino at gmail.com
Thu May 29 10:38:16 CEST 2008

I have a network printer. the default paper size is A4.
I have tried 2 ways to change the paper size:

p = win32print.OpenPrinter(dp)
t = win32print.GetPrinter(p, 2)
win32print.SetPrinter(p, 2, t, 0)

these code cause error refuse access, which maybe because of it's network

I get a DEVMODE (dmo) struct by calling win32print.DocumentProperties(0, p,
dp, dmo, dmo, win32con.DM_IN_BUFFER|win32con.DM_OUT_BUFFER),
but I have no idea to apply the DEVMODE to my DC. ( use resetDC()?  it seems
that no resetDC in python)

anybody can give me some hint or sample code? thanks a lot.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080529/20b44cc5/attachment.htm>

More information about the python-win32 mailing list