Window.print(): Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Created page with "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 whi..."
 
Line 30: Line 30:
<pre>
<pre>
// window.print() Example
// window.print() Example
// window.print() prints the current screen contents to the printer.
// Prints the current screen contents to the printer.
window.print()
window.print()
</pre>
</pre>

Revision as of 19:36, 21 April 2014

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.

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 (Basic)

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

Example (JavaScript)

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

Output

(The standard system print dialog opens)