Printing a text file using Python

2008-08-11 Thread Robin Lee
Serge:
in your code i believe that you did one read of your whole input file, and then 
you emitted that to the dc with textout. textout's use  is actually 
(x,y,string).
hence one line got printed (actually the whole file got printed but 
truncated)
you will have to detect all the end of lines and loop a whole lot of dc.textouts

Robin

your code:

dc = win32ui.CreateDC()
  dc.CreatePrinterDC()
dc.SetMapMode(4)# This is UI_MM_LOENGLISH
# With this map mode, 12 points is 12*100/72 units = 16
font = win32ui.CreateFont({'name' : 'Arial', 'height' : 16})
dc.SelectObject(font)
f=open(./Reports/Report.txt,r)
memory=f.read()
f.close
memory.split('\n')
dc.StartDoc(./Reports/Report.txt)
dc.StartPage()
dc.TextOut(10,10,memory)
dc.EndPage()
dc.EndDoc()
--
http://mail.python.org/mailman/listinfo/python-list

Printing a text file using Python

2008-06-01 Thread Robin Lee
Serge:
in your code i believe that you did one read of your whole input file, and then 
you emitted that to the dc with textout. textout's use  is actually 
(x,y,string).
hence one line got printed (actually the whole file got printed but 
truncated)
you will have to detect all the end of lines and loop a whole lot of dc.textouts

Robin

your code:

dc = win32ui.CreateDC()
  dc.CreatePrinterDC()
dc.SetMapMode(4)# This is UI_MM_LOENGLISH
# With this map mode, 12 points is 12*100/72 units = 16
font = win32ui.CreateFont({'name' : 'Arial', 'height' : 16})
dc.SelectObject(font)
f=open(./Reports/Report.txt,r)
memory=f.read()
f.close
memory.split('\n')
dc.StartDoc(./Reports/Report.txt)
dc.StartPage()
dc.TextOut(10,10,memory)
dc.EndPage()
dc.EndDoc()
--
http://mail.python.org/mailman/listinfo/python-list