Autore Topic: Capire quante pagine vi sono prima di stampare.  (Letto 317 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.316
  • Ne mors quidem nos iunget
    • Mostra profilo
Capire quante pagine vi sono prima di stampare.
« il: 25 Settembre 2014, 12:21:26 »
Vi riporto questa discussione:


" 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
"
« Ultima modifica: 25 Settembre 2014, 14:49:39 da vuott »
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »