Web printing - multi page

I have a problem with web printing. I create the page in a webcanvas, ExecuteJavaScript “print();”, the printer window comes from the Chrome, ok, and the result is fine.
BUT how can I do this if I want to print out a 4 pages text in one time, so four canvas. I create all four before printing, or I must play with the timer and step by step? How can I send all four canvas to the printer before the printing? The user wants to push the “print” button only one time…

And how can I avoid the automatic “Untitled” title on the top of the page?

A sample code or a link should be the best, if possible… :slight_smile:

Thank you in advance!

PS: The XOJO is fantastic! :slight_smile: :slight_smile:

Best way is to do like many sites do, create a page containing everything there is to print.

The “Untitled” probably means you have not set the title of the WebPage.

“The “Untitled” probably means you have not set the title of the WebPage.”

Thank yout, Michel, it was the problem with this, and it works now. By the way, it is interesting, that if the title is empty, then it brings the IP address, so it can’t stay empty.

“Best way is to do like many sites do, create a page containing everything there is to print.”

Perhaps it is my fault, but I don’t understand this… I have tried to have two webcanvas (with the texts and graphics) on the webpage, but the printing window in the Chrome shows only the first page. I checked it with only one webcanvas also, but with double height. Unfortunately the result is the same, the Chrome shows only one printable page, in the case the upper part of the webcanvas…

In the desktop version, it is simple:

dim g as graphics
g = openPrinterDialog()
.
.
g.nextpage

…but this is unfortunately WebGraphics, and .nextpage or something similar doesn’t exists here. :frowning: What is the possible workaround?

Are you setting the WebPage height and minHeight so it encompasses all the webcanvas ?

The printing process:

  1. Canvas.Paint

  2. and in a Timer (ca 5000ms): ExecuteJavaScript “print();”

With one page, it is fine, but page break, nextpage or something else is the matter…

As workaround, I have now 4 “Print” buttons, but this is ridiculous… :slight_smile:

[quote=251409:@Zoltan Dinya]The printing process:

  1. Canvas.Paint

  2. and in a Timer (ca 5000ms): ExecuteJavaScript “print();”

With one page, it is fine, but page break, nextpage or something else is the matter…

As workaround, I have now 4 “Print” buttons, but this is ridiculous… :)[/quote]

You don’t understand. Forget entirely what you know about Desktop printing. It is not your app that prints, it is the browser. You have no control about page break, except the way you place the canvas on the webpage.

You cannot have one canvas and print several consecutive pages from it.

You must have one very long webpage that contains all the information you need, so the browser will print all and that will result in several pieces of paper.

You must make sure the webpage height is sufficient to show or scroll through all the controls you want to print.

Ok, so one “long” canvas…? This is the key?

One long canvas, several canvases, as long as the webpage represents all the pieces of paper, and you make sure that webpage is as tall as what you want to print.

Thank you, Michel! :slight_smile:

You’re welcome.