Printing plain text with exact positioning on Windows

KvS keesvanschaik at gmail.com
Mon Jan 4 18:50:16 EST 2010


Dear all,

for a python program running on Win XP that is used to produce
invoices I need to be able to have the printer print a page with just
plain text, but positioned (almost) exactly at prescribed places (due
to the use of 'pre formatted' invoice forms). In particular as close
to the left and right edges of the page as possible. So far I've been
using a combination of HTML & CSS, IE automation and fiddling in the
registry to set left and right printing margins of IE to 0 and back to
defaults after the printing is done.

This worked ok, but recently some problem occured that I wasn't able
to solve so far (seemingly random crashes, probably due to an update
to IE 8, I've posted about this problem before:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/3922fdfa4db31ffe/ba8dc24c2b85252c?lnk=gst&q=KvS#ba8dc24c2b85252c
but unfortunately no answers).

So now I'm looking for other ways to get this printing job done. I
know of Tim Goldens page about Windows printing:
http://timgolden.me.uk/python/win32_how_do_i/print.html and have been
googling a lot, but I'm still not convinced what the best way to go
is. E.g. I can't get clear whether the combination reportlab & Acrobat
Reader allows to print very close to the left and right edge of the
paper (without a user having to change something in a Print dialog
etc.).

You would expect this is a relatively typical problem and others have
ran into it before me. Any thoughts on this?

Thanks in advance, Kees



More information about the Python-list mailing list