Windows Printing using win32print
Geoffrey Gerrietts
geoff at homegain.com
Wed Jun 27 15:11:39 EDT 2001
Yes, what's being talked about in this thread is win32print.
The original question, though, asked about printing using win32print, when
in fact his output was not printer-ready -- it was a simple text string he
was trying to write to the printer. Consequently, even though he's asking
about win32print, win32print is not the most effective way to manage his
output -- unless he speaks PostScript or HPL (isn't that what HP printers
speak? I forget...) more fluently than he speaks Python, which I'm doubting.
Hence my answer. I don't think I was misconstruing the issue; I think that
the question was not closely read. Maybe I'm wrong, but the information is
out there.
Thanks for the pointer to the device caps stuff -- that's definitely worth
looking deeper into.
-----Original Message-----
From: Alan Miller
To: python-list at python.org
Sent: 6/26/01 3:52 PM
Subject: RE: Windows Printing using win32print
Geoffrey Gerrietts (geoff at homegain.com) wrote:
>It's funny, I was asking a question about printing thru a different
>mechanism prior to this discussion coming up. I'm using the Windows GDI
>calls to paint text on printer device context.
>
>I've been writing code to dump a simple text file to the printer. I
think
>that I've seen a half-dozen people talking about ways to do it, but
none of
>them are very simple or straightforward.
Actually, I think we're talking about different things - the techniques
in this thread have focused on how to dump a file (text or not, doesn't
really matter) to a specified print queue without changing it in any way
(as in the case where you have something generating PCL or PS and want
to send it to a print queue without having to do it from a command
line).
What you're talking about is how to take a file, format and wrap the
text, and send the resulting output to the printer - really a completely
different beast.
For the question of sizing, I'm not noticing any calls to GetDeviceCaps
or DeviceCapabilities in your code.
GetDeviceCaps can provide information on paper size and non-printable
area size (at least for the top and left - not sure about ways to get
similar values for the bottom and right), though it presumably works
from the default tray selected in the driver.
DeviceCapabilities doesn't seem to provide the info you're looking for
directly, though it does return some information in a DEVMODE structure
that might be useful (items like paper size). I didn't notice anything
about offsets in those docs.
DocumentProperties looks like a way to modify the properties for a
specific print job, but doesn't have any additional information.
ajm
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list