My program is to print some text using win32api
with same printer. The code below works well on one of my win10 desktop(it means the text size, distance from text to edge, distance between lines are all good), but when I try it on another win10 laptop, the line7
and line8
are missing. It looks like the rest lines are cut while my page still has space for these lines.
The padding space from text to the paper edge is also changed when I use the program in this new lap top. How can I fix these problem?
import win32ui, win32con
multi_line_string = [line1, line2, line3, line4, line5, line6, line7, line8] # My text to print line by line
fontdata = {'name': 'Arial', 'weight': win32con.FW_NORMAL, 'height': 60, 'width': 17}
hDC = win32ui.CreateDC()
hDC.CreatePrinterDC('myprinter')
font = win32ui.CreateFont(fontdata)
hDC.SelectObject(font)
hDC.StartDoc('alex')
hDC.StartPage()
for line in multi_line_string:
hDC.TextOut(X, Y, line)
Y += Y_distance
hDC.EndPage()
hDC.EndDoc()