Printer draw event, multiple pages

Post

Posted
Rating:
#1 (In Topic #2015)
Regular
bill-lancaster is in the usergroup ‘Regular’
I want to generate a pdf file using the printer_draw event.

Everything is fine untill more than one page of data is generated.

Some guidance as to how to do this would be much appreciated
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
bill-lancaster is in the usergroup ‘Regular’
I now see that my problem is that the body of the report is the product of an iteration where a large number of lines are created.

Here is some code to demonstrate:-

  Paint.Begin(MyPrinter)
    Paint.Font = Font["Sans, 20, Bold"]
    Paint.DrawText("Content for Page " & (MyPrinter.Page), 100, 200)

    For i = 0 To 100
      Paint.DrawText("Line " & i, 150, 250 + (i * 300))
    Next

    Paint.Font = Font["Sans, 10"]
    Dim sFooter As String = "Page " & (MyPrinter.Page) & " of " & MyPrinter.Count

    Paint.DrawText(sFooter, 100, Paint.Height - 100)
  Paint.End()

This prints values of i= 0 to about i =30 for each page.

How can the for…next loop be interupted to start a new page?
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
This is the perfect place to use gambas Reoprt Module
Right click on Fmain… New… Report
and lay out your page in the report form there are examples of  reprots in the farm.
Reportexample is one of them there are others.

If you don't want to use the report … then you have to keep track of the number of lines and generate a new page yourself … you put one page in a sub and call it with the data .

Last edit: by GrayGhost

Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
bill-lancaster is in the usergroup ‘Regular’
Thanks GreyGhost,
I'll try both but Report2 first!
Online now: No Back to the top
1 guest and 0 members have just viewed this.