[Gambas-user] Trying how many pages before printing

Benoît Minisini gambas at ...1...
Thu Sep 25 14:33:18 CEST 2014


Le 25/09/2014 09:05, Rolf-Werner Eilert a écrit :
> Hi folks,
>
> The only thing that keeps me from actually converting all my Gambas2
> stuff into Gambas3 is the printing function. There are situations when
> you don't know how many pages you will end up with when starting to
> print. For instance, there are tables or longer texts which might be
> more than one page - or not.
>
> So it's necessary to figure out how many pages to print prior to start
> printing. In case of a simple line-by-line text or table, you can simply
> compute the space needed in advance. But in some cases, I have much more
> complex situations, and then it would be easiest to have a way to run a
> simple pre-print and count the pages.
>
> In those Gambas2 projects I mean, I have e. g. a printing function that
> runs in a DO LOOP. When printing reaches the end of the page, it simply
> opens a new page, jumps to the start position and continues printing there.
>
> How do you solve this for Gambas3? I thought, a simple way would be to
> order a single page, printing into a temporary pdf, and look if there is
> another page needed, order another one-page print, and so on. Counting
> each page, you produce only a one-page temporary pdf. Then you start the
> actual printing with the counted number of pages.
>
> Am I completely wrong here? Do you know a better/easier way?
>
> Thank you for any input!
>
> Rolf
>

You must know how many pages you have to print before printing, 
otherwise the user won't be able to see a preview, won't be able to 
print the pages it wants, and won't know if clicking on the print button 
will generate one page or one thousand.

To know how many pages you have to print, you have to compute the layout 
of your printing. And yes, it may mean printing the things twice. One 
virtually to compute the number of pages, and one for real.

Regards,

-- 
Benoît Minisini




More information about the User mailing list