[Python] Re: Printing plain text with exact positioning on Windows

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Wed Jan 6 06:08:42 CET 2010


KvS wrote:
> Ok, actually I quite like being able to print straightforward through
> your code, i.e. without any extra modules installed. I understand that
> sending text to the printer is in principle as simple as
>
> dc.TextOut(scale_factor * 72,
>     -1 * scale_factor * 72,
>     "Testing...")
>
> I didn't see you do anything with adjusting margins in the code. Does
> that mean that if I would e.g. do
>
> dc.TextOut(0,
>     0,
>     "Testing...")
>
> the printout would appear in the upper left corner of the paper, as
> close to the edges as the printer is capable of? (Sorry, but I only
> have Ubuntu available at the moment, no Windows).
>   
Actually, as I understand it (and I'll admit my understanding is a bit 
flawed in some areas), when you tell MSWinPrint.py to print at (0, 0), 
you are telling it to print at the actual paper edge; if that's outside 
the printable area (and it probably is for most printers), your printing 
will be cut off.

Best thing to do is to try it.




More information about the Python-list mailing list