How can I get the size of the page, I'm going to print on, in pixels? I need
this in the functions wxPrintout.OnPreparePrinting() to calculate the number of
pages I have in my document and in wxPrintout.OnPrintPage().
P.S. Please, don't say wxPrintout.GetPageSizePixels() ! It is returning
something like 27098x28956 I can hardly imagine how i can stuff the page of
this size into my poor printer
···
--
-----------------------------------------------------------------
ICQ#73297983 Your sincerely, Maxx. mailto:maxxua@pisem.net
How can I get the size of the page, I'm going to print on, in pixels? I need
this in the functions wxPrintout.OnPreparePrinting() to calculate the number of
pages I have in my document and in wxPrintout.OnPrintPage().
In my app I'm getting the page size during OnPrintPage() like this:
dc = self.GetDC()
width, height = dc.GetSizeTuple()
... But I suppose that probably won't work in OnPreparePrinting() -- in my case, I
know that I will only ever be printing a single page.
P.S. Please, don't say wxPrintout.GetPageSizePixels() ! It is returning
something like 27098x28956 I can hardly imagine how i can stuff the page of
this size into my poor printer
Hm, even at 600dpi that's 45.16in x 48.26in -- something does seem odd there.
Are you setting your print data properly? Try something along these lines, if you
don't already have it....
self.printdata = wxPrintData()
self.printdata.SetPaperId(wxPAPER_LETTER)
self.printdata.SetQuality(200) # or whatever dpi your printer handles
[...]
pdd = wxPrintDialogData()
pdd.SetPrintData(self.printdata)
printer = wxPrinter(pdd)
[...]
printout = MyPrintout.MyPrintout(...)
[...]
if not printer.Print(self.GetTopWindow(), printout):
wxMessageBox("There was a problem printing.\nPerhaps your current
printer is not set correctly?", "Printing", wxOK)
else:
self.printdata = printer.GetPrintDialogData().GetPrintData()
printout.Destroy()
By explicitly setting the paper size and print quality, you *might* end up getting
a more reasonable result from GetPageSizePixels() ... (Unless, of course,
GetPageSizePixels() relies on some other information that is not yet available
during OnPreparePrinting(), in which case you'll need something different.)
Jeff Shannon
Technician/Programmer
Credit International