wxPrintout shrinks my drawings

Good evening!

I'm trying to printout my drawing according to the PrintFramework
example of the demo. Basically I use the same code, just my canvas is
drawing line charts (over a for loop) one under the other (as many as
required, differs every time). This works very well, also the printing
but recently I realized, if I have many charts to plot, the printout
is shrinking. Here's how it's should look like:

http://www.snowflake-sl.info/normal.JPG

And this happens after I draw many charts:

http://www.snowflake-sl.info/shrinked.JPG

Since my code is quite long and complex, does anyone has already an
idea, where could be the problem? If not I can make a short example
but maybe this is a known problem (since in principle the drawing
works)...

Thanks for any suggestions!

Stefanie

Your code that is setting the scale of the DC is probably based somehow on the number of charts that you have, such that the more there are the more you scale the DC in order to fit them all. Instead you should have a limit to how far you will reduce the scale and print those that don't fit on a 2nd (or 3rd, 4th...) page.

···

On 9/26/09 11:16 AM, Stefanie Lück wrote:

Good evening!

I'm trying to printout my drawing according to the PrintFramework
example of the demo. Basically I use the same code, just my canvas is
drawing line charts (over a for loop) one under the other (as many as
required, differs every time). This works very well, also the printing
but recently I realized, if I have many charts to plot, the printout
is shrinking. Here's how it's should look like:

http://www.snowflake-sl.info/normal.JPG

And this happens after I draw many charts:

http://www.snowflake-sl.info/shrinked.JPG

Since my code is quite long and complex, does anyone has already an
idea, where could be the problem? If not I can make a short example
but maybe this is a known problem (since in principle the drawing
works)...

--
Robin Dunn
Software Craftsman

Thanks Robin!

The scaling works now, but I have one more question: how can I define
where the page break is? I tried something like this but it dosen't
work:
...
def OnPrintPage(self, page):
    ### printer stuff
    dc = self.GetDC()
    dc.StartPage()
    (w, h) = dc.GetSize()
    scaleX = float(w) / 1000
    scaleY = float(h) / 1000
    self.printUserScale = min(scaleX, scaleY)
    dc.SetUserScale(self.printUserScale, self.printUserScale)
    self.preview = self.IsPreview()
    self.canvas.SetPreview(self.preview, self.printUserScale)
    self.canvas.SetPage(page)
    self.ptsizew, self.ptsizeh = self.GetPageSizePixels()
    self.canvas.SetTotalSize(self.ptsizew, self.ptsizeh)
    self.psizew, self.psizeh = self.GetPPIPrinter()
    self.canvas.SetPageSize(self.psizew, self.psizeh)

    ### draw my line charts
    ...
    counter = 0
    ...
    for charts in all_charts:
        # make the charts...
        self.canvas.DoDrawing(dc, y=y, h=h, title=plot_hits,
lst=plot1, lst2=plot2)
        # add counter to print 8 charts per page
        counter = counter + 1
        if counter == 8:
            # new page
            dc.EndPage()
            dc.StartPage()
            counter = 0
        ...
    dc.EndPage()
    return True
...
Thanks for any advice!
Stefanie

···

On Sep 28, 8:39 pm, Robin Dunn <ro...@alldunn.com> wrote:

On 9/26/09 11:16 AM, Stefanie Lück wrote:

> Good evening!

> I'm trying to printout my drawing according to the PrintFramework
> example of the demo. Basically I use the same code, just my canvas is
> drawing line charts (over a for loop) one under the other (as many as
> required, differs every time). This works very well, also the printing
> but recently I realized, if I have many charts to plot, the printout
> is shrinking. Here's how it's should look like:

>http://www.snowflake-sl.info/normal.JPG

> And this happens after I draw many charts:

>http://www.snowflake-sl.info/shrinked.JPG

> Since my code is quite long and complex, does anyone has already an
> idea, where could be the problem? If not I can make a short example
> but maybe this is a known problem (since in principle the drawing
> works)...

Your code that is setting the scale of the DC is probably based somehow
on the number of charts that you have, such that the more there are the
more you scale the DC in order to fit them all. Instead you should have
a limit to how far you will reduce the scale and print those that don't
fit on a 2nd (or 3rd, 4th...) page.

--
Robin Dunn
Software Craftsmanhttp://wxPython.org- Hide quoted text -

- Show quoted text -

You just draw one page at a time. The printout object will call your HasPage for each page it wants to print (you can let it know how many you have by implementing GetPageInfo) and if HasPage returns True then it will call OnPrintPage for that page.

···

On 9/29/09 5:10 AM, Stefanie Lück wrote:

Thanks Robin!

The scaling works now, but I have one more question: how can I define
where the page break is?

--
Robin Dunn
Software Craftsman