[Bill Burns]
Is it possible to retrieve the paper width from a printer?
[Tim Golden]
Unhelpfully (and I'd really like to be helpful), I'd point out
that this is really a Win32 question. If you can find out from
somewhere how you can do this at all in Windows, then I'm quite
happy to help work out -- if you still need that help -- how that
translates into Python.
Tim,
Thank you for the reply and your excellent web site!
After I had originally posted my question, I received a response from
Roger Upole and he mentioned DEVMODE and win32print.GetPrinter using
level 2.
When I tried the code below >>at home<< against my little Deskjet 880,
def printerProperties(self):
#self.currentPrinter() is a method I had in my class to
#retrieve the Printer name from a comboBox on the GUI.
pHandle = win32print.OpenPrinter(self.currentPrinter())
properties = win32print.GetPrinter(pHandle, 2)
pDevModeObj = properties["pDevMode"]
print pDevModeObj.FormName
print pDevModeObj.PaperSize
print pDevModeObj.DefaultSource
print pDevModeObj.PaperLength
print pDevModeObj.PaperWidth
win32print.ClosePrinter(pHandle)
it seemed to work exactly as I wanted (PaperWidth> 2159, PaperLength>
2794).
But when I tried it >>at work<< against the Savin 2400, it printed a
PaperWidth of 2159 and a PaperLength of 2794, as well! At the time, the
Savin had 24" & 30" wide paper in it (if I recall correctly), it can't
even hold 8.5" x 11" paper.
So I just figured I would look into it another day and that day hasn't
come yet :-)
I'd still like to make this work though (at some point in time). I did
start to poke around on Savin's support web site....
I also had the idea of maybe trying to set the PaperWidth somehow and
then catching any errors, i.e.,
<pseudo-code>
try:
set.PaperWidth = 36
except SomeError: # 36" paper is not in the printer
set.PaperWidth = 30
except SomeError: # no 30" in the machine either!
set.PaperWidth = 24
</pseudo-code>
Who knows??
I'll definitely repost, if I find something.
Again, thanks for the reply!
Bill
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32