Hello all,
Tuesday, September 16, 2003, 9:26:24 PM, you wrote:
Oops, The first problem should be solved when I add code to manipulate
the page count and output.
So the only problem for me now is below:
Also, the text in the printout was exceptionally small, need at
least 400% zoom before it can be legible. Calling dc.SetUserScale()
would invariably cause blank printout regardless of parameter
values, the preview sort of work though (again only 1st page).
What am i missing?
Thanks in advance!
···
I am trying to print the text data in a table grid. I follow the
example in PrintFramework, I've managed to dump the grid data in
wxPrintOut::onPrintPage which is just a simple nested for-loop to
get the data out. However, the problem is that it wouldn't
advance to next page when the page is nearly full. As a result,
only 1 page of data was printed, the rest of data which should have
been in page 2 or later gone missing. The same problem occurs
in print preview too. What steps/function should i use to
get the text written in a new page? (code below)
Also, the text in the printout was exceptionally small, need at
least 400% zoom before it can be legible. Calling dc.SetUserScale()
would invariably cause blank printout regardless of parameter
values, the preview sort of work though (again only 1st page).
============On PrintPage=========
def OnPrintPage(self, page):
dc = self.GetDC()
#dc_w, dc_h = dc.GetSizeTuple()
font = wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial")
font.SetEncoding(wxPython.fonts.wxFONTENCODING_BIG5)
dc.SetFont(font)
start_x = 20
start_y = 20
for r in range(0, self.grid.GetNumberRows()):
for c in range(0, self.grid.GetNumberCols()):
text = "%s: %s" % (self.grid.GetColLabelValue(c), self.grid.GetCellValue(r,c))
dc.DrawText(text,start_x,start_y)
w, h = dc.GetTextExtent(text)
start_y += h
start_y += 10
#if start_y > dc_h + 5:
# start in a new page ???
return True
--
Best regards,
Herman
You are moving from the screen, which is 72 dots per inch to the printed
page, which is probably 300 dpi or more. See the Demo PrintFramework
example and pay special attention to the code where it determines the
"scaling factor". You must be making some sort of error before calling
dc.SetUserScale().
Good luck.
David Woods
Wisconsin Center for Education Research
University of Wisconsin, Madison
···
-----Original Message-----
From: Herman Lo [mailto:hermanlo@i-cable.com]
Sent: Tuesday, September 16, 2003 8:50 AM
To: Herman Lo
Subject: Re: [wxPython-users] Printing in wxPython
Hello all,
Tuesday, September 16, 2003, 9:26:24 PM, you wrote:
Oops, The first problem should be solved when I add code to manipulate
the page count and output.
So the only problem for me now is below:
Also, the text in the printout was exceptionally small, need at
least 400% zoom before it can be legible. Calling dc.SetUserScale()
would invariably cause blank printout regardless of parameter
values, the preview sort of work though (again only 1st page).
What am i missing?
Thanks in advance!
I am trying to print the text data in a table grid. I follow the
example in PrintFramework, I've managed to dump the grid data in
wxPrintOut::onPrintPage which is just a simple nested for-loop to
get the data out. However, the problem is that it wouldn't
advance to next page when the page is nearly full. As a result,
only 1 page of data was printed, the rest of data which should have
been in page 2 or later gone missing. The same problem occurs
in print preview too. What steps/function should i use to
get the text written in a new page? (code below)
Also, the text in the printout was exceptionally small, need at
least 400% zoom before it can be legible. Calling dc.SetUserScale()
would invariably cause blank printout regardless of parameter
values, the preview sort of work though (again only 1st page).
============On PrintPage=========
def OnPrintPage(self, page):
dc = self.GetDC()
#dc_w, dc_h = dc.GetSizeTuple()
font = wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial")
font.SetEncoding(wxPython.fonts.wxFONTENCODING_BIG5)
dc.SetFont(font)
start_x = 20
start_y = 20
for r in range(0, self.grid.GetNumberRows()):
for c in range(0, self.grid.GetNumberCols()):
text = "%s: %s" % (self.grid.GetColLabelValue(c),
self.grid.GetCellValue(r,c))
dc.DrawText(text,start_x,start_y)
w, h = dc.GetTextExtent(text)
start_y += h
start_y += 10
#if start_y > dc_h + 5:
# start in a new page ???
return True
--
Best regards,
Herman
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org