Window.print()

From NSB App Studio
Jump to navigation Jump to search

window.print()

Description

You can print the current screen contents from your app using the statement window.print(). You can print a full page by creating a form which is approximately 768 x 1004. This may be larger than your actual screen size.

The command is supported on iOS, Chrome on Windows and Safari and Chrome on Mac. It is not supported on Android.

For this to work from an iOS device, you need to be connected by WiFi to a network with a properly configured printer. For example, if you are connected to a Mac running Mac OS 10.6, you can print to any AirPlay enabled printer.

While Apple has only a short list of AirPlay printers built in, almost any printer connected to the network will work if you run HandyPrint on the system.

jQuery Mobile 1.4 adds some extra styling which can interfere with printing a full page. Here is the workaround:

Function btnPrint_onclick()
  Dim h = Page_PrintTest.style.minHeight
  Page_PrintTest.style.minHeight = ""
  window.print()
  Page_PrintTest.style.minHeight = h
End Function

Example

// window.print() Example
// Prints the current screen contents to the printer.
window.print()

Rem window.print() Example
'window.print() prints the current screen contents to the printer.
window.print()

Output

(The standard system print dialog opens)