Can't print multiple pages

I want to print the contents of a textarea and I’m using the following code:

Dim g As Graphics Dim p As PrinterSetup p = New PrinterSetup If p.PageSetupDialog Then g = OpenPrinterDialog(p) If g <> Nil Then g.DrawString(textarea1.text,50,50,450) End If End If

The problem is that it prints only one page
I’m using Ubuntu 12.04

Once you reach the length of the page you’ll have to use g.nextpage this sine done automatically.

Where do I have to put g.nextpage and how can I tell the app what the length of the page is?

That is up to you to figure out… hint : read the link provided above [StringHeight] etc.

Its up to you to parse you text… unless you use the STYLEDTEXTPRINTER function of a TextArea

Is there someone who can help me further, cause I don’t get it.

Have you read the supplied documentation? Have you looked at the appropriate example programs supplied with Xojo?

Yes I did, but that didn’t help me further. I just want to be able to print multiple pages, but the examples don’t help me with that.

Examples/Print and Reporting/Printing/StyledTextPrinterExample ought to do what you want.

Examples/Print is for graphics and styledtextprinter doesn’t work on Linux

Would have been helpful to have either posted this under Linux section or mentioned the platform upfront

In which case … back to my first suggestion.
Walk thru your text, measuring character widths
print a line
if you reach end of page… .eject

Not terribly difficult to do if you apply a little imagination

I had the same problem when I enabled my app to print custom reports from a Valentina Database.

Add this mind numbing amount of code when you’re finished printing everything:

g = nil

Works on Windows.

[quote=54155:@Joseph Morgan]Once you reach the length of the page you’ll have to use g.nextpage this sine done automatically.[/quote]

I forgot to mention the above post from Joseph. When finished printing on a page you need to call g.nextpage to tell Xojo that you’re finished printing on the page and to send it off to the printer. If you do that on the last page then you will print and extra blank page, therefore, you must code so that you call g.NextPage only if you definitely need to print onto another page. Otherwise use g = nil to completely finish and send that last page to the printer.