[wxPython] printing multiple pages

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] printing multiple pages

Brad Losh-2
How do you print multiple pages using the wxPrintout.  Not understanding how to differentiate between pages...

Brad Losh
T&S Brass & Bronze Works
1-864-834-4102  ext 177
[hidden email]


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] printing multiple pages

Jeffrey Kunce
>How do you print multiple pages using the wxPrintout.  Not understanding how to differentiate between pages...

This is a confusing topic - I'm still trying to figure it out completely.

In general it seems that the print framework expects your application to
know how many print pages it will generate, and know how to
print a specific page on command.

The OnPrintPage() method in wxPrintout is called automagically for
every page that is printed - it is given a page-number value that it can
pass on to the applicatipon/canvas so it can draw the information
for the appropriate page.

I have an example of a specific case of multiple-page printing (printing
a continuous text document)
look under:
    wxPython
for:
   PrintableTextControl
at:
    http://starship.python.net/crew/jjkunce/ 

  --Jeff


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] printing multiple pages

Robin Dunn
> >How do you print multiple pages using the wxPrintout.  Not understanding
how to > differentiate between pages...
>
> This is a confusing topic - I'm still trying to figure it out completely.
>
> In general it seems that the print framework expects your application to
> know how many print pages it will generate, and know how to
> print a specific page on command.
>

You can also get by if you don't know how many pages you have.  The html
printout class just sets the max page to 999 and then returns false from
HasPage when it's printed them all...  Looks like that is what you do in your
PrintableTextControl too.

Some programs I've seen will have a flag to their main drawing method that
specifies to just measure, don't actually draw.  Then when they need to print
they call the drawing method with this flag set in order to find out how many
pages there will be, and also where each page begins.  Then as each page is
asked for they already know where to begin and then just call the draw method
again giving starting and ending positions.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users