Windows Printing using win32print

Alan Miller ajm at enteract.com
Tue Jun 26 18:52:29 EDT 2001


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



More information about the Python-list mailing list