Printer

Improve this doc

$ ionic plugin add de.appplant.cordova.plugin.printer

Repo: https://github.com/katzer/cordova-plugin-printer.git

Prints documents or HTML rendered content

Supported platforms

Usage

import {Printer, PrintOptions} from 'ionic-native';

Printer.isAvailable().then(onSuccess, onError);

let options: PrintOptions = {
     name: 'MyDocument',
     printerId: 'printer007',
     duplex: true,
     landscape: true,
     grayscale: true
   };

Printer.print(content, options).then(onSuccess, onError);

Static Members

isAvailable()

Checks whether to device is capable of printing.

Returns: Promise<boolean>

print(content, options)

Sends content to the printer.

Param Type Details
content string|HTMLElement

The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.

options PrintOptions

optional. The options to pass to the printer

Returns: Promise<any>

PrintOptions

Param Type Details
name
(optional)
string

The name of the print job and the document

printerId
(optional)
string

The network URL of the printer. Only supported on iOS.

duplex
(optional)
boolean

Specifies the duplex mode to use for the print job. Either double-sided (duplex:true) or single-sided (duplex:false). Double-sided by default. Only supported on iOS

landscape
(optional)
boolean

The orientation of the printed content, portrait or landscape Portrait by default.

grayscale
(optional)
boolean

If your application only prints black text, setting this property to true can result in better performance in many cases. False by default.

bounds
(optional)
number[] | any

The Size and position of the print view

API

Native

General