[Gambas-user] Working printsample with more than one page

Roel Touwen roel at ...3306...
Wed Feb 3 16:05:58 CET 2016


Hi Rolf,

In my software I print invoice, lists, whatever.....  When I print 
invoices I print the lines with a function which calculates where it has 
to print on the page:

Public Sub PrintAt(Row As Float, Col As Integer, Txt As String)

   txtWidth = Draw.Font.TextWidth(txt)
   txtHeight = Draw.Font.TextHeight(txt)
   PosY = Row * 162
   posX = Col * 55 + 50
   Paint.DrawRichText(Txt, PosX, PosY, txtWidth, txtHeight)

End

Now I want to skip to the next page when variable Row exceeds a value. 
But somehow I cannot find how I can skip to the next page. So what I am 
realy looking for is the addpage function which was available in gambas 2.
Whe I fiddled arount in my code by telling there were 2 pages, the 
content on page 2 was nog cleared, e.g. it was the same as on page 1.

Any ideas?

Grtz

Roel Touwen



op 03-02-16 15:57, Rolf-Werner Eilert schreef:
> Hi Roel,
>
> The way printing is managed in Gambas3 is completely different in one
> way: You have to tell the number of pages beforehand, then printing runs
> automatically page for page.  There is one help page that gives a rough
> overview.
>
> Why do you want to clear a page? Your code will have to check what to
> print on each page while it is printing, and you cannot stop until all
> pages have been printed.
>
> In my case, the problem was how to print tables of random length.
> Gambas2 was "simple": The program just printed a table line for line,
> then initiated a new page when the table had reached the lower edge.
>
> Now I found this solution for Gambas3: The table will start at a given
> position on the page. There are functions that I could use to measure
> the exact height of each table line. It sums up until it finds it will
> hit the lower end, then save the number of this line in a list, go on to
> the next end of page and so on... After measuring and counting, the
> number of entries in the list will tell how many pages are needed, and
> printing can be started.
>
> I found that the new way of printing is way faster than the old one. It
> is in fact so fast that I could simply print into a temporary pdf file,
> then use this file for a preview. When the user hits OK, this pdf is
> sent to the printer.
>
> On the other hand, I had to re-think a number of functions and when this
> will happen before that etc., and still haven't completely finished :)
>
> Regards
> Rolf
>
> Am 03.02.2016 12:03, schrieb Roel Touwen:
>> Hi all,
>>
>> I'm converting software from Gambas 2 to 3. Printing seems to be very
>> very different in Gambas 3.
>>
>> Has anyone a sample of printing more pages? So also clearing the page etc.
>>
>> Thanks for now.
>>
>> Best regards,
>>
>> Roel
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list