[python-win32] win32print not printing

Marcelo Almeida marcelo.cra at hotmail.com
Wed Jan 30 19:21:17 CET 2013


After experiment with several options, I "discovered" one that works the
way I want (actually just altered a bit Tim Golden's code). It is a
workaround, but do the job nicely.

import win32ui
VALUE = 100
X=50; Y=50
my_multiline_string = string.split()
hDC = win32ui.CreateDC ()
hDC.CreatePrinterDC (my_printer_name)
hDC.StartDoc (my_doc_name)
hDC.StartPage ()
for line in my_multiline_string:
      hDC.TextOut (x, y, line)

      y += VALUE

hDC.EndPage ()
hDC.EndDoc ()

Here is the documentation for the DC
handler<http://timgolden.me.uk/pywin32-docs/PyCDC.html>and for the
Textout <http://timgolden.me.uk/pywin32-docs/PyCDC__TextOut_meth.html>method.

Thanks again for the help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20130130/f275ad22/attachment.html>


More information about the python-win32 mailing list