Namespace: printer

cordova.plugins. printer

Members

(static) printer

The default document/job name.

Methods

(static) isAvailable(callback, scopenullable) → {Boolean}

Checks if the printer service is avaible (iOS) or if connected to the Internet (Android).
Parameters:
Name Type Attributes Description
callback function A callback function
scope Object <nullable>
The scope of the callback (default: window)
Returns:
Type
Boolean
Example
cordova.plugins.printer.isAvailable(function (available) {
                  alert(available); });

(static) print(content, options, callbacknullable, scopenullable)

Sends the content to the Google Cloud Print service.
Parameters:
Name Type Attributes Description
content String HTML string or DOM node if latter, innerHTML is used to get the content
options Object Options for the print job
callback function <nullable>
A callback function
scope Object <nullable>
The scope of the callback (default: window)
Example
page = '<h1>This is a test header<h1>';

cordova.plugins.printer.print(page, 'doc.html', function () {
                  alert('print done.'); });

(static) printFiles(filePathArray, options, callbacknullable, scopenullable)

Prints the specified files. Supported files: pdf and images.
Parameters:
Name Type Attributes Description
filePathArray Array.<string> One or more file path
options Object Options for the print job
callback function <nullable>
A callback function
scope Object <nullable>
The scope of the callback (default: window)
Example
cordova.plugins.printer.printFiles(['sample.pdf', 'file.jpg'], 'doc.html', function () {
                  alert('print done.'); });